NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
dataaccess.hpp File Reference
#include <string>
#include "../ParserLib/muParser.h"
#include "memorymanager.hpp"
#include "table.hpp"
#include "../settings.hpp"
#include "../structures.hpp"
Include dependency graph for dataaccess.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DataAccessParser
 This class is defined to abstrahize the determination of the correct data object and the calculation of the corresponding indices. More...
 

Enumerations

enum  DataOptions { NO_OPTION = 0x0 , REPLACE_NAN = 0x1 , INSERT_STRINGS = 0x2 }
 

Functions

size_t findAssignmentOperator (StringView sCmd)
 
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-argument function. More...
 
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 or their respective values. More...
 
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, respectively. More...
 
MemoryextractRange (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. The returned pointer may as well be a nullptr, if the selectd table does not exist. More...
 
bool isNotEmptyExpression (const std::string &)
 This function checks, whether the passed expression is non-empty (i.e. it contains more than white spaces). More...
 
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, splits up the command line (if selected using doCut) and declares the new cluster, if it is not known up to now. More...
 
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 clusters. More...
 
std::vector< mu::value_typegetDataFromObject (const std::string &sObject, const VectorIndex &vRows, long long int j, bool isCluster)
 This function returns the data from the selected object and switches automatically between tables and clusters. More...
 
DataAccessParser getAccessParserForPlotAndFit (StringView sExpression)
 This function will return the access parser instance for the current expression validate, whether the expression is actual resolveable. More...
 
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 for the plotting and the fitting algorithm. More...
 
Indices getIndices (StringView sCmd, mu::Parser &_parser, MemoryManager &_data, const Settings &_option)
 Wrapper for the new getIndices function interface. More...
 
void getIndices (StringView sCmd, Indices &_idx, mu::Parser &_parser, MemoryManager &_data, const Settings &_option)
 The new interface function to determine the used indices in the current expression part. More...
 
bool isValidIndexSet (const Indices &_idx)
 
std::vector< size_t > getDataGridDimensions (const Indices &_idx, const std::string &sTableName)
 Returns the accessed data grid dimensions. More...
 

Enumeration Type Documentation

◆ DataOptions

Enumerator
NO_OPTION 
REPLACE_NAN 
INSERT_STRINGS 

Definition at line 57 of file dataaccess.hpp.

Function Documentation

◆ extractRange()

Memory * extractRange ( const std::string &  sCmd,
DataAccessParser _accessParser,
int  nDesiredCols,
bool  bSort 
)

This function extracts a portion of a table and returns it to the calling function. The returned pointer may as well be a nullptr, if the selectd table does not exist.

Parameters
sCmdconst std::string&
_accessParserDataAccessParser&
nDesiredColsint
bSortbool
Returns
Memory*

Definition at line 2161 of file dataaccess.cpp.

References Indices::col, DataAccessParser::evalIndices(), Memory::extractRange(), VectorIndex::front(), Memory::getCols(), DataAccessParser::getDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), Memory::getLines(), NumeReKernel::getMemoryManager(), MemoryManager::getTable(), VectorIndex::isOpenEnd(), isValidIndexSet(), VectorIndex::last(), VectorIndex::numberOfNodes(), Indices::row, VectorIndex::setRange(), Memory::sortElements(), and SyntaxError::TABLE_DOESNT_EXIST.

Referenced by analyzePulse(), boneDetection(), calculateSplines(), fastFourierTransform(), fastWaveletTransform(), and regularizeDataSet().

Here is the call graph for this function:

◆ findAssignmentOperator()

size_t findAssignmentOperator ( StringView  sCmd)

Definition at line 242 of file dataaccess.cpp.

References StringViewBase::find().

Referenced by getDataElements(), and isClusterCandidate().

Here is the call graph for this function:

◆ getAccessParserForPlotAndFit()

DataAccessParser getAccessParserForPlotAndFit ( StringView  sExpression)

This function will return the access parser instance for the current expression validate, whether the expression is actual resolveable.

Parameters
sExpressionStringView
Returns
DataAccessParser

Definition at line 2205 of file dataaccess.cpp.

