9 #ifndef CSimpleDatabase_H 10 #define CSimpleDatabase_H 36 CSimpleDatabaseTable( );
40 virtual ~CSimpleDatabaseTable();
44 size_t fieldsCount() const;
49 size_t appendRecord();
52 void addField(const
char *fieldName);
55 void addField(const
std::
string &fieldName) {
56 addField(fieldName.c_str());
62 std::string getFieldName(
size_t fieldIndex)
const;
67 size_t fieldIndex(
const char *fieldName)
const;
73 return fieldIndex(fieldName.c_str());
78 size_t getRecordCount()
const;
83 std::string
get(
size_t recordIndex, std::string field)
const;
88 std::string
get(
size_t recordIndex,
size_t fieldIndex)
const;
93 void set(
size_t recordIndex, std::string field, std::string value);
98 void set(
size_t recordIndex,
size_t fieldIndex, std::string value);
102 int query(std::string field, std::string value)
const;
105 void deleteRecord(
size_t recordIndex);
109 std::vector<vector_string>
data;
134 virtual ~CSimpleDatabase( );
142 CSimpleDatabaseTablePtr createTable(const
std::
string &name);
147 CSimpleDatabaseTablePtr getTable(const
std::
string &tableName);
152 void dropTable(const
std::
string &tableName);
158 const
std::
string &tableName,
159 const
std::
string &newTableName );
164 CSimpleDatabaseTablePtr getTable(
size_t tableIndex);
168 size_t tablesCount() const;
173 std::
string tablesName(
size_t tableIndex) const;
179 bool saveAsXML( const
std::
string &fileName ) const;
185 bool loadFromXML( const
std::
string &fileName );
The virtual base class which provides a unified interface for all persistent objects in MRPT...
vector_string field_names
Field names.
std::map< std::string, CSimpleDatabaseTablePtr >::const_iterator const_iterator
size_t fieldIndex(const std::string &fieldName) const
Get the index for a given field name On field not found.
std::vector< std::string > vector_string
A type for passing a vector of strings.
This class implements the tables of databases.
std::map< std::string, CSimpleDatabaseTablePtr >::iterator iterator
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
This class impements a very simple database system.
std::map< std::string, CSimpleDatabaseTablePtr > TTableList
The tables of the DB indexed by their names:
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...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
std::vector< vector_string > data
Data for each cell.