NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
dataops.cpp File Reference
#include <wx/image.h>
#include "dataops.hpp"
#include "container.hpp"
#include "../../kernel.hpp"
#include "../ui/language.hpp"
#include "../utils/tools.hpp"
#include "../utils/BasicExcel.hpp"
#include "../ui/error.hpp"
#include "../structures.hpp"
#include "../built-in.hpp"
#include "../maths/parser_functions.hpp"
Include dependency graph for dataops.cpp:

Go to the source code of this file.

Functions

std::string removeQuotationMarks (const std::string &)
 This function simply removes the surrounding quotation marks. More...
 
static void evaluateTransposeForDataOperation (const string &sTarget, Indices &_iSourceIndex, Indices &_iTargetIndex, const MemoryManager &_data, bool bTranspose)
 This function evaluates the transpose flag and switches the indices correspondingly. More...
 
static void performDataOperation (const string &sSource, const string &sTarget, const Indices &_iSourceIndex, const Indices &_iTargetIndex, MemoryManager &_data, bool bMove, bool bTranspose)
 This function will perform the actual data operation. More...
 
void load_data (MemoryManager &_data, Settings &_option, Parser &_parser, string sFileName)
 This function is a wrapper for the Datafile object. It will simply do the whole UI stuff and let the Datafile object do the hard work. More...
 
static std::string ** make_stringmatrix (MemoryManager &_data, Output &_out, Settings &_option, const std::string &sCache, long long int &nLines, long long int &nCols, int &nHeadlineCount, size_t nPrecision, bool bSave)
 This function transforms the data into a string matrix and returns the corresponding pointer. More...
 
void show_data (MemoryManager &_data, Output &_out, Settings &_option, const string &_sCache, size_t nPrecision)
 This function presents the passed data to the user in a visual way. More...
 
void append_data (CommandLineParser &cmdParser)
 This function handles appending data sets to already existing data. More...
 
void clear_cache (MemoryManager &_data, Settings &_option, bool bIgnore)
 This function removes all allocated tables and frees the assigned memory. More...
 
static bool searchAndDeleteTable (const string &sCache, Parser &_parser, MemoryManager &_data, const Settings &_option)
 This static function searches for the named table in the cache map, evaluates the specified indices and deletes the corresponding contents from the table. More...
 
static bool searchAndDeleteCluster (const string &sCluster, Parser &_parser, MemoryManager &_data, const Settings &_option)
 This static function searches for the named cluster in the cluster map, evaluates the specified indices and deletes the corresponding contents from the cluster. More...
 
bool deleteCacheEntry (CommandLineParser &cmdParser)
 This function removes one or multiple entries in the selected table or cluster. More...
 
bool CopyData (CommandLineParser &cmdParser)
 This function copies whole chunks of data between tables. More...
 
bool moveData (CommandLineParser &cmdParser)
 This function will move the selected part of a data table to a new location. More...
 
static bool sortStrings (CommandLineParser &cmdParser, Indices &_idx)
 This static function sorts strings and is called by sortData, if the selected data object equals "string". More...
 
static bool sortClusters (CommandLineParser &cmdParser, const string &sCluster, Indices &_idx)
 This static function sorts clusters and is called by sortData, if the selected data object equals a cluster identifier. More...
 
bool sortData (CommandLineParser &cmdParser)
 This function is a wrapper for the corresponding member function of the Datafile object. More...
 
bool writeToFile (CommandLineParser &cmdParser)
 This function writes the string contents in the command to a file. More...
 
bool readFromFile (CommandLineParser &cmdParser)
 This function reads the content of a file as strings and copies them to a temporary string vector variable. More...
 
bool readImage (CommandLineParser &cmdParser)
 This function reads image data from an image file and stores it as a cache table. More...
 

Variables

Language _lang
 

Function Documentation

◆ append_data()

◆ clear_cache()

void clear_cache ( MemoryManager _data,
Settings _option,
bool  bIgnore 
)

This function removes all allocated tables and frees the assigned memory.

Parameters
_dataDatafile&
_optionSettings&
bIgnorebool
Returns
void

Definition at line 428 of file dataops.cpp.

References _lang, Language::get(), Settings::getExePath(), NumeReKernel::getline(), Settings::getSavePath(), MemoryManager::getSaveStatus(), MemoryManager::isValid(), LineBreak(), NumeReKernel::print(), NumeReKernel::printPreFmt(), MemoryManager::removeTablesFromMemory(), Settings::systemPrints(), and Language::YES().

Referenced by cmd_clear().

Here is the call graph for this function:

◆ CopyData()

