This class impements a very simple database system.
A database is a collection of tables, each one being a CSimpleDatabaseTable object. Tables are a rectangular arrrangement of cells, organized as records of fields. There are XML export/import methods in saveAsXML, loadFromXML.
#include <mrpt/utils/CSimpleDatabase.h>

Public Member Functions | |||
| CSimpleDatabase () | |||
| Default constructor. | |||
| virtual | ~CSimpleDatabase () | ||
| Destructor. | |||
| void | clear () | ||
| Clears the DB. | |||
| CSimpleDatabaseTablePtr | createTable (const std::string &name) | ||
| Creates a new table in the DB, initially empty. | |||
| CSimpleDatabaseTablePtr | getTable (const std::string &tableName) | ||
Returns the table with the indicated name
| |||
| void | dropTable (const std::string &tableName) | ||
| Deletes the given table. | |||
| void | renameTable (const std::string &tableName, const std::string &newTableName) | ||
Changes the name of a given table
| |||
| CSimpleDatabaseTablePtr | getTable (size_t tableIndex) | ||
| Returns the table by index. | |||
| size_t | tablesCount () const | ||
| Returns the tables count in the DB. | |||
| std::string | tablesName (size_t tableIndex) const | ||
| Returns the tables names in the DB. | |||
| bool | saveAsXML (const std::string &fileName) const | ||
| Saves this database as a XML file. | |||
| bool | loadFromXML (const std::string &fileName) | ||
| Loads the content of this database from a a XML file. | |||
| mrpt::utils::CObjectPtr | duplicateGetSmartPtr () const | ||
| Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). | |||
| CObject * | clone () const | ||
| Cloning interface for smart pointers. | |||
Static Public Attributes | |||
| static const mrpt::utils::TRuntimeClassId | classCObject | ||
Protected Member Functions | |||
| virtual void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const =0 | ||
| Introduces a pure virtual method responsible for writing to a CStream. | |||
| virtual void | readFromStream (mrpt::utils::CStream &in, int version)=0 | ||
| Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. | |||
Private Types | |||
| typedef std::map< std::string, CSimpleDatabaseTablePtr > | TTableList | ||
| The tables of the DB indexed by their names: | |||
| typedef std::map< std::string, CSimpleDatabaseTablePtr > ::iterator | iterator | ||
| typedef std::map< std::string, CSimpleDatabaseTablePtr > ::const_iterator | const_iterator | ||
Private Attributes | |||
| TTableList | m_tables | ||
RTTI stuff | |||
| static const mrpt::utils::TRuntimeClassId | classCSerializable | ||
| class | mrpt::utils::CStream | ||
RTTI stuff | |||
| typedef CSimpleDatabasePtr | SmartPtr | ||
| static mrpt::utils::CLASSINIT | _init_CSimpleDatabase | ||
| static mrpt::utils::TRuntimeClassId | classCSimpleDatabase | ||
| static const mrpt::utils::TRuntimeClassId * | classinfo | ||
| static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () | ||
| virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const | ||
| Returns information about the class of an object in runtime. | |||
| virtual mrpt::utils::CObject * | duplicate () const | ||
| Returns a copy of the object, indepently of its class. | |||
| static mrpt::utils::CObject * | CreateObject () | ||
| static CSimpleDatabasePtr | Create () | ||
typedef std::map<std::string, CSimpleDatabaseTablePtr>::const_iterator mrpt::utils::CSimpleDatabase::const_iterator [private] |
Definition at line 211 of file CSimpleDatabase.h.
typedef std::map<std::string, CSimpleDatabaseTablePtr>::iterator mrpt::utils::CSimpleDatabase::iterator [private] |
Definition at line 210 of file CSimpleDatabase.h.
A typedef for the associated smart pointer
Definition at line 143 of file CSimpleDatabase.h.
typedef std::map<std::string, CSimpleDatabaseTablePtr> mrpt::utils::CSimpleDatabase::TTableList [private] |
The tables of the DB indexed by their names:
Definition at line 209 of file CSimpleDatabase.h.
| mrpt::utils::CSimpleDatabase::CSimpleDatabase | ( | ) |
Default constructor.
| virtual mrpt::utils::CSimpleDatabase::~CSimpleDatabase | ( | ) | [virtual] |
Destructor.
| static const mrpt::utils::TRuntimeClassId* mrpt::utils::CSimpleDatabase::_GetBaseClass | ( | ) | [static, protected] |
Reimplemented from mrpt::utils::CSerializable.
| void mrpt::utils::CSimpleDatabase::clear | ( | ) |
Clears the DB.
| CObject* mrpt::utils::CObject::clone | ( | ) | const [inline, inherited] |
Cloning interface for smart pointers.
Reimplemented in mrpt::opengl::CRenderizable, and mrpt::opengl::CRenderizableDisplayList.
| static CSimpleDatabasePtr mrpt::utils::CSimpleDatabase::Create | ( | ) | [static] |
| static mrpt::utils::CObject* mrpt::utils::CSimpleDatabase::CreateObject | ( | ) | [static] |
| CSimpleDatabaseTablePtr mrpt::utils::CSimpleDatabase::createTable | ( | const std::string & | name | ) |
Creates a new table in the DB, initially empty.
| void mrpt::utils::CSimpleDatabase::dropTable | ( | const std::string & | tableName | ) |
Deletes the given table.
| std::exception | On table not found. |
| virtual mrpt::utils::CObject* mrpt::utils::CSimpleDatabase::duplicate | ( | ) | const [virtual] |
Returns a copy of the object, indepently of its class.
Implements mrpt::utils::CObject.
| mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr | ( | ) | const [inline, inherited] |
| virtual const mrpt::utils::TRuntimeClassId* mrpt::utils::CSimpleDatabase::GetRuntimeClass | ( | ) | const [virtual] |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
| CSimpleDatabaseTablePtr mrpt::utils::CSimpleDatabase::getTable | ( | const std::string & | tableName | ) |
Returns the table with the indicated name
| std::exception | On table not found. |
| CSimpleDatabaseTablePtr mrpt::utils::CSimpleDatabase::getTable | ( | size_t | tableIndex | ) |
Returns the table by index.
| std::exception | On index out of bounds |
| bool mrpt::utils::CSimpleDatabase::loadFromXML | ( | const std::string & | fileName | ) |
Loads the content of this database from a a XML file.
| virtual void mrpt::utils::CSerializable::readFromStream | ( | mrpt::utils::CStream & | in, |
| int | version | ||
| ) | [protected, pure virtual, inherited] |
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.
| in | The input binary stream where the object data must read from. |
| version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
| std::exception | On any error, see CStream::ReadBuffer |
Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.
| void mrpt::utils::CSimpleDatabase::renameTable | ( | const std::string & | tableName, |
| const std::string & | newTableName | ||
| ) |
Changes the name of a given table
| std::exception | On table not found or new name already existed. |
| bool mrpt::utils::CSimpleDatabase::saveAsXML | ( | const std::string & | fileName | ) | const |
Saves this database as a XML file.
| size_t mrpt::utils::CSimpleDatabase::tablesCount | ( | ) | const |
Returns the tables count in the DB.
| std::string mrpt::utils::CSimpleDatabase::tablesName | ( | size_t | tableIndex | ) | const |
Returns the tables names in the DB.
| std::exception | On index out of bounds |
| virtual void mrpt::utils::CSerializable::writeToStream | ( | mrpt::utils::CStream & | out, |
| int * | getVersion | ||
| ) | const [protected, pure virtual, inherited] |
Introduces a pure virtual method responsible for writing to a CStream.
This can not be used directly be users, instead use "stream << object;" for writing it to a stream.
| out | The output binary stream where object must be dumped. |
| getVersion | If NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data. |
| std::exception | On any error, see CStream::WriteBuffer |
Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.
friend class mrpt::utils::CStream [friend, inherited] |
Reimplemented in mrpt::slam::CRandomFieldGridMap2D, mrpt::slam::CPointsMap, mrpt::slam::CObservation, mrpt::slam::CMetricMap, mrpt::opengl::CRenderizable, mrpt::poses::CPose3DQuatPDF, mrpt::poses::CPointPDF, mrpt::poses::CPose3DPDF, mrpt::poses::CPosePDF, mrpt::poses::CPoint2DPDF, mrpt::opengl::CRenderizableDisplayList, mrpt::slam::CAction, mrpt::detectors::CDetectableObject, mrpt::opengl::CTexturedObject, and mrpt::reactivenav::CHolonomicLogFileRecord.
Definition at line 56 of file CSerializable.h.
mrpt::utils::CLASSINIT mrpt::utils::CSimpleDatabase::_init_CSimpleDatabase [static, protected] |
Definition at line 143 of file CSimpleDatabase.h.
const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject [static, inherited] |
const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable [static, inherited] |
Definition at line 56 of file CSerializable.h.
Definition at line 143 of file CSimpleDatabase.h.
const mrpt::utils::TRuntimeClassId* mrpt::utils::CSimpleDatabase::classinfo [static] |
Definition at line 143 of file CSimpleDatabase.h.
Definition at line 213 of file CSimpleDatabase.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |