Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00039 #ifndef WAREHOUSE_ROS_DATABASE_CONNECTION_H
00040 #define WAREHOUSE_ROS_DATABASE_CONNECTION_H
00041
00042 #include <warehouse_ros/message_collection.h>
00043
00044 namespace warehouse_ros
00045 {
00046
00047 class DatabaseConnection
00048 {
00049 public:
00051 virtual bool setParams(const std::string& host, unsigned port, float timeout = 60.0) = 0;
00052
00054 virtual bool setTimeout(float timeout) = 0;
00055
00058 virtual bool connect() = 0;
00059
00061 virtual bool isConnected() = 0;
00062
00065 virtual void dropDatabase(const std::string& db_name) = 0;
00066
00068 virtual std::string messageType(const std::string& db_name, const std::string& collection_name) = 0;
00069
00072 template<class M>
00073 MessageCollection<M> openCollection(const std::string& db_name, const std::string& collection_name);
00074
00077 template<class M>
00078 typename MessageCollection<M>::Ptr openCollectionPtr(const std::string& db_name,
00079 const std::string& collection_name);
00080
00081 typedef boost::shared_ptr<DatabaseConnection> Ptr;
00082 protected:
00083 virtual MessageCollectionHelper::Ptr openCollectionHelper(const std::string& db_name,
00084 const std::string& collection_name) = 0;
00085 };
00086
00087 }
00088
00089 #include "impl/database_connection_impl.hpp"
00090
00091 #endif // include guard