bool CopyData ( CommandLineParser cmdParser)

This function copies whole chunks of data between tables.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 620 of file dataops.cpp.

References DataAccessParser::evalIndices(), evaluateTransposeForDataOperation(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getTargetTable(), CommandLineParser::hasParam(), and performDataOperation().

Referenced by cmd_copy().

Here is the call graph for this function:

◆ deleteCacheEntry()

bool deleteCacheEntry ( CommandLineParser cmdParser)

This function removes one or multiple entries in the selected table or cluster.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 579 of file dataops.cpp.

References CommandLineParser::getExpr(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), getNextArgument(), NumeReKernel::getParser(), NumeReKernel::getSettings(), NumeRe::ClusterManager::isCluster(), searchAndDeleteCluster(), searchAndDeleteTable(), and StripSpaces().

Referenced by cmd_delete().

Here is the call graph for this function:

◆ evaluateTransposeForDataOperation()

static void evaluateTransposeForDataOperation ( const string &  sTarget,
Indices _iSourceIndex,
Indices _iTargetIndex,
const MemoryManager _data,
bool  bTranspose 
)
static

This function evaluates the transpose flag and switches the indices correspondingly.

Parameters
sTargetconst string&
_iSourceIndexIndices&
_iTargetIndexIndices&
_dataconst Datafile&
bTransposebool
Returns
void

Definition at line 698 of file dataops.cpp.

References Indices::col, VectorIndex::front(), MemoryManager::getCols(), VectorIndex::isOpenEnd(), isValidIndexSet(), Indices::row, and VectorIndex::size().

Referenced by CopyData(), and moveData().

Here is the call graph for this function:

◆ load_data()

void load_data ( MemoryManager _data,
Settings _option,
Parser _parser,
string  sFileName 
)

This function is a wrapper for the Datafile object. It will simply do the whole UI stuff and let the Datafile object do the hard work.

Parameters
_dataDatafile&
_optionSettings&
_parserParser&
sFileNamestring
Returns
void

Definition at line 53 of file dataops.cpp.

References _lang, append_data(), CommandLineParser::CMD_DAT_PAR, Language::get(), NumeRe::FileAdapter::getDataFileName(), NumeReKernel::getline(), FileSystem::getPath(), MemoryManager::isEmpty(), LineBreak(), NumeRe::FileAdapter::openFile(), NumeReKernel::print(), NumeReKernel::printPreFmt(), MemoryManager::removeData(), StripSpaces(), and Language::YES().

Referenced by cmd_load().

Here is the call graph for this function:

◆ make_stringmatrix()

static std::string ** make_stringmatrix ( MemoryManager _data,
Output _out,
Settings _option,
const std::string &  sCache,
long long int &  nLines,
long long int &  nCols,
int &  nHeadlineCount,
size_t  nPrecision,
bool  bSave 
)
static

This function transforms the data into a string matrix and returns the corresponding pointer.

Note
The calling function is responsible to clear the allocated memory.
Parameters
_dataDatafile&
_outOutput&
_optionSettings&
sCacheconst std::string&
nLineslong longint&
nColslong longint&
nHeadlineCountint&
nPrecisionsize_t
bSavebool
Returns
std::string**

Definition at line 147 of file dataops.cpp.

References date::abs(), MemoryManager::getCols(), MemoryManager::getElement(), MemoryManager::getHeadlineCount(), MemoryManager::getHeadLineElement(), MemoryManager::getLines(), MemoryManager::getTopHeadLineElement(), SyntaxError::invalid_position, Output::isCompact(), Settings::isDeveloperMode(), mu::isinf(), MemoryManager::isValidElement(), SyntaxError::NO_CACHED_DATA, NumeReKernel::print(), Output::setCompact(), toString(), and Settings::useExternalDocWindow().

Referenced by show_data().

Here is the call graph for this function:

◆ moveData()

bool moveData ( CommandLineParser cmdParser)

This function will move the selected part of a data table to a new location.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 655 of file dataops.cpp.

References DataAccessParser::evalIndices(), evaluateTransposeForDataOperation(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getTargetTable(), CommandLineParser::hasParam(), and performDataOperation().

Referenced by cmd_move().

Here is the call graph for this function:

◆ performDataOperation()

static void performDataOperation ( const string &  sSource,
const string &  sTarget,
const Indices _iSourceIndex,
const Indices _iTargetIndex,
MemoryManager _data,
bool  bMove,
bool  bTranspose 
)
static

This function will perform the actual data operation.

Parameters
sSourceconst string&
sTargetconst string&
_iSourceIndexconst Indices&
_iTargetIndexconst Indices&
_dataDatafile&
bMovebool
bTransposebool
Returns
void

Definition at line 757 of file dataops.cpp.

References Indices::col, MemoryManager::deleteEntry(), MemoryManager::getCols(), MemoryManager::getElement(), MemoryManager::getHeadLineElement(), MemoryManager::getLines(), MemoryManager::isValidElement(), Indices::row, MemoryManager::setHeadLineElement(), VectorIndex::size(), and MemoryManager::writeToTable().

Referenced by CopyData(), and moveData().

Here is the call graph for this function:

◆ readFromFile()

bool readFromFile ( CommandLineParser cmdParser)

This function reads the content of a file as strings and copies them to a temporary string vector variable.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 1145 of file dataops.cpp.

References SyntaxError::CANNOT_READ_FILE, getAllArguments(), CommandLineParser::getCommandLine(), CommandLineParser::getExprAsFileName(), StyledTextFile::getLine(), StyledTextFile::getLinesCount(), CommandLineParser::getParameterValueAsString(), StyledTextFile::getStrippedLine(), CommandLineParser::hasParam(), SyntaxError::invalid_position, SyntaxError::NO_FILENAME, removeQuotationMarks(), replaceAll(), StyledTextFile::reStyle(), CommandLineParser::setReturnValue(), and StripSpaces().

Referenced by cmd_read().

Here is the call graph for this function:

◆ readImage()

◆ removeQuotationMarks()

std::string removeQuotationMarks ( const std::string &  sString)

This function simply removes the surrounding quotation marks.

Parameters
sStringconst std::string&
Returns
std::string

Definition at line 79 of file stringfunctions.hpp.

Referenced by readFromFile().

◆ searchAndDeleteCluster()

static bool searchAndDeleteCluster ( const string &  sCluster,
Parser _parser,
MemoryManager _data,
const Settings _option 
)
static

This static function searches for the named cluster in the cluster map, evaluates the specified indices and deletes the corresponding contents from the cluster.

Parameters
sClusterconst string&
_parserParser&
_dataDatafile&
_optionconst Settings&
Returns
bool

Definition at line 540 of file dataops.cpp.

References NumeRe::Cluster::deleteItems(), NumeRe::ClusterManager::getCluster(), NumeRe::ClusterManager::getClusterMap(), getIndices(), VectorIndex::isOpenEnd(), isValidIndexSet(), Indices::row, VectorIndex::setRange(), and NumeRe::Cluster::size().

Referenced by deleteCacheEntry().

Here is the call graph for this function:

◆ searchAndDeleteTable()

static bool searchAndDeleteTable ( const string &  sCache,
Parser _parser,
MemoryManager _data,
const Settings _option 
)
static

This static function searches for the named table in the cache map, evaluates the specified indices and deletes the corresponding contents from the table.

Parameters
sCacheconst string&
_parserParser&
_dataDatafile&
_optionconst Settings&
Returns
bool

Definition at line 483 of file dataops.cpp.

References Indices::col, NumeRe::TableMetaData::comment, MemoryManager::deleteBulk(), MemoryManager::getCols(), getIndices(), MemoryManager::getLines(), MemoryManager::getMetaData(), MemoryManager::getTableMap(), MemoryManager::isEmpty(), VectorIndex::isOpenEnd(), isValidIndexSet(), NumeRe::TableMetaData::modify(), Indices::row, MemoryManager::setMetaData(), VectorIndex::setRange(), and NumeRe::TableMetaData::source.

Referenced by deleteCacheEntry().

Here is the call graph for this function:

◆ show_data()

void show_data ( MemoryManager _data,
Output _out,
Settings _option,
const string &  _sCache,
size_t  nPrecision 
)

This function presents the passed data to the user in a visual way.

Parameters
_dataDatafile&
_outOutput&
_optionSettings&
_sCacheconst string&
nPrecisionsize_t
Returns
void

Definition at line 281 of file dataops.cpp.

References MemoryManager::extractTable(), Output::format(), NumeRe::FileAdapter::getDataFileName(), SyntaxError::invalid_position, MemoryManager::isValid(), make_hline(), make_stringmatrix(), SyntaxError::NO_CACHED_DATA, NumeReKernel::print(), Output::reset(), Output::setPluginName(), Output::setPrefix(), NumeReKernel::showTable(), NumeReKernel::toggleTableStatus(), toUpperCase(), and Settings::useExternalDocWindow().

Referenced by cmd_show().

Here is the call graph for this function:

◆ sortClusters()

static bool sortClusters ( CommandLineParser cmdParser,
const string &  sCluster,
Indices _idx 
)
static

This static function sorts clusters and is called by sortData, if the selected data object equals a cluster identifier.

Parameters
cmdParserCommandLineParser&
sClusterconst string&
_idxIndices&
Returns
bool

Definition at line 891 of file dataops.cpp.

References VectorIndex::back(), CommandLineParser::clearReturnValue(), VectorIndex::front(), NumeRe::ClusterManager::getCluster(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterList(), VectorIndex::isOpenEnd(), Indices::row, VectorIndex::setRange(), CommandLineParser::setReturnValue(), NumeRe::Cluster::size(), and NumeRe::Cluster::sortElements().

Referenced by sortData().

Here is the call graph for this function:

◆ sortData()

◆ sortStrings()

static bool sortStrings ( CommandLineParser cmdParser,
Indices _idx 
)
static

This static function sorts strings and is called by sortData, if the selected data object equals "string".

Parameters
cmdParserCommandLineParser&
_idxIndices&
Returns
bool

Definition at line 844 of file dataops.cpp.

References VectorIndex::back(), CommandLineParser::clearReturnValue(), Indices::col, VectorIndex::front(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterList(), StringMemory::getStringCols(), StringMemory::getStringElements(), VectorIndex::isOpenEnd(), Indices::row, VectorIndex::setRange(), CommandLineParser::setReturnValue(), and StringMemory::sortStringElements().

Referenced by sortData().

Here is the call graph for this function:

◆ writeToFile()

Variable Documentation

◆ _lang

Language _lang
extern

Definition at line 39 of file kernel.cpp.

Referenced by MemoryManager::addTable(), analyzePulse(), append_data(), applyFitAlgorithm(), autoSave(), boneDetection(), FlowCtrl::calc(), calculate1dFFT(), calculate2dFFT(), calculateChiMap(), calculateSplines(), clear_cache(), cmd_audio(), cmd_audioread(), cmd_clear(), cmd_copy(), cmd_credits(), cmd_datagrid(), cmd_define(), cmd_delete(), cmd_find(), cmd_ifndefined(), cmd_load(), cmd_move(), cmd_plotting(), cmd_redefine(), cmd_regularize(), cmd_remove(), cmd_rename(), cmd_resample(), cmd_retouch(), cmd_seek(), cmd_set(), cmd_smooth(), cmd_start(), cmd_stfa(), cmd_workpath(), FlowCtrl::compile(), confirmOperation(), createOutputForHist1D(), createOutputForHist2D(), createPlotForHist1D(), Plot::createPlotOrAnimation(), createPlotsForHist2D(), createStatsFile(), createStatsOutput(), Plot::createSubPlotSet(), createTeXExport(), differentiate(), Plot::displayMessage(), doc_Help(), doc_HelpAsHTML(), doc_SearchFct(), editObject(), FlowCtrl::eval(), FlowCtrl::evalForkFlowCommands(), FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), Script::evaluateInstallInformation(), ProcedureVarFactory::evaluateProcedureArguments(), executeCommand(), fastFourierTransform(), fastWaveletTransform(), NumeRe::DataBase::findRecordsUsingRelevance(), fitDataSet(), FlowCtrl::for_loop(), Output::format(), getDataForFit(), getErrorType(), getFitAnalysis(), getFitOptionsTable(), Documentation::getHelpArticle(), Script::getNextScriptCommandFromScript(), getPathForSetting(), NumeReDebugger::getStackTrace(), getStatFieldName(), Script::handleInstallInformation(), integrate(), integrate2d(), Language::Language(), listCommands(), listConstants(), listDeclaredVariables(), listDefinitions(), listDirectory(), listFiles(), listFunctions(), listInstalledPlugins(), listLogicalOperators(), listUnitConversions(), FunctionDefinitionManager::load(), load_data(), newObject(), Includer::openIncludedFile(), mu::ParserError::ParserError(), Plot::Plot(), plugin_random(), Output::print(), Output::print_legal(), FlowCtrl::range_based_for_loop(), Script::returnCommand(), rotateTable(), FunctionDefinitionManager::save(), Settings::save(), saveDataObject(), FlowCtrl::setCommand(), NumeReDebugger::showBreakPoint(), Odesolver::solve(), solveLGS(), solveLGSSymbolic(), strfnc_getkeyval(), strfnc_regex(), strfnc_weekday(), swapTables(), taylor(), NumeReDebugger::throwException(), toString(), undefineFunctions(), FlowCtrl::while_loop(), Script::writeProcedure(), and Procedure::writeProcedure().