| 
    NumeRe v1.1.4
    
   NumeRe: Framework für Numerische Rechnungen 
   | 
 
This class is an implementation of a database. It will handle the *.ndb data format an provides an interface to its contained data. More...
#include <database.hpp>
Public Member Functions | |
| DataBase () | |
| The default constructor will initialize the FileSystem base class using the information from the kernel.  More... | |
| DataBase (const std::string &sDataBaseFile) | |
| This constructor will open the passed database file and read its contents to memory.  More... | |
| DataBase (const DataBase &data) | |
| This is the copy constructor.  More... | |
| DataBase (const std::vector< std::string > &vDataColumn) | |
| This constructor instantiates this class using a vector<string> as the first column.  More... | |
| void | addData (const std::string &sDataBaseFile) | 
| This member function will use the passed database file name to update its internal contents (i.e. if a new version of data is available). This function can also be used to read a database, if the internal database is still empty.  More... | |
| size_t | size () const | 
| size_t | getCols () const | 
| std::string | getElement (size_t i, size_t j) const | 
| This member function will return the contents of the selected database field, or an empty string, if the field does not exist.  More... | |
| std::vector< std::string > | getColumn (size_t j) const | 
| This member function will return the whole selected column of the database as a vector<string>. Some elements in the returned vector might be empty strings, which indicates that the read field did not exist.  More... | |
| std::vector< std::string > & | operator[] (size_t i) | 
| This is an overload of the array access operator, which can be used with read and write permissions. Use DataBase::getElement() in const cases.  More... | |
| DataBase & | operator= (const DataBase &data) | 
| This is an overload of the assignment operator.  More... | |
| size_t | randomRecord () const | 
| This member function can be used to select and random record.  More... | |
| size_t | findRecord (const std::string &_sRecord) const | 
| This member function finds a selected record in the first column of the database table and returns its ID.  More... | |
| std::map< size_t, std::vector< size_t > > | find (const std::string &_sSearchString, bool findOnlyFirst=false) const | 
| This member function can be used to search a string in the managed database. The return value is a map with the record id as key and a list of (field-based) occurences as a vector. If only the first occurence in each record is searched, set the boolean flag to true.  More... | |
| std::map< double, std::vector< size_t > > | findRecordsUsingRelevance (const std::string &_sSearchString, std::vector< double > vWeighting=std::vector< double >()) const | 
| This member function will search multiple search strings in the database and returns a map, where the key is a percentage value for the relevance of the corresponding records and a list of records as value. The weighting of each column can be passed as vector. Otherwise all columns are weighted identical.  More... | |
  Public Member Functions inherited from FileSystem | |
| FileSystem () | |
| Default constructor.  More... | |
| FileSystem & | assign (const FileSystem &_fSys) | 
| Assignment member function to copy the settings from another FileSystem instance.  More... | |
| std::string | ValidFileName (std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const | 
| This member function evaluates, whether the passed filename is a valid filename. One may supply a preferred filename extension.  More... | |
| std::string | ValidFolderName (std::string _sFileName, bool doCleanPath=true, bool appendTrailingSeparator=true) const | 
| This member function evaluates, whether the passed foldername is a valid foldername.  More... | |
| std::string | ValidizeAndPrepareName (const std::string &_sFileName, const std::string &sExtension=".dat") const | 
| This member function validizes the passed file name and creates the needed folders on-the-fly.  More... | |
| int | setPath (std::string _sPath, bool bMkDir, std::string _sExePath) | 
| This member function may be used to set the preferred file path of the current FileSystem instance.  More... | |
| void | createRevisionsFolder () | 
| This member function creates the hidden revisions folders for the version control system.  More... | |
| std::string | getPath () const | 
| Returns the default path of this FileSystem instance.  More... | |
| std::vector< std::string > | getFileParts (const std::string &sFilePath) const | 
| This member function separates all path parts into single strings: the drive letter, the path, the name and the extension. This function may also handle folder paths and network paths.  More... | |
| FileInfo | getFileInfo (const std::string &sFilePath) const | 
| Return the file information about the passed file path.  More... | |
| void | setTokens (std::string _sTokens) | 
| This member function may be used to update the path placeholders of the current FileSystem instance.  More... | |
| bool | isFile (const std::string &_sPath) const | 
| This function determines, whether a path name indicates a file or a folder.  More... | |
| void | initializeFromKernel () | 
| Member function to remote-initialize the class from the kernel. Cannot be used during kernel start-up.  More... | |
| void | setProgramPath (std::string _sExePath) | 
| std::string | getProgramPath () const | 
| void | declareFileType (const std::string &sFileType) | 
Private Member Functions | |
| std::vector< std::string > | getDBFileContent () | 
| This member function reads the contents of a database file linewise to a vector.  More... | |
| void | readDataBase () | 
| This function opens up a NumeRe Data base file and reads its contents to the internal vector<vector> matrix. Each field of the matrix contains a field of the database.  More... | |
| size_t | findOrCreateRecord (const std::string &sRecord) | 
| This member function will return the id of the searched record (value in the first column of the matrix) or create a new record, if the searched one may not be found.  More... | |
Private Attributes | |
| std::vector< std::vector< std::string > > | m_dataBase | 
| std::string | m_dataBaseFile | 
Additional Inherited Members | |
  Protected Member Functions inherited from FileSystem | |
| int | createFolders (const std::string &_sPath) const | 
| This member function creates all missing directories in the passed path.  More... | |
  Protected Attributes inherited from FileSystem | |
| std::string | sPath | 
| std::string | sExecutablePath | 
| std::string | sTokens [7][2] | 
| std::string | sValidExtensions | 
This class is an implementation of a database. It will handle the *.ndb data format an provides an interface to its contained data.
Definition at line 36 of file database.hpp.
| NumeRe::DataBase::DataBase | ( | ) | 
The default constructor will initialize the FileSystem base class using the information from the kernel.
Definition at line 148 of file database.cpp.
References FileSystem::initializeFromKernel().
| NumeRe::DataBase::DataBase | ( | const std::string & | sDataBaseFile | ) | 
This constructor will open the passed database file and read its contents to memory.
| sDataBaseFile | const string& | 
Definition at line 162 of file database.cpp.
References m_dataBaseFile, and readDataBase().
| NumeRe::DataBase::DataBase | ( | const DataBase & | data | ) | 
This is the copy constructor.
| data | const DataBase& | 
Definition at line 175 of file database.cpp.
References m_dataBase, and m_dataBaseFile.
| NumeRe::DataBase::DataBase | ( | const std::vector< std::string > & | vDataColumn | ) | 
This constructor instantiates this class using a vector<string> as the first column.
| vDataColumn | const vector<string>& | 
Definition at line 190 of file database.cpp.
References m_dataBase, and m_dataBaseFile.
| void NumeRe::DataBase::addData | ( | const std::string & | sDataBaseFile | ) | 
This member function will use the passed database file name to update its internal contents (i.e. if a new version of data is available). This function can also be used to read a database, if the internal database is still empty.
| sDataBaseFile | const string& | 
Definition at line 212 of file database.cpp.
References findOrCreateRecord(), m_dataBase, m_dataBaseFile, readDataBase(), and size().
Referenced by doc_SearchFct(), NumeReKernel::getGreeting(), NumeReWindow::NumeReWindow(), and NumeReWindow::UpdateToolbar().
| map< size_t, vector< size_t > > NumeRe::DataBase::find | ( | const std::string & | _sSearchString, | 
| bool | findOnlyFirst = false  | 
        ||
| ) | const | 
This member function can be used to search a string in the managed database. The return value is a map with the record id as key and a list of (field-based) occurences as a vector. If only the first occurence in each record is searched, set the boolean flag to true.
| _sSearchString | const string& | 
| findOnlyFirst | bool | 
Definition at line 368 of file database.cpp.
References find(), m_dataBase, and toLowerCase().
Referenced by find(), findRecordsUsingRelevance(), and readDataBase().
      
  | 
  private | 
This member function will return the id of the searched record (value in the first column of the matrix) or create a new record, if the searched one may not be found.
| sRecord | const string& | 
Definition at line 123 of file database.cpp.
References m_dataBase.
Referenced by addData().
| size_t NumeRe::DataBase::findRecord | ( | const std::string & | _sRecord | ) | const | 
This member function finds a selected record in the first column of the database table and returns its ID.
| _sRecord | const string& | 
Definition at line 341 of file database.cpp.
References m_dataBase.
Referenced by ToolBarSearchCtrl::getDragDropText(), and ToolBarSearchCtrl::selectItem().
| map< double, vector< size_t > > NumeRe::DataBase::findRecordsUsingRelevance | ( | const std::string & | _sSearchString, | 
| std::vector< double > | vWeighting = std::vector<double>()  | 
        ||
| ) | const | 
This member function will search multiple search strings in the database and returns a map, where the key is a percentage value for the relevance of the corresponding records and a list of records as value. The weighting of each column can be passed as vector. Otherwise all columns are weighted identical.
| _sSearchString | const string& | 
| vWeighting | vector<double> | 
Definition at line 413 of file database.cpp.
References _lang, find(), Language::get(), and getCols().
Referenced by doc_SearchFct(), and ToolBarSearchCtrl::getCandidates().
      
  | 
  inline | 
Definition at line 59 of file database.hpp.
References m_dataBase.
Referenced by findRecordsUsingRelevance().
| vector< string > NumeRe::DataBase::getColumn | ( | size_t | j | ) | const | 
This member function will return the whole selected column of the database as a vector<string>. Some elements in the returned vector might be empty strings, which indicates that the read field did not exist.
| j | size_t | 
Definition at line 265 of file database.cpp.
References getElement(), and m_dataBase.
Referenced by NumeReWindow::NumeReWindow().
      
  | 
  private | 
This member function reads the contents of a database file linewise to a vector.
Definition at line 38 of file database.cpp.
References m_dataBaseFile, StripSpaces(), and FileSystem::ValidFileName().
Referenced by readDataBase().
| string NumeRe::DataBase::getElement | ( | size_t | i, | 
| size_t | j | ||
| ) | const | 
This member function will return the contents of the selected database field, or an empty string, if the field does not exist.
| i | size_t | 
| j | size_t | 
Definition at line 245 of file database.cpp.
References m_dataBase.
Referenced by doc_SearchFct(), ToolBarSearchCtrl::getCandidates(), getColumn(), ToolBarSearchCtrl::getDragDropText(), NumeReKernel::getGreeting(), and ToolBarSearchCtrl::selectItem().
This is an overload of the assignment operator.
| data | const DataBase& | 
Definition at line 305 of file database.cpp.
References m_dataBase, and m_dataBaseFile.
| vector< string > & NumeRe::DataBase::operator[] | ( | size_t | i | ) | 
This is an overload of the array access operator, which can be used with read and write permissions. Use DataBase::getElement() in const cases.
| i | size_t | 
Definition at line 288 of file database.cpp.
References SyntaxError::invalid_position, m_dataBase, m_dataBaseFile, and SyntaxError::TOO_FEW_LINES.
| size_t NumeRe::DataBase::randomRecord | ( | ) | const | 
This member function can be used to select and random record.
Definition at line 320 of file database.cpp.
References m_dataBase.
Referenced by NumeReKernel::getGreeting().
      
  | 
  private | 
This function opens up a NumeRe Data base file and reads its contents to the internal vector<vector> matrix. Each field of the matrix contains a field of the database.
Definition at line 80 of file database.cpp.
References find(), getDBFileContent(), m_dataBase, and size().
Referenced by addData(), and DataBase().
      
  | 
  inline | 
Definition at line 54 of file database.hpp.
References m_dataBase.
Referenced by addData(), doc_ReplaceExprContentForHTML(), doc_SearchFct(), NumeReKernel::getGreeting(), and readDataBase().
      
  | 
  private | 
Definition at line 39 of file database.hpp.
Referenced by addData(), DataBase(), find(), findOrCreateRecord(), findRecord(), getCols(), getColumn(), getElement(), operator=(), operator[](), randomRecord(), readDataBase(), and size().
      
  | 
  private | 
Definition at line 40 of file database.hpp.
Referenced by addData(), DataBase(), getDBFileContent(), operator=(), and operator[]().