Template Class MessageCollection
- Defined in File message_collection.h 
Class Documentation
- 
template<class M>
 class MessageCollection
- Represents a collection of ROS Messages stored in a database. Each stored message in the db has a unique id, a creation time, and optional additional metadata stored as a dictionary - Public Functions - 
MessageCollection(MessageCollectionHelper::Ptr collection)
- Will connect to given database and collection. Collection is created if it doesn’t exist. 
 - 
MessageCollection() = default
- Default constructor. 
 - 
void insert(const M &msg, Metadata::Ptr metadata)
- Insert a ROS message, together with some optional metadata, into the db. - Throws:
- mongo::DBException – if unable to insert 
- Parameters:
- metadata – Metadata to insert. Note that a unique id field _id and a field creation_time will be autogenerated for all messages. 
 
 - 
QueryResults<M>::range_t query(Query::ConstPtr query, bool metadata_only = false, const std::string &sort_by = "", bool ascending = true) const
- Return values:
- Iterator – range over matching messages 
- Parameters:
- query – A query object 
- metadata_only – If this is true, only retrieve the metadata (returned message objects will just be default constructed) 
 
 
 - 
std::vector<typename MessageWithMetadata<M>::ConstPtr> queryList(Query::ConstPtr 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. 
 - 
MessageWithMetadata<M>::ConstPtr findOne(Query::ConstPtr query, bool metadata_only = false) const
- Convenience function that returns a single matching result for the query. - Throws:
 
 - 
void modifyMetadata(Query::ConstPtr q, Metadata::ConstPtr 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. 
 - 
unsigned count()
- Count messages in collection. 
 - 
bool md5SumMatches() const
- Check if the md5 sum of the messages previously stored in the database matches that of the compiled message. 
 
- 
MessageCollection(MessageCollectionHelper::Ptr collection)