NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
indices.cpp File Reference
#include "dataaccess.hpp"
#include "../utils/tools.hpp"
#include "../../kernel.hpp"
#include <vector>
Include dependency graph for indices.cpp:

Go to the source code of this file.

Functions

static void handleArgumentForIndices (Indices &_idx, Parser &_parser, MemoryManager &_data, StringView sArgument, StringView sCmd)
 This static function is the main driver function for extracting the indices into VectorIndex representations. More...
 
static void extractIndexList (StringView sCols, vector< StringView > &vLines, vector< StringView > &vCols)
 This static function separates the argument into its row and column parts and returns them as vectors of StringView instances. More...
 
static void handleIndexVectors (Parser &_parser, VectorIndex &_vIdx, StringView sIndex)
 This static function will evaluate the indices and it tries to match it to a vector. More...
 
static void handleCasualIndices (Parser &_parser, Indices &_idx, vector< StringView > &vLines, vector< StringView > &vCols, StringView sCmd)
 This function will evaluate all indices, which are interpreted as casual indices, at once and store them into the Indices object. More...
 
static void handleSingleCasualIndex (VectorIndex &_vIdx, vector< StringView > &vIndex, string &sIndexExpressions, vector< int > &vIndexNumbers, int sign)
 This static function is a helper function for handleCasualIndices(), which will be applied to row and column indices separately. More...
 
static void expandIndexVectors (Indices &_idx, MemoryManager &_data, StringView sCmd)
 This function will expand casual indices into vectors. Actually, it is only used for the special case of a string vector. More...
 
static void expandStringIndexVectors (Indices &_idx, MemoryManager &_data)
 This static function expands the indices into vectors, if the current object is the string object. More...
 
Indices getIndices (StringView sCmd, Parser &_parser, MemoryManager &_data, const Settings &_option)
 Wrapper for the new getIndices function interface. More...
 
void getIndices (StringView sCmd, Indices &_idx, Parser &_parser, MemoryManager &_data, const Settings &_option)
 The new interface function to determine the used indices in the current expression part. More...
 
static std::string convertToString (value_type *v, const vector< int > vIndexNumbers)
 This static function is a simple helper to convert the numerical results into a string, representing a parsed index expression. This function is used in case of an exception. More...
 

Function Documentation

◆ convertToString()

static std::string convertToString ( value_type v,
const vector< int >  vIndexNumbers 
)
static

This static function is a simple helper to convert the numerical results into a string, representing a parsed index expression. This function is used in case of an exception.

Parameters
vvalue_type*
vIndexNumbersconst vector<int>
Returns
std::string

Definition at line 369 of file indices.cpp.

References toString().

Referenced by handleCasualIndices().

Here is the call graph for this function:

◆ expandIndexVectors()

static void expandIndexVectors ( Indices _idx,
MemoryManager _data,
StringView  sCmd 
)
static

This function will expand casual indices into vectors. Actually, it is only used for the special case of a string vector.

Parameters
_idxIndices&
_dataMemoryManager&
sCmdStringView
Returns
void

Definition at line 475 of file indices.cpp.

References Indices::col, expandStringIndexVectors(), StringViewBase::find_first_of(), SyntaxError::INVALID_DATA_ACCESS, SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, MemoryManager::isTable(), VectorIndex::isValid(), StringViewBase::length(), Indices::row, StringViewBase::strip(), StringView::subview(), VectorIndex::to_string(), and StringViewBase::to_string().

Referenced by handleArgumentForIndices().

Here is the call graph for this function:

◆ expandStringIndexVectors()

static void expandStringIndexVectors ( Indices _idx,
MemoryManager _data 
)
static

This static function expands the indices into vectors, if the current object is the string object.

Parameters
_idxIndices&
_dataMemoryManager&
Returns
void

Definition at line 516 of file indices.cpp.

References Indices::col, StringMemory::getStringCols(), StringMemory::getStringElements(), VectorIndex::isOpenEnd(), Indices::row, and VectorIndex::setRange().

Referenced by expandIndexVectors().

Here is the call graph for this function:

◆ extractIndexList()

static void extractIndexList ( StringView  sCols,
vector< StringView > &  vLines,
vector< StringView > &  vCols 
)
static

This static function separates the argument into its row and column parts and returns them as vectors of StringView instances.

Parameters
sColsStringView
vLinesvector<StringView>&
vColsvector<StringView>&
Returns
void

Definition at line 236 of file indices.cpp.

References StringViewBase::back(), getNextViewedArgument(), getNextViewedIndex(), StringViewBase::length(), and StringViewBase::strip().

Referenced by handleArgumentForIndices().

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:

◆ handleArgumentForIndices()

static void handleArgumentForIndices ( Indices _idx,
Parser _parser,
MemoryManager _data,
StringView  sArgument,
StringView  sCmd 
)
static

This static function is the main driver function for extracting the indices into VectorIndex representations.

Parameters
_idxIndices&
_parserParser&
_dataMemoryManager&
sArgumentStringView
sCmdStringView
Returns
void

Definition at line 182 of file indices.cpp.

References Indices::col, expandIndexVectors(), extractIndexList(), VectorIndex::front(), handleCasualIndices(), handleIndexVectors(), VectorIndex::numberOfNodes(), and Indices::row.

Referenced by getIndices().

Here is the call graph for this function:

◆ handleCasualIndices()

static void handleCasualIndices ( Parser _parser,
Indices _idx,
vector< StringView > &  vLines,
vector< StringView > &  vCols,
StringView  sCmd 
)
static

This function will evaluate all indices, which are interpreted as casual indices, at once and store them into the Indices object.

Parameters
_parserParser&
_idxIndices&
vLinesvector<StringView>&
vColsvector<StringView>&
sCmdStringView
Returns
void

Definition at line 404 of file indices.cpp.

References date::abs(), Indices::col, convertToString(), mu::ParserBase::Eval(), handleSingleCasualIndex(), intCast(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), VectorIndex::isValid(), mu::real(), Indices::row, mu::ParserBase::SetExpr(), VectorIndex::setIndex(), VectorIndex::to_string(), and StringViewBase::to_string().

Referenced by handleArgumentForIndices().

Here is the call graph for this function:

◆ handleIndexVectors()

static void handleIndexVectors ( Parser _parser,
VectorIndex _vIdx,
StringView  sIndex 
)
static

This static function will evaluate the indices and it tries to match it to a vector.

Parameters
_parserParser&
_vIdxVectorIndex&
sIndexStringView
Returns
void

Definition at line 290 of file indices.cpp.

References mu::ParserBase::Eval(), VectorIndex::front(), intCast(), mu::isnan(), StringViewBase::length(), mu::real(), mu::ParserBase::SetExpr(), and VectorIndex::STRING.

Referenced by handleArgumentForIndices().

Here is the call graph for this function:

◆ handleSingleCasualIndex()

static void handleSingleCasualIndex ( VectorIndex _vIdx,
vector< StringView > &  vIndex,
string &  sIndexExpressions,
vector< int > &  vIndexNumbers,
int  sign 
)
static

This static function is a helper function for handleCasualIndices(), which will be applied to row and column indices separately.

Parameters
_vIdxVectorIndex&
vIndexvector<StringView>&
sIndexExpressionsstring&
vIndexNumbersvector<int>&
signint
Returns
void

Definition at line 329 of file indices.cpp.

References VectorIndex::front(), VectorIndex::OPEN_END, VectorIndex::setIndex(), and VectorIndex::STRING.

Referenced by handleCasualIndices().

Here is the call graph for this function: