#include <TableHelper.hpp>
Public Member Functions | |
void | createColumnsIfNecessary () |
void | createTable (const std::string &tablename, const std::string &sql) const |
void | createTablesIfNecessary () const |
void | dropModelTables () const |
void | dropRecordTables () const |
void | dropTable (const std::string &tablename) const |
void | dropTables () const |
int | ensureModelObjectType (const std::string &objectType) const |
int | ensureModelPatternName (const std::string &patternName) const |
int | ensureRecordedPatternName (const std::string &patternName) const |
const std::vector< std::pair< int, ObjectPtr > > | getAllMarkerObjects () |
int | getLastInsertId (const std::string &tablename) const |
int | getModelObjectTypeId (const std::string &objectType) const |
int | getModelPatternId (const std::string &patternName) const |
std::vector< std::string > | getModelPatternNames () const |
const std::map< std::string, std::map< std::string, std::string > > | getModelWeightsPerTypeAndId () const |
const std::set< std::string > | getObjectsInPattern (std::string pattern_name) |
const std::set< std::string > | getObjectTypes () const |
const std::set< std::pair< std::string, std::string > > | getObjectTypesAndIdsBelongingToPattern (const std::string &patternName) const |
const std::set< std::pair< std::string, std::string > > | getObjectTypesAndIdsFromModelObjects () const |
const std::set< std::pair< std::string, std::string > > | getObjectTypesAndIdsFromRecordedObjects () const |
const PatternNameToPatternMap | getPatternDefinitionsByName (const std::set< std::string > &patternNames) const |
const ObjectSetPtr | getRecordedObjectSet (int setId) const |
const RecordedPatternPtr | getRecordedPattern (const std::string &patternName) const |
int | getRecordedPatternId (const std::string &patternName) const |
std::vector< std::string > | getRecordedPatternNames () const |
const std::map< std::string, boost::filesystem::path > | getRessourcePaths () const |
const std::vector< int > | getSetIds () const |
const ObjectTypeToVoteMap | getVoteSpecifiersForObjectTypes (const std::set< std::string > &objectTypes) const |
const ObjectToVoteMap | getVoteSpecifiersForPatternAndObjects (const std::string &patternName, std::set< std::pair< std::string, std::string > > objects) const |
int | insertModelObjectType (const std::string &objectType) const |
int | insertModelPattern (const std::string &patternName) const |
int | insertModelVoteSpecifier (const VoteSpecifierPtr &vote) const |
int | insertRecordedObject (const boost::shared_ptr< Object > &o, int setId) |
int | insertRecordedObjectSet (const boost::shared_ptr< ObjectSet > &os, const std::string &patternName) |
int | insertRecordedPattern (const std::string &patternName) const |
int | insertRecordedPattern (const RecordedPatternPtr &pattern) const |
bool | modelDataExists () const |
bool | recordDataExists () const |
TableHelper (std::string dbfilename="record.sqlite") | |
int | updateObjectQuaternion (int dbId, ObjectPtr object) |
int | upsertModelPattern (const std::string &patternName, int expectedMaxWeight) const |
~TableHelper () | |
Private Member Functions | |
int | insertRecordedObjectIfNecessary (ObjectPtr object) |
Private Attributes | |
boost::unordered_map< std::pair< std::string, std::string >, int > | objectIdMap_ |
boost::shared_ptr< session > | sqlite |
TableHelper class. Interface to training data and scene models (resp. votes) sqlite db.
Definition at line 46 of file TableHelper.hpp.
ISM::TableHelper::TableHelper | ( | std::string | dbfilename = "record.sqlite" | ) |
Definition at line 32 of file TableHelper.cpp.
ISM::TableHelper::~TableHelper | ( | ) |
Definition at line 39 of file TableHelper.cpp.
void ISM::TableHelper::createColumnsIfNecessary | ( | ) |
Definition at line 43 of file TableHelper.cpp.
void ISM::TableHelper::createTable | ( | const std::string & | tablename, |
const std::string & | sql | ||
) | const |
Definition at line 112 of file TableHelper.cpp.
void ISM::TableHelper::createTablesIfNecessary | ( | ) | const |
Definition at line 80 of file TableHelper.cpp.
void ISM::TableHelper::dropModelTables | ( | ) | const |
Definition at line 149 of file TableHelper.cpp.
void ISM::TableHelper::dropRecordTables | ( | ) | const |
Definition at line 130 of file TableHelper.cpp.
void ISM::TableHelper::dropTable | ( | const std::string & | tablename | ) | const |
Definition at line 121 of file TableHelper.cpp.
void ISM::TableHelper::dropTables | ( | ) | const |
Definition at line 138 of file TableHelper.cpp.
int ISM::TableHelper::ensureModelObjectType | ( | const std::string & | objectType | ) | const |
Definition at line 381 of file TableHelper.cpp.
int ISM::TableHelper::ensureModelPatternName | ( | const std::string & | patternName | ) | const |
Definition at line 376 of file TableHelper.cpp.
int ISM::TableHelper::ensureRecordedPatternName | ( | const std::string & | patternName | ) | const |
Definition at line 251 of file TableHelper.cpp.
const std::vector< std::pair< int, ObjectPtr > > ISM::TableHelper::getAllMarkerObjects | ( | ) |
Get all objects of "marker_*" type.
Definition at line 676 of file TableHelper.cpp.
int ISM::TableHelper::getLastInsertId | ( | const std::string & | tablename | ) | const |
Definition at line 171 of file TableHelper.cpp.
int ISM::TableHelper::getModelObjectTypeId | ( | const std::string & | objectType | ) | const |
Definition at line 422 of file TableHelper.cpp.
int ISM::TableHelper::getModelPatternId | ( | const std::string & | patternName | ) | const |
Get numeric id that relates (sub-)scene name to the ism (in the tree) it represents.
patternName | Name of reference node of ism in the tree. |
Definition at line 411 of file TableHelper.cpp.
std::vector< std::string > ISM::TableHelper::getModelPatternNames | ( | ) | const |
Extracts all string identifiers of the reference nodes in the ism trees learnt from training data in this db.
Definition at line 433 of file TableHelper.cpp.
const std::map< std::string, std::map< std::string, std::string > > ISM::TableHelper::getModelWeightsPerTypeAndId | ( | ) | const |
Definition at line 482 of file TableHelper.cpp.
const std::set< std::string > ISM::TableHelper::getObjectsInPattern | ( | std::string | pattern_name | ) |
Definition at line 70 of file TableHelper.cpp.
const std::set< std::string > ISM::TableHelper::getObjectTypes | ( | ) | const |
Get types of all objects in the ism trees learnt from training data in this db.
Definition at line 462 of file TableHelper.cpp.
const std::set< std::pair< std::string, std::string > > ISM::TableHelper::getObjectTypesAndIdsBelongingToPattern | ( | const std::string & | patternName | ) | const |
Get all reference and non-reference objects for given reference in ism tree.
Name | of reference of ism in the tree for which objects are searched. |
Definition at line 658 of file TableHelper.cpp.
const std::set< std::pair< std::string, std::string > > ISM::TableHelper::getObjectTypesAndIdsFromModelObjects | ( | ) | const |
Get all objects in the ism trees learnt from training data in this db.
Definition at line 499 of file TableHelper.cpp.
const std::set< std::pair< std::string, std::string > > ISM::TableHelper::getObjectTypesAndIdsFromRecordedObjects | ( | ) | const |
Definition at line 508 of file TableHelper.cpp.
const PatternNameToPatternMap ISM::TableHelper::getPatternDefinitionsByName | ( | const std::set< std::string > & | patternNames | ) | const |
Definition at line 443 of file TableHelper.cpp.
const ObjectSetPtr ISM::TableHelper::getRecordedObjectSet | ( | int | setId | ) | const |
Definition at line 302 of file TableHelper.cpp.
const RecordedPatternPtr ISM::TableHelper::getRecordedPattern | ( | const std::string & | patternName | ) | const |
Definition at line 276 of file TableHelper.cpp.
int ISM::TableHelper::getRecordedPatternId | ( | const std::string & | patternName | ) | const |
Get numeric id that relates training data with the scene it represents.
patternName | Name of scene represented as string. |
Definition at line 265 of file TableHelper.cpp.
std::vector< std::string > ISM::TableHelper::getRecordedPatternNames | ( | ) | const |
Extracts all names of scenes for which training data has been recorded and stored in the given db.
Definition at line 256 of file TableHelper.cpp.
const std::map< std::string, boost::filesystem::path > ISM::TableHelper::getRessourcePaths | ( | ) | const |
Get ressource paths of all objects in record.
Definition at line 471 of file TableHelper.cpp.
const std::vector< int > ISM::TableHelper::getSetIds | ( | ) | const |
Definition at line 292 of file TableHelper.cpp.
const ObjectTypeToVoteMap ISM::TableHelper::getVoteSpecifiersForObjectTypes | ( | const std::set< std::string > & | objectTypes | ) | const |
Definition at line 517 of file TableHelper.cpp.
const ObjectToVoteMap ISM::TableHelper::getVoteSpecifiersForPatternAndObjects | ( | const std::string & | patternName, |
std::set< std::pair< std::string, std::string > > | objects | ||
) | const |
Get ism votes i.e. the scene model for certain objects in a scene.
patternName | Name of scene for which scene model shall be extracted. |
objects | Set of scene elements for which a portion of the scene model is to be extracted. |
Definition at line 581 of file TableHelper.cpp.
int ISM::TableHelper::insertModelObjectType | ( | const std::string & | objectType | ) | const |
Definition at line 406 of file TableHelper.cpp.
int ISM::TableHelper::insertModelPattern | ( | const std::string & | patternName | ) | const |
Definition at line 386 of file TableHelper.cpp.
int ISM::TableHelper::insertModelVoteSpecifier | ( | const VoteSpecifierPtr & | vote | ) | const |
Definition at line 343 of file TableHelper.cpp.
int ISM::TableHelper::insertRecordedObject | ( | const boost::shared_ptr< Object > & | o, |
int | setId | ||
) |
Definition at line 213 of file TableHelper.cpp.
|
private |
Definition at line 186 of file TableHelper.cpp.
int ISM::TableHelper::insertRecordedObjectSet | ( | const boost::shared_ptr< ObjectSet > & | os, |
const std::string & | patternName | ||
) |
Definition at line 229 of file TableHelper.cpp.
int ISM::TableHelper::insertRecordedPattern | ( | const std::string & | patternName | ) | const |
Definition at line 246 of file TableHelper.cpp.
int ISM::TableHelper::insertRecordedPattern | ( | const RecordedPatternPtr & | pattern | ) | const |
bool ISM::TableHelper::modelDataExists | ( | ) | const |
Definition at line 163 of file TableHelper.cpp.
bool ISM::TableHelper::recordDataExists | ( | ) | const |
Definition at line 155 of file TableHelper.cpp.
int ISM::TableHelper::updateObjectQuaternion | ( | int | dbId, |
ObjectPtr | object | ||
) |
Update the quaternion of the object with dbId
dbId | ID of the object in database |
object | ISM object to update the quaternion information from. |
Definition at line 708 of file TableHelper.cpp.
int ISM::TableHelper::upsertModelPattern | ( | const std::string & | patternName, |
int | expectedMaxWeight | ||
) | const |
Definition at line 391 of file TableHelper.cpp.
|
private |
Definition at line 181 of file TableHelper.hpp.
|
private |
Definition at line 47 of file TableHelper.hpp.