References Indices::col, DataAccessParser::getDataObject(), DataAccessParser::getIndices(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, isValidIndexSet(), Indices::row, SyntaxError::TABLE_DOESNT_EXIST, VectorIndex::to_string(), and StringViewBase::to_string().

Referenced by Plot::extractDataValues(), and getIndicesForPlotAndFit().

Here is the call graph for this function:

◆ getDataElements()

std::string getDataElements ( string &  sLine,
Parser _parser,
MemoryManager _data,
const Settings _option,
int  options 
)

Searches the passed string for calls to any table or cluster and replaces them with internal vectors or their respective values.

Parameters
sLinestring&
_parserParser&
_dataDatafile&
_optionconst Settings&
optionsint
Returns
string

This function actually delegates the hard work to replaceDataEntities(), which is itself public and replaces all calls to a single data entity.

Definition at line 276 of file dataaccess.cpp.

References MemoryManager::containsTablesOrClusters(), MemoryManager::copyTable(), mu::ParserBase::CreateTempVectorVar(), findAssignmentOperator(), mu::ParserBase::GetCachedEquation(), MemoryManager::getCols(), MemoryManager::getLines(), handleCachedDataAccess(), mu::ParserBase::HasCachedAccess(), SyntaxError::invalid_position, isClusterCandidate(), mu::ParserBase::IsCompiling(), MemoryManager::isTable(), resolveTablesAndClusters(), StripSpaces(), SyntaxError::UNMATCHED_PARENTHESIS, and validateParenthesisNumber().

Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringFuncHandler::argumentParser(), FlowCtrl::calc(), FlowCtrl::compile(), Plot::constructDataLegendElement(), Plot::createDataLegends(), createEveryDefinition(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), createMatFromLines(), createMatFromLinesFilled(), differentiate(), FlowCtrl::evalHeader(), evalPoints(), FlowCtrl::evalRangeBasedHeader(), evaluateExpression(), evaluateFittingParams(), evaluateNumerical(), evaluateParameterValues(), ProcedureVarFactory::evaluateProcedureArguments(), Plot::evaluateSubplot(), extractFirstParameterStringValue(), findExtrema(), findZeroes(), CommandLineParser::getExprAsFileName(), CommandLineParser::getExprAsMathExpression(), CommandLineParser::getFileParameterValue(), getIndices(), getWindow(), handleCachedDataAccess(), NumeReKernel::MainLoop(), parseArg(), CommandLineParser::parseExprAsNumericalValues(), Procedure::ProcCalc(), readAndParseIntervals(), Interval::refresh(), NumeRe::StringParser::replaceDataOccurence(), replaceEntityOccurence(), Odesolver::solve(), tableMethod_aliasof(), tableMethod_annotate(), tableMethod_anova(), tableMethod_binsof(), tableMethod_categories(), tableMethod_categorize(), tableMethod_convert(), tableMethod_counteq(), tableMethod_cov(), tableMethod_findCols(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_typeof(), and tableMethod_zscore().

Here is the call graph for this function:

◆ getDataFromObject() [1/2]

std::vector< mu::value_type > getDataFromObject ( const std::string &  sObject,
const VectorIndex vRows,
long long int  j,
bool  isCluster 
)

This function returns the data from the selected object and switches automatically between tables and clusters.

Parameters
sObjectconst std::string&
vRowsconst VectorIndex&
jlong longint
isClusterbool
Returns
std::vector<mu::value_type>

Definition at line 2405 of file dataaccess.cpp.

References VectorIndex::front(), NumeRe::ClusterManager::getCluster(), NumeRe::Cluster::getDouble(), MemoryManager::getElement(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), VectorIndex::INVALID, NumeRe::Cluster::push_back(), and VectorIndex::size().

Here is the call graph for this function:

◆ getDataFromObject() [2/2]

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 clusters.

Parameters
sObjectconst std::string&
ilong longint
jlong longint
isClusterbool
Returns
mu::value_type

Definition at line 2378 of file dataaccess.cpp.

References NumeRe::ClusterManager::getCluster(), NumeRe::Cluster::getDouble(), MemoryManager::getElement(), NumeReKernel::getInstance(), and NumeReKernel::getMemoryManager().

Referenced by Plot::extractDataValues(), and getDataForFit().

Here is the call graph for this function:

◆ getDataGridDimensions()

std::vector< size_t > getDataGridDimensions ( const Indices _idx,
const std::string &  sTableName 
)

Returns the accessed data grid dimensions.

Parameters
_idxconst Indices&
sTableNameconst std::string&
Returns
std::vector<size_t>

Definition at line 2519 of file dataaccess.cpp.

References MemoryManager::cnt(), Indices::col, NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), MemoryManager::isTable(), Indices::row, and VectorIndex::subidx().

Referenced by DataAccessParser::getDataGridDimensions().

Here is the call graph for this function:

◆ getIndices() [1/2]

void getIndices ( StringView  sCmd,
Indices _idx,
Parser _parser,
MemoryManager _data,
const Settings _option 
)

◆ getIndices() [2/2]

Indices getIndices ( StringView  sCmd,
Parser _parser,
MemoryManager _data,
const Settings _option 
)

Wrapper for the new getIndices function interface.

Parameters
sCmdStringView
_parserParser&
_dataMemoryManager&
_optionconst Settings&
Returns
Indices
Deprecated:
Marked as deprecated.

Definition at line 49 of file indices.cpp.

References getIndices().

Referenced by FlowCtrl::calc(), FlowCtrl::compile(), evaluateFittingParams(), evaluateTargetOptionInCommand(), NumeRe::StringParser::getDataForString(), getIndices(), handleCachedDataAccess(), NumeReKernel::MainLoop(), Procedure::ProcCalc(), replaceDataEntities(), searchAndDeleteCluster(), searchAndDeleteTable(), Odesolver::solve(), and NumeRe::StringParser::storeStringToStringObject().

Here is the call graph for this function:

◆ getIndicesForPlotAndFit()

Indices getIndicesForPlotAndFit ( const string &  sExpression,
string &  sDataTable,
int &  nColumns,
bool &  openEnd,
bool &  isCluster 
)

This function will calculate the indices from the passed data expression and return them optimized for the plotting and the fitting algorithm.

Parameters
sExpressionconst string&
sDataTablestring&
nColumnsint&
openEndbool&
isClusterbool&
Returns
Indices

Definition at line 2234 of file dataaccess.cpp.

References Indices::col, getAccessParserForPlotAndFit(), DataAccessParser::getDataObject(), DataAccessParser::getIndices(), DataAccessParser::isCluster(), VectorIndex::isOpenEnd(), and VectorIndex::numberOfNodes().

Referenced by getDataForFit().

Here is the call graph for this function:

◆ isClusterCandidate()

bool isClusterCandidate ( string &  sLine,
string &  sCluster,
bool  doCut 
)

This function checks, whether the passed command line contains the syntax for a cluster candidate, splits up the command line (if selected using doCut) and declares the new cluster, if it is not known up to now.

Parameters
sLinestring&
sClusterstring&
doCutbool
Returns
bool

Definition at line 2296 of file dataaccess.cpp.

References findAssignmentOperator(), NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getMemoryManager(), NumeRe::ClusterManager::isCluster(), NumeRe::ClusterManager::newCluster(), and StripSpaces().

Referenced by FlowCtrl::calc(), FlowCtrl::compile(), getDataElements(), NumeReKernel::MainLoop(), and Procedure::ProcCalc().

Here is the call graph for this function:

◆ isNotEmptyExpression()

bool isNotEmptyExpression ( const string &  sExpr)

This function checks, whether the passed expression is non-empty (i.e. it contains more than white spaces).

Parameters
sExprconst string&
Returns
bool

Definition at line 2275 of file dataaccess.cpp.

◆ isValidIndexSet()

◆ parser_CheckMultArgFunc()

bool parser_CheckMultArgFunc ( const string &  sLeft,
const string &  sRight 
)

This function checks, whether the argument located between sLeft and sRight is part of a multi-argument function.

Parameters
sLeftconst string&
sRightconst string&
Returns
bool

Definition at line 2443 of file dataaccess.cpp.

References getLastToken().

Referenced by convertVectorToExpression(), NumeRe::StringParser::getDataForString(), and NumeRe::StringParser::replaceDataOccurence().

Here is the call graph for this function:

◆ replaceDataEntities()

void replaceDataEntities ( string &  sLine,
const string &  sEntity,
MemoryManager _data,
Parser _parser,
const Settings _option,
int  options 
)

This function replaces all calls to a single data entity with an internal vector or its value, respectively.

Parameters
sLinestring&
sEntityconst string&
_dataDatafile&
_parserParser&
_optionconst Settings&
optionsint
Returns
void

Because this function calls the index parser, it will automatically resolve all nested calls to any data entity included in the current call to the specified data entity.

Definition at line 436 of file dataaccess.cpp.

References mu::ParserBase::CacheCurrentAccess(), Indices::col, NumeRe::StringVarFactory::createTempStringVectorVar(), mu::ParserBase::DisableAccessCaching(), VectorIndex::front(), NumeRe::ClusterManager::getCluster(), MemoryManager::getColElements(), MemoryManager::getCols(), NumeRe::FileAdapter::getDataFileName(), NumeRe::Cluster::getDouble(), MemoryManager::getElement(), MemoryManager::getElementAsString(), MemoryManager::getElementMixed(), MemoryManager::getHeadLineElement(), getIndices(), NumeReKernel::getInstance(), getMafAccessString(), getMatchingParenthesis(), NumeRe::Cluster::getParserString(), NumeReKernel::getStringParser(), MemoryManager::getType(), NumeRe::Cluster::getType(), handleMafDataAccess(), INSERT_STRINGS, SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, mu::CachedDataAccess::IS_CLUSTER, isDelimiter(), NumeRe::Cluster::isDouble(), isInQuotes(), VectorIndex::isOpenEnd(), VectorIndex::isString(), isValidIndexSet(), NumeRe::ClusterItem::ITEMTYPE_DOUBLE, mu::CachedDataAccess::NO_FLAG, SyntaxError::NO_MATRIX, NumeRe::Cluster::push_back(), replaceEntityOccurence(), replaceEntityStringOccurence(), replaceToVectorname(), Indices::row, Indices::sCompiledAccessEquation, VectorIndex::setRange(), mu::ParserBase::SetVectorVar(), NumeRe::Cluster::size(), VectorIndex::size(), TableColumn::STRINGLIKE, VectorIndex::subidx(), VectorIndex::to_string(), and toCmdString().

Referenced by NumeRe::StringParser::replaceDataOccurence(), and resolveTablesAndClusters().

Here is the call graph for this function: