db_planner::SqlDatabaseManager Class Reference

SqlDatabaseManager implements DatabaseManager for using the Postgresql version of the CGDB. More...

#include <sql_database_manager.h>

Inheritance diagram for db_planner::SqlDatabaseManager:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool AcquireNextTask (TaskRecord *)
 Acquires the next experiment to be executed from the list of tasks in the database.
virtual bool AlignmentMethodList (vector< string > *alignment_method_list) const
 Returns a vector of strings representing the available precomputed alignment methods.
virtual bool DeleteGrasp (Grasp *) const
 Delete a grasp from the database.
virtual bool DistanceFunctionList (vector< string > *distance_function_list) const
 Returns a vector of strings representing the available neighbor distance functions.
virtual bool GetAlignment (const Model &source, const Model &dest, const string &alignment_method_name, float alignment[16]) const
 Get the 4x4 alignment for 2 Models that are both in the database.
virtual bool GetGrasps (const Model &model, const string &hand_name, vector< Grasp * > *grasp_list) const
 Get a list of the Grasps for a Model.
virtual bool GetNeighbors (const Model &model, const string &distance_function_name, const int num_neighbors, vector< pair< Model *, double > > *neighbors) const
 Get the neighbors for a model from the database. Returns false if no neighbors are found.
virtual bool GetPlanningTaskRecord (int task_id, PlanningTaskRecord *)
 Fills in the details for a planning task based on the task id.
virtual bool GraspTypeList (vector< string > *type_list) const
 Returns a vector of strings representing the available grasp sources.
virtual bool InsertGraspPair (const Grasp *, const Grasp *) const
 Inserts into the database info that a pair of existing db grasps can be executed simultaneously.
virtual bool isConnected () const
 Returns true if the manager has successfully connected to the database.
virtual bool LoadModelGeometry (Model *) const
 Loads a model's geometry directly from the database.
virtual bool ModelList (vector< Model * > *model_list, FilterList::FilterType filter=FilterList::NONE) const
 Returns a vector with pointers to every Model in the database, possibly filtered.
virtual bool SaveAlignment (const Model &source, const Model &dest, const string &alignment_method_name, const float alignment[16]) const
 Save a 4x4 alignment into the database.
virtual bool SaveGrasp (const Grasp *grasp) const
 Save a grasp into the database.
virtual bool SaveNeighbors (const Model &model, const string &distance_function_name, const vector< pair< Model *, double > > &neighbors) const
 Save the neighbors for a model into the database.
virtual bool ScaledModel (Model *&model, int scaled_model_id) const
 Gets one individual model from the database based on scaled model id.
void SetGraspAllocator (GraspAllocator *allocator)
 Sets a new grasp allocator; deletes the old one.
virtual bool SetGraspClusterRep (Grasp *, bool) const
 Sets the cluster_rep field of the grasp in the database.
virtual bool SetGraspTableClearance (Grasp *, double) const
 Sets the table_clearance field of the grasp in the database.
void SetModelAllocator (ModelAllocator *allocator)
 Sets a new model allocator; deletes the old one.
virtual bool SetTaskStatus (int, const string &)
 Change the status of a task in the database (e.g. mark it as COMPLETED).
 SqlDatabaseManager (const string &host_name, const int port, const string &user_name, const string &password, const string &database_name, ModelAllocator *model_allocator, GraspAllocator *grasp_allocator, const string &connection_type="QPSQL")
 ~SqlDatabaseManager ()

Protected Attributes

DatabaseConnection database_
 The connection to the SQL database.
string model_root_
 Absolute path to the root directory where geometry and thumbnails are stored.

Detailed Description

SqlDatabaseManager implements DatabaseManager for using the Postgresql version of the CGDB.

Definition at line 44 of file sql_database_manager.h.


Constructor & Destructor Documentation

db_planner::SqlDatabaseManager::SqlDatabaseManager ( const string &  host_name,
const int  port,
const string &  user_name,
const string &  password,
const string &  database_name,
ModelAllocator model_allocator,
GraspAllocator grasp_allocator,
const string &  connection_type = "QPSQL" 
) [inline]

Definition at line 52 of file sql_database_manager.h.

db_planner::SqlDatabaseManager::~SqlDatabaseManager (  )  [inline]

Definition at line 71 of file sql_database_manager.h.


Member Function Documentation

virtual bool db_planner::SqlDatabaseManager::AcquireNextTask ( TaskRecord rec  )  [inline, virtual]

Acquires the next experiment to be executed from the list of tasks in the database.

Also marks it as RUNNING in an atomic fashion, so that it is not acquired by another process.

Implements db_planner::DatabaseManager.

Definition at line 130 of file sql_database_manager.h.

bool db_planner::SqlDatabaseManager::AlignmentMethodList ( vector< string > *  alignment_method_list  )  const [virtual]

Returns a vector of strings representing the available precomputed alignment methods.

Implements db_planner::DatabaseManager.

Definition at line 208 of file sql_database_manager.cpp.

virtual bool db_planner::SqlDatabaseManager::DeleteGrasp ( Grasp grasp  )  const [inline, virtual]

Delete a grasp from the database.

Implements db_planner::DatabaseManager.

Definition at line 129 of file sql_database_manager.h.

bool db_planner::SqlDatabaseManager::DistanceFunctionList ( vector< string > *  distance_function_list  )  const [virtual]

Returns a vector of strings representing the available neighbor distance functions.

Implements db_planner::DatabaseManager.

Definition at line 203 of file sql_database_manager.cpp.

bool db_planner::SqlDatabaseManager::GetAlignment ( const Model source,
const Model dest,
const string &  alignment_method_name,
float  alignment[16] 
) const [virtual]

Get the 4x4 alignment for 2 Models that are both in the database.

Returns false if either Model isn't in the database or if no alignment is found. Transforms are left-multiply and column major.

Implements db_planner::DatabaseManager.

Definition at line 51 of file sql_database_manager.cpp.

bool db_planner::SqlDatabaseManager::GetGrasps ( const Model model,
const string &  hand_name,
vector< Grasp * > *  grasp_list 
) const [virtual]

Get a list of the Grasps for a Model.

Implements db_planner::DatabaseManager.

Definition at line 218 of file sql_database_manager.cpp.

bool db_planner::SqlDatabaseManager::GetNeighbors ( const Model model,
const string &  distance_function_name,
const int  num_neighbors,
vector< pair< Model *, double > > *  neighbors 
) const [virtual]

Get the neighbors for a model from the database. Returns false if no neighbors are found.

Note that num_neighbors is misleading; this will return up to 2 x num_neighbors models, since whenever possible it returns a model at the scale above and below the query model.

Implements db_planner::DatabaseManager.

Definition at line 122 of file sql_database_manager.cpp.

virtual bool db_planner::SqlDatabaseManager::GetPlanningTaskRecord ( int  task_id,
PlanningTaskRecord rec 
) [inline, virtual]

Fills in the details for a planning task based on the task id.

Implements db_planner::DatabaseManager.

Definition at line 132 of file sql_database_manager.h.

bool db_planner::SqlDatabaseManager::GraspTypeList ( vector< string > *  type_list  )  const [virtual]

Returns a vector of strings representing the available grasp sources.

Implements db_planner::DatabaseManager.

Definition at line 213 of file sql_database_manager.cpp.

virtual bool db_planner::SqlDatabaseManager::InsertGraspPair ( const Grasp grasp1,
const Grasp grasp2 
) const [inline, virtual]

Inserts into the database info that a pair of existing db grasps can be executed simultaneously.

Implements db_planner::DatabaseManager.

Definition at line 134 of file sql_database_manager.h.

