Go to the documentation of this file.
33 table->addField(
"name");
34 table->addField(
"value");
36 i =
table->appendRecord();
37 table->set(i,
"name",
"cell_11");
38 table->set(i,
"value",
"cell_12");
40 i =
table->appendRecord();
41 table->set(i,
"name",
"cell_21");
42 table->set(i,
"value",
"cell_22");
44 i =
table->appendRecord();
45 table->set(i,
"name",
"another cell");
48 "And this is an\n example of a multi-line \n \t\t and formated "
62 double t_bin = tictac.
Tac();
65 "Read test: %u tables in DB. table[0]=%s, records=%u\n",
67 (
unsigned int)db2.
getTable(
"table1")->getRecordCount());
69 int query = db2.
getTable(
"table1")->query(
"name",
"cell_11");
70 printf(
"query=%i,", query);
71 printf(
" '%s'\n", db2.
getTable(
"table1")->get(query,
"value").c_str());
78 double t_xml = tictac.
Tac();
81 printf(
"Binary write+read: %f ms\n", t_bin * 1e3);
82 printf(
"XML write+read: %f ms\n", t_xml * 1e3);
96 catch (std::exception& e)
98 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
103 printf(
"Untyped exception!!");
This CStream derived class allow using a file as a read/write binary stream, creating it if the file ...
CSimpleDatabaseTable::Ptr getTable(const std::string &tableName)
Returns the table with the indicated name.
A high-performance stopwatch, with typical resolution of nanoseconds.
bool saveAsXML(const std::string &fileName) const
Saves this database as a XML file.
std::string tablesName(size_t tableIndex) const
Returns the tables names in the DB.
double Tac() noexcept
Stops the stopwatch.
std::shared_ptr< CSimpleDatabaseTable > Ptr
void Tic() noexcept
Starts the stopwatch.
size_t tablesCount() const
Returns the tables count in the DB.
bool loadFromXML(const std::string &fileName)
Loads the content of this database from a a XML file.
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream,...
GLenum GLsizei GLenum GLenum const GLvoid * table
This class impements a very simple database system.
CSimpleDatabaseTable::Ptr createTable(const std::string &name)
Creates a new table in the DB, initially empty.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |