This class implements the tables of databases.
Definition at line 29 of file CSimpleDatabase.h.
#include <mrpt/utils/CSimpleDatabase.h>
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) throw () |
void | operator delete[] (void *ptr) throw () |
void | operator delete (void *memory, void *ptr) throw () |
void * | operator new (size_t size, const std::nothrow_t &) throw () |
void | operator delete (void *ptr, const std::nothrow_t &) throw () |
CSimpleDatabaseTable () | |
Default constructor. More... | |
virtual | ~CSimpleDatabaseTable () |
Destructor. More... | |
size_t | fieldsCount () const |
Get the count of fields. More... | |
size_t | appendRecord () |
Append a new and empty record at the end of the table, and return the index of the newly added record. More... | |
void | addField (const char *fieldName) |
Add a new field to the table. More... | |
void | addField (const std::string &fieldName) |
Add a new field to the table. More... | |
std::string | getFieldName (size_t fieldIndex) const |
Get the name of a field by its index. More... | |
size_t | fieldIndex (const char *fieldName) const |
Get the index for a given field name. More... | |
size_t | fieldIndex (const std::string &fieldName) const |
Get the index for a given field name. More... | |
size_t | getRecordCount () const |
Get the records count in the table. More... | |
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". More... | |
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. More... | |
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". More... | |
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. More... | |
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. More... | |
void | deleteRecord (size_t recordIndex) |
Delete the record at the given index. More... | |
virtual mxArray * | writeToMatlab () const |
Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More... | |
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). More... | |
CObject * | clone () const |
Cloning interface for smart pointers. More... | |
Static Public Member Functions | |
static void * | operator new (size_t size, void *ptr) |
Static Public Attributes | |
static const mrpt::utils::TRuntimeClassId | classCObject |
Protected Member Functions | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const MRPT_OVERRIDE |
Introduces a pure virtual method responsible for writing to a CStream. More... | |
void | readFromStream (mrpt::utils::CStream &in, int version) MRPT_OVERRIDE |
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. More... | |
Private Attributes | |
vector_string | field_names |
Field names. More... | |
std::vector< vector_string > | data |
Data for each cell. More... | |
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. More... | |
virtual mrpt::utils::CObject * | duplicate () const MRPT_OVERRIDE |
Returns a copy of the object, indepently of its class. More... | |
static mrpt::utils::CObject * | CreateObject () |
static CSimpleDatabaseTablePtr | Create () |
typedef CSimpleDatabaseTablePtr mrpt::utils::CSimpleDatabaseTable::SmartPtr |
A typedef for the associated smart pointer
Definition at line 32 of file CSimpleDatabase.h.
mrpt::utils::CSimpleDatabaseTable::CSimpleDatabaseTable | ( | ) |
Default constructor.
|
virtual |
Destructor.
|
staticprotected |
void mrpt::utils::CSimpleDatabaseTable::addField | ( | const char * | fieldName | ) |
Add a new field to the table.
The table is cleared in this operation.
|
inline |
Add a new field to the table.
The table is cleared in this operation.
Definition at line 55 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.
|
inlineinherited |
|
static |
|
static |
void mrpt::utils::CSimpleDatabaseTable::deleteRecord | ( | size_t | recordIndex | ) |
Delete the record at the given index.
|
virtual |
Returns a copy of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
inlineinherited |
size_t mrpt::utils::CSimpleDatabaseTable::fieldIndex | ( | const char * | fieldName | ) | const |
Get the index for a given field name.
std::exception | On field not found |
|
inline |
Get the index for a given field name.
std::exception | On field not found |
Definition at line 72 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, |
size_t | fieldIndex | ||
) | const |
Returns the cell content of the record indicates by its index, and the field indicated by its index.
std::exception | On field or record not found |
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".
std::exception | On field or record not found |
std::string mrpt::utils::CSimpleDatabaseTable::getFieldName | ( | size_t | fieldIndex | ) | const |
Get the name of a field by its index.
std::exception | On index out of bounds |
size_t mrpt::utils::CSimpleDatabaseTable::getRecordCount | ( | ) | const |
Get the records count in the table.
|
virtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
|
inlinestatic |
Definition at line 32 of file CSimpleDatabase.h.
|
inline |
Definition at line 32 of file CSimpleDatabase.h.
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.
|
protectedvirtual |
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 |
Implements mrpt::utils::CSerializable.
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.
std::exception | On field or record not found |
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".
std::exception | On field or record not found |
|
inlinevirtualinherited |
Introduces a pure virtual method responsible for writing to a mxArray
Matlab object, typically a MATLAB struct
whose contents are documented in each derived class.
mxArray
(caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB. Definition at line 79 of file CSerializable.h.
|
protectedvirtual |
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 |
Implements mrpt::utils::CSerializable.
|
staticprotected |
Definition at line 32 of file CSimpleDatabase.h.
|
staticinherited |
|
staticinherited |
Definition at line 42 of file CSerializable.h.
|
static |
Definition at line 32 of file CSimpleDatabase.h.
|
static |
Definition at line 32 of file CSimpleDatabase.h.
|
private |
Data for each cell.
Definition at line 109 of file CSimpleDatabase.h.
|
private |
Field names.
Definition at line 108 of file CSimpleDatabase.h.
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Tue Mar 3 09:15:16 UTC 2020 |