Public Member Functions | Private Member Functions | Private Attributes | List of all members
ISM::TableHelper Class Reference

#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< sessionsqlite
 

Detailed Description

TableHelper class. Interface to training data and scene models (resp. votes) sqlite db.

Definition at line 46 of file TableHelper.hpp.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Returns
vector of db IDs mapped to ObjectPtr. (maybe change to set or map)

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.

Parameters
patternNameName of reference node of ism in the tree.
Returns
Id that associates reference name to object poses relative to this reference.

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.

Returns
Names of scenes and subscenes in the ism tree.

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.

Returns
Different types of objects encountered as scene elements (reference and non-reference nodes).

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.

Parameters
Nameof reference of ism in the tree for which objects are searched.
Returns
Objects in ism represented as combination of object type and identifier.

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.

Returns
Objects in ism tree represented as combination of object type and identifier (the latter differentiating instances of the same type).

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.

Parameters
patternNameName of scene represented as string.
Returns
Id that associates scene name to object sets resp. configurations.

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.

Returns
Scene names given to recordings stored here.

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.

Returns
Map where type is mapped to ressource path.

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.

Parameters
patternNameName of scene for which scene model shall be extracted.
objectsSet of scene elements for which a portion of the scene model is to be extracted.
Returns
ISM Votes sorted by scene element.

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.

int ISM::TableHelper::insertRecordedObjectIfNecessary ( ObjectPtr  object)
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

Parameters
dbIdID of the object in database
objectISM object to update the quaternion information from.
Returns
ID of the object in database.

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.

Member Data Documentation

boost::unordered_map<std::pair<std::string, std::string>, int> ISM::TableHelper::objectIdMap_
private

Definition at line 181 of file TableHelper.hpp.

boost::shared_ptr<session> ISM::TableHelper::sqlite
private

Definition at line 47 of file TableHelper.hpp.


The documentation for this class was generated from the following files:


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:41