Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
mrpt::utils::CSimpleDatabaseTable Class Reference

Detailed Description

This class implements the tables of databases.

See also:
CSimpleDatabase

#include <mrpt/utils/CSimpleDatabase.h>

Inheritance diagram for mrpt::utils::CSimpleDatabaseTable:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CSimpleDatabaseTable ()
 Default constructor.
virtual ~CSimpleDatabaseTable ()
 Destructor.
size_t fieldsCount () const
 Get the count of fields.
size_t appendRecord ()
 Append a new and empty record at the end of the table, and return the index of the newly added record.
void addField (const char *fieldName)
 Add a new field to the table.
void addField (const std::string &fieldName)
 Add a new field to the table.
std::string getFieldName (size_t fieldIndex) const
 Get the name of a field by its index

Exceptions:
std::exceptionOn index out of bounds.

size_t fieldIndex (const char *fieldName) const
 Get the index for a given field name

Exceptions:
std::exceptionOn field not found.

size_t fieldIndex (const std::string &fieldName) const
 Get the index for a given field name

Exceptions:
std::exceptionOn field not found.

size_t getRecordCount () const
 Get the records count in the table.
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".
std::string get (size_t recordIndex, size_t fieldIndex) const
 Returns the cell content of the record indicates by its index, and the field indicated by its index.
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".
void set (size_t recordIndex, size_t fieldIndex, std::string value)
 Sets the cell content of the record indicates by its index, and the field indicated by its index.
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, case insensitive, or -1 if not found.
void deleteRecord (size_t recordIndex)
 Delete the record at the given index.
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).
CObjectclone () 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 Attributes

vector_string field_names
 Field names.
std::vector< vector_stringdata
 Data for each cell.

RTTI stuff

static const
mrpt::utils::TRuntimeClassId 
classCSerializable
class mrpt::utils::CStream

RTTI stuff

typedef CSimpleDatabaseTablePtr SmartPtr
static mrpt::utils::CLASSINIT _init_CSimpleDatabaseTable
static mrpt::utils::TRuntimeClassId classCSimpleDatabaseTable
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::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CSimpleDatabaseTablePtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 50 of file CSimpleDatabase.h.


Constructor & Destructor Documentation

mrpt::utils::CSimpleDatabaseTable::CSimpleDatabaseTable ( )

Default constructor.

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

Destructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::utils::CSimpleDatabaseTable::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::utils::CSerializable.

void mrpt::utils::CSimpleDatabaseTable::addField ( const char *  fieldName)

Add a new field to the table.

The table is cleared in this operation.

void mrpt::utils::CSimpleDatabaseTable::addField ( const std::string fieldName) [inline]

Add a new field to the table.

The table is cleared in this operation.

Definition at line 73 of file CSimpleDatabase.h.

size_t mrpt::utils::CSimpleDatabaseTable::appendRecord ( )

Append a new and empty record at the end of the table, and return the index of the newly added record.

See also:
deleteRecord
CObject* mrpt::utils::CObject::clone ( ) const [inline, inherited]

Cloning interface for smart pointers.

Reimplemented in mrpt::opengl::CRenderizable, and mrpt::opengl::CRenderizableDisplayList.

Definition at line 154 of file CObject.h.

static CSimpleDatabaseTablePtr mrpt::utils::CSimpleDatabaseTable::Create ( ) [static]
static mrpt::utils::CObject* mrpt::utils::CSimpleDatabaseTable::CreateObject ( ) [static]
void mrpt::utils::CSimpleDatabaseTable::deleteRecord ( size_t  recordIndex)

Delete the record at the given index.

See also:
appendRecord
virtual mrpt::utils::CObject* mrpt::utils::CSimpleDatabaseTable::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]

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).

Definition at line 151 of file CObject.h.

size_t mrpt::utils::CSimpleDatabaseTable::fieldIndex ( const char *  fieldName) const

Get the index for a given field name

Exceptions:
std::exceptionOn field not found.

size_t mrpt::utils::CSimpleDatabaseTable::fieldIndex ( const std::string fieldName) const [inline]

Get the index for a given field name

Exceptions:
std::exceptionOn field not found.

Definition at line 90 of file CSimpleDatabase.h.

size_t mrpt::utils::CSimpleDatabaseTable::fieldsCount ( ) const

Get the count of fields.

std::string mrpt::utils::CSimpleDatabaseTable::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".

Exceptions:
std::exceptionOn field or record not found
std::string mrpt::utils::CSimpleDatabaseTable::get ( size_t  recordIndex,
size_t  fieldIndex 
) const

Returns the cell content of the record indicates by its index, and the field indicated by its index.

Exceptions:
std::exceptionOn field or record not found
std::string mrpt::utils::CSimpleDatabaseTable::getFieldName ( size_t  fieldIndex) const

Get the name of a field by its index

Exceptions:
std::exceptionOn index out of bounds.

size_t mrpt::utils::CSimpleDatabaseTable::getRecordCount ( ) const

Get the records count in the table.

virtual const mrpt::utils::TRuntimeClassId* mrpt::utils::CSimpleDatabaseTable::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

int mrpt::utils::CSimpleDatabaseTable::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, case insensitive, or -1 if not found.

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.

Parameters:
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions:
std::exceptionOn any error, see CStream::ReadBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.

void mrpt::utils::CSimpleDatabaseTable::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".

Exceptions:
std::exceptionOn field or record not found
void mrpt::utils::CSimpleDatabaseTable::set ( size_t  recordIndex,
size_t  fieldIndex,
std::string  value 
)

Sets the cell content of the record indicates by its index, and the field indicated by its index.

Exceptions:
std::exceptionOn field or record not found
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.

Parameters:
outThe output binary stream where object must be dumped.
getVersionIf 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.
Exceptions:
std::exceptionOn any error, see CStream::WriteBuffer
See also:
CStream

Implemented in mrpt::math::CMatrixD, and mrpt::math::CMatrix.


Friends And Related Function Documentation

friend class mrpt::utils::CStream [friend, inherited]

Member Data Documentation

Definition at line 50 of file CSimpleDatabase.h.

Definition at line 139 of file CObject.h.

Definition at line 56 of file CSerializable.h.

Definition at line 50 of file CSimpleDatabase.h.

Definition at line 50 of file CSimpleDatabase.h.

Data for each cell.

Definition at line 127 of file CSimpleDatabase.h.

Field names.

Definition at line 126 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