$search
#include <message_collection.h>
Public Member Functions | |
| unsigned | count () |
| Count messages in collection. | |
| MessageCollection & | ensureIndex (const std::string &field) |
| MessageWithMetadata< M >::ConstPtr | findOne (const Query &query, bool metadata_only=false) const |
| Convenience function that returns a single matching result for the query. | |
| void | insert (const M &msg, const Metadata &metadata=Metadata()) |
| Insert a ROS message, together with some optional metadata, into the db. | |
| MessageCollection (const std::string &db_name, const std::string &collection_name, const std::string &db_host="", const unsigned db_port=0) | |
| Will connect to given database and collection. Collection is created if it doesn't exist. | |
| void | modifyMetadata (const Query &q, const Metadata &m) |
| Modify metadata Find message matching q and update its metadata using m In other words, overwrite keys in the message using m, but keep keys that don't occur in m. | |
| std::vector< typename MessageWithMetadata< M > ::ConstPtr > | pullAllResults (const mongo::BSONObj &query, bool metadata_only=false, const std::string &sort_by="", bool ascending=true) const |
| Convenience function that calls queryResult and puts the results into a vector. | |
| QueryResults< M >::range_t | queryResults (const mongo::Query &query, bool metadata_only=false) const |
| Version that takes a mongo::Query. | |
| QueryResults< M >::range_t | queryResults (const mongo::BSONObj &query, bool metadata_only=false, const std::string &sort_by="", bool ascending=true) const |
| unsigned | removeMessages (const mongo::BSONObj &query) |
| Remove messages matching query. | |
Private Member Functions | |
| void | initialize (const std::string &db, const std::string &coll, const std::string &host, unsigned port) |
Private Attributes | |
| boost::shared_ptr < mongo::DBClientConnection > | conn_ |
| boost::shared_ptr< mongo::GridFS > | gfs_ |
| ros::Publisher | insertion_pub_ |
| ros::NodeHandle | nh_ |
| const std::string | ns_ |
Represents a collection of ROS Messages stored in a MongoDB database. Each stored message in the db has a unique id, a creation time, and optional additional metadata stored as a dictionary
Definition at line 52 of file message_collection.h.
| mongo_ros::MessageCollection< M >::MessageCollection | ( | const std::string & | db_name, | |
| const std::string & | collection_name, | |||
| const std::string & | db_host = "", |
|||
| const unsigned | db_port = 0 | |||
| ) |
Will connect to given database and collection. Collection is created if it doesn't exist.
| db_host | If provided, will be used instead of looking up the warehouse_host ros parameter. | |
| db_port | If provided, will be used instead of looking up the warehouse_port ros parameter. |
| unsigned mongo_ros::MessageCollection< M >::count | ( | ) | [inline] |
Count messages in collection.
Definition at line 237 of file message_collection_impl.h.
| MessageCollection& mongo_ros::MessageCollection< M >::ensureIndex | ( | const std::string & | field | ) |
| MessageWithMetadata< M >::ConstPtr mongo_ros::MessageCollection< M >::findOne | ( | const Query & | query, | |
| bool | metadata_only = false | |||
| ) | const [inline] |
Convenience function that returns a single matching result for the query.
| NoMatchingMessageException |
Definition at line 186 of file message_collection_impl.h.
| void mongo_ros::MessageCollection< M >::initialize | ( | const std::string & | db, | |
| const std::string & | coll, | |||
| const std::string & | host, | |||
| unsigned | port | |||
| ) | [private] |
| void mongo_ros::MessageCollection< M >::insert | ( | const M & | msg, | |
| const Metadata & | metadata = Metadata() | |||
| ) | [inline] |
Insert a ROS message, together with some optional metadata, into the db.
| mongo::DBException | if unable to insert |
| metadata | Metadata to insert. Note that a unique id field _id and a field creation_time will be autogenerated for all messages. |
As a secondary effect, publishes a notification message on the topic warehouse/db/collection/inserts
Get the BSON and id from the metadata
Serialize the message into a buffer
Definition at line 114 of file message_collection_impl.h.
| void mongo_ros::MessageCollection< M >::modifyMetadata | ( | const Query & | q, | |
| const Metadata & | m | |||
| ) | [inline] |
Modify metadata Find message matching q and update its metadata using m In other words, overwrite keys in the message using m, but keep keys that don't occur in m.
Definition at line 216 of file message_collection_impl.h.
| std::vector<typename MessageWithMetadata<M>::ConstPtr > mongo_ros::MessageCollection< M >::pullAllResults | ( | const mongo::BSONObj & | query, | |
| bool | metadata_only = false, |
|||
| const std::string & | sort_by = "", |
|||
| bool | ascending = true | |||
| ) | const |
Convenience function that calls queryResult and puts the results into a vector.
| QueryResults< M >::range_t mongo_ros::MessageCollection< M >::queryResults | ( | const mongo::Query & | query, | |
| bool | metadata_only = false | |||
| ) | const [inline] |
Version that takes a mongo::Query.
Definition at line 162 of file message_collection_impl.h.
| QueryResults<M>::range_t mongo_ros::MessageCollection< M >::queryResults | ( | const mongo::BSONObj & | query, | |
| bool | metadata_only = false, |
|||
| const std::string & | sort_by = "", |
|||
| bool | ascending = true | |||
| ) | const |
| Iterator | range over matching messages |
| query | A metadata object representing a query. | |
| metadata_only | If this is true, only retrieve the metadata (returned message objects will just be default constructed) |
| unsigned mongo_ros::MessageCollection< M >::removeMessages | ( | const mongo::BSONObj & | query | ) | [inline] |
Remove messages matching query.
Definition at line 196 of file message_collection_impl.h.
boost::shared_ptr<mongo::DBClientConnection> mongo_ros::MessageCollection< M >::conn_ [private] |
Definition at line 125 of file message_collection.h.
boost::shared_ptr<mongo::GridFS> mongo_ros::MessageCollection< M >::gfs_ [private] |
Definition at line 126 of file message_collection.h.
ros::Publisher mongo_ros::MessageCollection< M >::insertion_pub_ [private] |
Definition at line 128 of file message_collection.h.
ros::NodeHandle mongo_ros::MessageCollection< M >::nh_ [private] |
Definition at line 127 of file message_collection.h.
const std::string mongo_ros::MessageCollection< M >::ns_ [private] |
Definition at line 124 of file message_collection.h.