MRPT logo

mrpt::utils::CSimpleDatabase Class Reference

This class impements a very simple database system. More...

#include <mrpt/utils/CSimpleDatabase.h>

Inheritance diagram for mrpt::utils::CSimpleDatabase:

mrpt::utils::CSerializable

List of all members.

Public Member Functions

 CSimpleDatabase ()
 Default constructor.
virtual ~CSimpleDatabase ()
 Destructor.
void clear ()
 Clears the DB.
CSimpleDatabaseTablecreateTable (const std::string &name)
 Creates a new table in the DB, initially empty.
CSimpleDatabaseTablegetTable (const char *tableName)
 Returns the table with the indicated name
Exceptions:
std::exception On table not found.

CSimpleDatabaseTablegetTable (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.

Private Attributes

std::vector
< CSimpleDatabaseTable * > 
tables
 The tables of the DB and their names:.
vector_string table_names


Detailed Description

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.

Todo:
Make this thread-safe.
See also:
CSimpleDatabaseTable

Definition at line 130 of file CSimpleDatabase.h.


Constructor & Destructor Documentation

mrpt::utils::CSimpleDatabase::CSimpleDatabase (  ) 

Default constructor.

virtual mrpt::utils::CSimpleDatabase::~CSimpleDatabase (  )  [virtual]

Destructor.


Member Function Documentation

void mrpt::utils::CSimpleDatabase::clear (  ) 

Clears the DB.

CSimpleDatabaseTable* mrpt::utils::CSimpleDatabase::createTable ( const std::string &  name  ) 

Creates a new table in the DB, initially empty.

CSimpleDatabaseTable* mrpt::utils::CSimpleDatabase::getTable ( size_t  tableIndex  ) 

Returns the table by index.

Exceptions:
std::exception On index out of bounds

CSimpleDatabaseTable* mrpt::utils::CSimpleDatabase::getTable ( const char *  tableName  ) 

Returns the table with the indicated name

Exceptions:
std::exception On table not found.

bool mrpt::utils::CSimpleDatabase::loadFromXML ( const std::string &  fileName  ) 

Loads the content of this database from a a XML file.

Returns:
false on any error, true if successful.
See also:
saveAsXML

bool mrpt::utils::CSimpleDatabase::saveAsXML ( const std::string &  fileName  )  const

Saves this database as a XML file.

Returns:
false on any error, true if successful.
See also:
loadFromXML

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.

Exceptions:
std::exception On index out of bounds


Member Data Documentation

Definition at line 188 of file CSimpleDatabase.h.

The tables of the DB and their names:.

Definition at line 187 of file CSimpleDatabase.h.




Page generated by Doxygen 1.5.9 for MRPT 0.6.5 SVN:exported at Thu May 21 04:14:55 UTC 2009