26#include "../io/filesystem.hpp"
48 DataBase(
const std::string& sDataBaseFile);
50 DataBase(
const std::vector<std::string>& vDataColumn);
52 void addData(
const std::string& sDataBaseFile);
67 std::string
getElement(
size_t i,
size_t j)
const;
68 std::vector<std::string>
getColumn(
size_t j)
const;
69 std::vector<std::string>&
operator[](
size_t i);
73 size_t findRecord(
const std::string& _sRecord)
const;
74 std::map<size_t,std::vector<size_t>>
find(
const std::string& _sSearchString,
bool findOnlyFirst =
false)
const;
75 std::map<double,std::vector<size_t>>
findRecordsUsingRelevance(
const std::string& _sSearchString, std::vector<double> vWeighting = std::vector<double>())
const;
This class implements the basic input/ output file system and provides functionalities to work with f...
This class is an implementation of a database. It will handle the *.ndb data format an provides an in...
std::vector< std::string > getDBFileContent()
This member function reads the contents of a database file linewise to a vector.
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,...
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 ma...
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....
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,...
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 matr...
void readDataBase()
This function opens up a NumeRe Data base file and reads its contents to the internal vector<vector> ...
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 it...
std::vector< std::vector< std::string > > m_dataBase
size_t randomRecord() const
This member function can be used to select and random record.
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>....
std::string m_dataBaseFile
DataBase & operator=(const DataBase &data)
This is an overload of the assignment operator.
DataBase()
The default constructor will initialize the FileSystem base class using the information from the kern...
void addData(const std::string &sDataBaseFile)
This member function will use the passed database file name to update its internal contents (i....