9 #ifndef CSimpleDatabase_H 10 #define CSimpleDatabase_H 46 void addField(
const char* fieldName);
58 size_t fieldIndex(
const char* fieldName)
const;
108 std::vector<vector_string>
data;
189 typedef std::map<std::string, CSimpleDatabaseTable::Ptr>
TTableList;
std::map< std::string, CSimpleDatabaseTable::Ptr >::const_iterator const_iterator
size_t tablesCount() const
Returns the tables count in the DB.
std::string getFieldName(size_t fieldIndex) const
Get the name of a field by its index.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
void deleteRecord(size_t recordIndex)
Delete the record at the given index.
bool loadFromXML(const std::string &fileName)
Loads the content of this database from a a XML file.
virtual ~CSimpleDatabase()
Destructor.
size_t fieldsCount() const
Get the count of fields.
vector_string field_names
Field names.
CSimpleDatabase()
Default constructor.
size_t fieldIndex(const std::string &fieldName) const
Get the index for a given field name.
const Scalar * const_iterator
bool saveAsXML(const std::string &fileName) const
Saves this database as a XML file.
std::map< std::string, CSimpleDatabaseTable::Ptr > TTableList
The tables of the DB indexed by their names:
CSimpleDatabaseTable()
Default constructor.
std::map< std::string, CSimpleDatabaseTable::Ptr >::iterator iterator
void renameTable(const std::string &tableName, const std::string &newTableName)
Changes the name of a given table.
std::vector< std::string > vector_string
A type for passing a vector of strings.
void addField(const char *fieldName)
Add a new field to the table.
This class implements the tables of databases.
void dropTable(const std::string &tableName)
Deletes the given table.
std::string tablesName(size_t tableIndex) const
Returns the tables names in the DB.
std::shared_ptr< CSimpleDatabaseTable > Ptr
CSimpleDatabaseTable::Ptr getTable(const std::string &tableName)
Returns the table with the indicated name.
GLsizei const GLchar ** string
size_t getRecordCount() const
Get the records count in the table.
This class impements a very simple database system.
void addField(const std::string &fieldName)
Add a new field to the table.
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 is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
virtual ~CSimpleDatabaseTable()
Destructor.
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...
GLsizei const GLfloat * value
void clear()
Clears the DB.
CSimpleDatabaseTable::Ptr createTable(const std::string &name)
Creates a new table in the DB, initially empty.
std::vector< vector_string > data
Data for each cell.
size_t fieldIndex(const char *fieldName) const
Get the index for a given field name.