39 #include <mongo/client/init.h> 49 static bool initialized =
false;
54 mongo::client::initialize();
74 const string db_address = (boost::format(
"%1%:%2%") %
host_ %
port_).str();
79 conn_.reset(
new mongo::DBClientConnection());
83 conn_->connect(db_address);
84 if (!
conn_->isFailed())
87 catch (mongo::ConnectException& e)
95 << db_address <<
"'. If you just created the database, it could take a while for initial setup.");
112 conn_->dropDatabase(db_name);
119 const string meta_ns = db +
".ros_message_collections";
121 mongo::BSONObj obj = cursor->next();
122 return obj.getStringField(
"type");
126 const std::string& collection_name)
std::unique_ptr< mongo::DBClientCursor > CursorPtr
std::string messageType(const std::string &db_name, const std::string &collection_name)
#define ROS_DEBUG_STREAM_NAMED(name, args)
bool setTimeout(float timeout)
bool setParams(const std::string &host, unsigned port, float timeout)
MessageCollectionHelper::Ptr openCollectionHelper(const std::string &db_name, const std::string &collection_name)
MongoDatabaseConnection()
boost::shared_ptr< MessageCollectionHelper > Ptr
void dropDatabase(const std::string &db_name)
std::shared_ptr< mongo::DBClientConnection > conn_
#define ROS_ERROR_STREAM(args)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)