Class DatabaseConnection

Inheritance Relationships

Derived Type

Class Documentation

class DatabaseConnection

Subclassed by warehouse_ros::DBConnectionStub

Public Types

typedef boost::shared_ptr<DatabaseConnection> Ptr

Public Functions

inline virtual ~DatabaseConnection()
virtual bool setParams(const std::string &host, unsigned port, float timeout = 60.0) = 0

Set database connection params.

virtual bool setTimeout(float timeout) = 0

Set database connection params.

virtual bool connect() = 0

Setup the database connection. This call assumes setParams() has been previously called. Returns true if the connection was succesfully established.

virtual bool isConnected() = 0

Returns whether the database is connected.

virtual void dropDatabase(const std::string &db_name) = 0

Drop a db and all its collections. A DbClientConnection exception will be thrown if the database is not connected.

virtual std::string messageType(const std::string &db_name, const std::string &collection_name) = 0

Return the ROS Message type of a given collection.

template<class M>
MessageCollection<M> openCollection(const std::string &db_name, const std::string &collection_name)

Open a collection on the DB. The collection is created if it doesn’t exist. A DbClientConnection exception will be thrown if the database is not connected.

template<class M>
MessageCollection<M>::Ptr openCollectionPtr(const std::string &db_name, const std::string &collection_name)

Open a collection on the DB. The collection is created if it doesn’t exist. A DbClientConnection exception will be thrown if the database is not connected.

Protected Functions

virtual MessageCollectionHelper::Ptr openCollectionHelper(const std::string &db_name, const std::string &collection_name) = 0