virtual bool db_planner::SqlDatabaseManager::isConnected (  )  const [inline, virtual]

Returns true if the manager has successfully connected to the database.

Implements db_planner::DatabaseManager.

Definition at line 85 of file sql_database_manager.h.

virtual bool db_planner::SqlDatabaseManager::LoadModelGeometry ( Model  )  const [inline, virtual]

Loads a model's geometry directly from the database.

Implements db_planner::DatabaseManager.

Definition at line 136 of file sql_database_manager.h.

bool db_planner::SqlDatabaseManager::ModelList ( vector< Model * > *  model_list,
FilterList::FilterType  filter = FilterList::NONE 
) const [virtual]

Returns a vector with pointers to every Model in the database, possibly filtered.

Implements db_planner::DatabaseManager.

Definition at line 159 of file sql_database_manager.cpp.

bool db_planner::SqlDatabaseManager::SaveAlignment ( const Model source,
const Model dest,
const string &  alignment_method_name,
const float  alignment[16] 
) const [virtual]

Save a 4x4 alignment into the database.

Transforms are left-multiply and column major.

Implements db_planner::DatabaseManager.

Definition at line 68 of file sql_database_manager.cpp.

bool db_planner::SqlDatabaseManager::SaveGrasp ( const Grasp grasp  )  const [virtual]

Save a grasp into the database.

Implements db_planner::DatabaseManager.

Definition at line 300 of file sql_database_manager.cpp.

bool db_planner::SqlDatabaseManager::SaveNeighbors ( const Model model,
const string &  distance_function_name,
const vector< pair< Model *, double > > &  neighbors 
) const [virtual]

Save the neighbors for a model into the database.

Implements db_planner::DatabaseManager.

Definition at line 149 of file sql_database_manager.cpp.

virtual bool db_planner::SqlDatabaseManager::ScaledModel ( Model *&  model,
int  scaled_model_id 
) const [inline, virtual]

Gets one individual model from the database based on scaled model id.

Implements db_planner::DatabaseManager.

Definition at line 137 of file sql_database_manager.h.

void db_planner::SqlDatabaseManager::SetGraspAllocator ( GraspAllocator allocator  )  [inline, virtual]

Sets a new grasp allocator; deletes the old one.

Implements db_planner::DatabaseManager.

Definition at line 74 of file sql_database_manager.h.

virtual bool db_planner::SqlDatabaseManager::SetGraspClusterRep ( Grasp grasp,
bool  rep 
) const [inline, virtual]

Sets the cluster_rep field of the grasp in the database.

Note: this is an ugly way of updating the database. There should be a single function where a grasp is updated in the database. You check out a grasp from the dbase, do whatever you want with it and then call updateToDb or something.

Implements db_planner::DatabaseManager.

Definition at line 133 of file sql_database_manager.h.

virtual bool db_planner::SqlDatabaseManager::SetGraspTableClearance ( Grasp grasp,
double  clearance 
) const [inline, virtual]

Sets the table_clearance field of the grasp in the database.

Implements db_planner::DatabaseManager.

Definition at line 135 of file sql_database_manager.h.

void db_planner::SqlDatabaseManager::SetModelAllocator ( ModelAllocator allocator  )  [inline, virtual]

Sets a new model allocator; deletes the old one.

Implements db_planner::DatabaseManager.

Definition at line 79 of file sql_database_manager.h.

virtual bool db_planner::SqlDatabaseManager::SetTaskStatus ( int  task_id,
const string &  status 
) [inline, virtual]

Change the status of a task in the database (e.g. mark it as COMPLETED).

Implements db_planner::DatabaseManager.

Definition at line 131 of file sql_database_manager.h.


Member Data Documentation

The connection to the SQL database.

Definition at line 47 of file sql_database_manager.h.

Absolute path to the root directory where geometry and thumbnails are stored.

Definition at line 50 of file sql_database_manager.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:32 2012