#include <message_collection.h>
Public Types | |
typedef M | message_type |
typedef boost::shared_ptr< MessageCollection< M > > | Ptr |
Public Member Functions | |
unsigned | count () |
Count messages in collection. More... | |
Metadata::Ptr | createMetadata () const |
Query::Ptr | createQuery () const |
MessageWithMetadata< M >::ConstPtr | findOne (Query::ConstPtr query, bool metadata_only=false) const |
Convenience function that returns a single matching result for the query. More... | |
void | insert (const M &msg, Metadata::Ptr metadata) |
Insert a ROS message, together with some optional metadata, into the db. More... | |
bool | md5SumMatches () const |
Check if the md5 sum of the messages previously stored in the database matches that of the compiled message. More... | |
MessageCollection ()=default | |
Default constructor. More... | |
MessageCollection (MessageCollectionHelper::Ptr collection) | |
Will connect to given database and collection. Collection is created if it doesn't exist. More... | |
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. More... | |
QueryResults< M >::range_t | query (Query::ConstPtr query, bool metadata_only=false, const std::string &sort_by="", bool ascending=true) const |
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. More... | |
unsigned | removeMessages (Query::ConstPtr query) |
Remove messages matching query. More... | |
Private Attributes | |
MessageCollectionHelper::Ptr | collection_ |
bool | md5sum_matches_ = false |
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
Definition at line 68 of file message_collection.h.
typedef M warehouse_ros::MessageCollection< M >::message_type |
Definition at line 124 of file message_collection.h.
typedef boost::shared_ptr<MessageCollection<M> > warehouse_ros::MessageCollection< M >::Ptr |
Definition at line 123 of file message_collection.h.
warehouse_ros::MessageCollection< M >::MessageCollection | ( | MessageCollectionHelper::Ptr | collection | ) |
Will connect to given database and collection. Collection is created if it doesn't exist.
Definition at line 43 of file message_collection_impl.hpp.
|
default |
Default constructor.
unsigned warehouse_ros::MessageCollection< M >::count |
Count messages in collection.
Definition at line 114 of file message_collection_impl.hpp.
Metadata::Ptr warehouse_ros::MessageCollection< M >::createMetadata |
Definition at line 132 of file message_collection_impl.hpp.
Query::Ptr warehouse_ros::MessageCollection< M >::createQuery |
Definition at line 126 of file message_collection_impl.hpp.
MessageWithMetadata< M >::ConstPtr warehouse_ros::MessageCollection< M >::findOne | ( | Query::ConstPtr | query, |
bool | metadata_only = false |
||
) | const |
Convenience function that returns a single matching result for the query.
NoMatchingMessageException |
Definition at line 92 of file message_collection_impl.hpp.
void warehouse_ros::MessageCollection< M >::insert | ( | const M & | msg, |
Metadata::Ptr | metadata | ||
) |
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. |
Serialize the message into a buffer
Definition at line 53 of file message_collection_impl.hpp.
bool warehouse_ros::MessageCollection< M >::md5SumMatches |
Check if the md5 sum of the messages previously stored in the database matches that of the compiled message.
Definition at line 120 of file message_collection_impl.hpp.
void warehouse_ros::MessageCollection< M >::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.
Definition at line 108 of file message_collection_impl.hpp.
QueryResults< M >::range_t warehouse_ros::MessageCollection< M >::query | ( | Query::ConstPtr | query, |
bool | metadata_only = false , |
||
const std::string & | sort_by = "" , |
||
bool | ascending = true |
||
) | const |
Iterator | range over matching messages |
query | A query object |
metadata_only | If this is true, only retrieve the metadata (returned message objects will just be default constructed) |
Definition at line 71 of file message_collection_impl.hpp.
std::vector< typename MessageWithMetadata< M >::ConstPtr > warehouse_ros::MessageCollection< M >::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.
Definition at line 82 of file message_collection_impl.hpp.
unsigned warehouse_ros::MessageCollection< M >::removeMessages | ( | Query::ConstPtr | query | ) |
Remove messages matching query.
Definition at line 102 of file message_collection_impl.hpp.
|
private |
Definition at line 127 of file message_collection.h.
|
private |
Definition at line 128 of file message_collection.h.