Go to the documentation of this file.
44 void addField(
const char* fieldName);
56 size_t fieldIndex(
const char* fieldName)
const;
106 std::vector<std::vector<std::string>>
data;
187 using TTableList = std::map<std::string, CSimpleDatabaseTable::Ptr>;
std::map< std::string, CSimpleDatabaseTable::Ptr >::const_iterator const_iterator
size_t fieldIndex(const std::string &fieldName) const
Get the index for a given field name.
std::string getFieldName(size_t fieldIndex) const
Get the name of a field by its index.
const Scalar * const_iterator
void addField(const std::string &fieldName)
Add a new field to the table.
size_t fieldsCount() const
Get the count of fields.
CSimpleDatabaseTable::Ptr getTable(const std::string &tableName)
Returns the table with the indicated name.
void addField(const char *fieldName)
Add a new field to the table.
std::vector< std::string > field_names
Field names.
virtual ~CSimpleDatabase()
Destructor.
void deleteRecord(size_t recordIndex)
Delete the record at the given index.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::map< std::string, CSimpleDatabaseTable::Ptr > TTableList
The tables of the DB indexed by their names:
bool saveAsXML(const std::string &fileName) const
Saves this database as a XML file.
std::vector< std::vector< std::string > > data
Data for each cell.
std::string tablesName(size_t tableIndex) const
Returns the tables names in the DB.
GLuint const GLchar * name
int query(std::string field, std::string value) const
Executes a query in the table, returning the record index which a given field has a given value,...
size_t appendRecord()
Append a new and empty record at the end of the table, and return the index of the newly added record...
This class implements the tables of databases.
CSimpleDatabaseTable()
Default constructor.
size_t getRecordCount() const
Get the records count in the table.
std::shared_ptr< CSimpleDatabaseTable > Ptr
void set(size_t recordIndex, std::string field, std::string value)
Sets the cell content of the record indicates by its index, and the field indicated in "field".
virtual ~CSimpleDatabaseTable()
Destructor.
The virtual base class which provides a unified interface for all persistent objects in MRPT.
size_t tablesCount() const
Returns the tables count in the DB.
bool loadFromXML(const std::string &fileName)
Loads the content of this database from a a XML file.
void renameTable(const std::string &tableName, const std::string &newTableName)
Changes the name of a given table.
void dropTable(const std::string &tableName)
Deletes the given table.
std::map< std::string, CSimpleDatabaseTable::Ptr >::iterator iterator
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
GLsizei const GLfloat * value
std::string get(size_t recordIndex, std::string field) const
Returns the cell content of the record indicates by its index, and the field indicated in "field".
CSimpleDatabase()
Default constructor.
This class impements a very simple database system.
GLsizei const GLchar ** string
size_t fieldIndex(const char *fieldName) const
Get the index for a given field name.
void clear()
Clears the DB.
CSimpleDatabaseTable::Ptr createTable(const std::string &name)
Creates a new table in the DB, initially empty.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |