NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
dataaccess.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2018 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19
20#ifndef DATAACCESS_HPP
21#define DATAACCESS_HPP
22
23#include <string>
24#include "../ParserLib/muParser.h"
25#include "memorymanager.hpp"
26#include "table.hpp"
27#include "../settings.hpp"
28#include "../structures.hpp"
29
30
38{
39 private:
40 std::string sDataObject;
43
44 public:
47 DataAccessParser(const DataAccessParser& _accessParser);
48 void evalIndices();
49 std::string& getDataObject();
50 std::string getIndexString();
52 bool isCluster() const;
53 std::vector<size_t> getDataGridDimensions() const;
54};
55
56
58{
59 NO_OPTION = 0x0,
61 INSERT_STRINGS = 0x2
62};
63
64
66bool parser_CheckMultArgFunc(const std::string&, const std::string&);
67
68std::string getDataElements(std::string& sLine, mu::Parser& _parser, MemoryManager& _data, const Settings& _option, int options = REPLACE_NAN);
69void replaceDataEntities(std::string&, const std::string&, MemoryManager&, mu::Parser&, const Settings&, int options = NO_OPTION);
70Memory* extractRange(const std::string& sCmd, DataAccessParser& _accessParser, int nDesiredCols = -1, bool bSort = false);
71bool isNotEmptyExpression(const std::string&);
72bool isClusterCandidate(std::string& sLine, std::string& sCluster, bool doCut = true);
73mu::value_type getDataFromObject(const std::string& sObject, long long int i, long long int j, bool isCluster);
74std::vector<mu::value_type> getDataFromObject(const std::string& sObject, const VectorIndex& vRows, long long int j, bool isCluster);
76Indices getIndicesForPlotAndFit(const std::string& sExpression, std::string& sDataTable, int& nColumns, bool& openEnd, bool& isCluster);
77
78Indices getIndices(StringView sCmd, mu::Parser& _parser, MemoryManager& _data, const Settings& _option);
79void getIndices(StringView sCmd, Indices& _idx, mu::Parser& _parser, MemoryManager& _data, const Settings& _option);
80
81inline bool isValidIndexSet(const Indices& _idx)
82{
83 return _idx.row.isValid() && _idx.col.isValid();
84}
85
86std::vector<size_t> getDataGridDimensions(const Indices& _idx, const std::string& sTableName);
87
88
89#endif // DATAACCESS_HPP
90
91
This class is defined to abstrahize the determination of the correct data object and the calculation ...
Definition: dataaccess.hpp:38
Indices & getIndices()
Returns a reference to the stored indices.
Definition: dataaccess.cpp:196
void evalIndices()
Evaluates open end indices using the identified data object size.
Definition: dataaccess.cpp:141
bool isCluster() const
Determines, whether the data access references a cluster.
Definition: dataaccess.cpp:209
std::string & getDataObject()
Returns a reference to the data object identifier.
Definition: dataaccess.cpp:170
std::vector< size_t > getDataGridDimensions() const
Covenience wrapper method for the global function.
Definition: dataaccess.cpp:222
DataAccessParser()
DataAccessParser default constructor.
Definition: dataaccess.cpp:31
std::string getIndexString()
This member function returns the index definitions as a human-readable string.
Definition: dataaccess.cpp:183
std::string sDataObject
Definition: dataaccess.hpp:40
This class represents a single table in memory, or a - so to say - single memory page to be handled b...
Definition: memory.hpp:68
This class represents the central memory managing instance. It will handle all tables and clusters,...
This class manages the setting values of the internal (kernel) settings of this application.
Definition: settings.hpp:663
This class is the immutable (const) version of a string view. It can be constructed from a MutableStr...
This class abstracts all the index logics, i.e. the logical differences between single indices and in...
Definition: structures.hpp:42
bool isValid() const
This member function determines, whether the internal index set is valid.
Definition: structures.hpp:601
Mathematical expressions parser.
Definition: muParser.h:51
mu::value_type getDataFromObject(const std::string &sObject, long long int i, long long int j, bool isCluster)
This function returns the data from the selected object and switches automatically between tables and...
bool parser_CheckMultArgFunc(const std::string &, const std::string &)
This function checks, whether the argument located between sLeft and sRight is part of a multi-argume...
bool isClusterCandidate(std::string &sLine, std::string &sCluster, bool doCut=true)
This function checks, whether the passed command line contains the syntax for a cluster candidate,...
DataAccessParser getAccessParserForPlotAndFit(StringView sExpression)
This function will return the access parser instance for the current expression validate,...
Indices getIndices(StringView sCmd, mu::Parser &_parser, MemoryManager &_data, const Settings &_option)
Wrapper for the new getIndices function interface.
Definition: indices.cpp:49
std::string getDataElements(std::string &sLine, mu::Parser &_parser, MemoryManager &_data, const Settings &_option, int options=REPLACE_NAN)
Searches the passed string for calls to any table or cluster and replaces them with internal vectors ...
Definition: dataaccess.cpp:276
size_t findAssignmentOperator(StringView sCmd)
Definition: dataaccess.cpp:242
DataOptions
Definition: dataaccess.hpp:58
@ REPLACE_NAN
Definition: dataaccess.hpp:60
@ INSERT_STRINGS
Definition: dataaccess.hpp:61
@ NO_OPTION
Definition: dataaccess.hpp:59
bool isNotEmptyExpression(const std::string &)
This function checks, whether the passed expression is non-empty (i.e. it contains more than white sp...
Memory * extractRange(const std::string &sCmd, DataAccessParser &_accessParser, int nDesiredCols=-1, bool bSort=false)
This function extracts a portion of a table and returns it to the calling function....
Indices getIndicesForPlotAndFit(const std::string &sExpression, std::string &sDataTable, int &nColumns, bool &openEnd, bool &isCluster)
This function will calculate the indices from the passed data expression and return them optimized fo...
void replaceDataEntities(std::string &, const std::string &, MemoryManager &, mu::Parser &, const Settings &, int options=NO_OPTION)
This function replaces all calls to a single data entity with an internal vector or its value,...
Definition: dataaccess.cpp:436
std::vector< size_t > getDataGridDimensions(const Indices &_idx, const std::string &sTableName)
Returns the accessed data grid dimensions.
bool isValidIndexSet(const Indices &_idx)
Definition: dataaccess.hpp:81
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:251
This structure is central for managing the indices of a table or cluster read or write data access....
VectorIndex col
VectorIndex row