#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 (MessageCollectionHelper::Ptr collection) | |
Will connect to given database and collection. Collection is created if it doesn't exist. More... | |
MessageCollection (const MessageCollection &rhs) | |
Copy constructor. 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... | |
MessageCollection & | operator= (const MessageCollection &other) |
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... | |
~MessageCollection () | |
Destructor. More... | |
Private Attributes | |
MessageCollectionHelper::Ptr | collection_ |
bool | md5sum_matches_ |
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 67 of file message_collection.h.
typedef M warehouse_ros::MessageCollection< M >::message_type |
Definition at line 128 of file message_collection.h.
typedef boost::shared_ptr<MessageCollection<M> > warehouse_ros::MessageCollection< M >::Ptr |
Definition at line 127 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.
warehouse_ros::MessageCollection< M >::MessageCollection | ( | const MessageCollection< M > & | rhs | ) |
Copy constructor.
Definition at line 53 of file message_collection_impl.hpp.
warehouse_ros::MessageCollection< M >::~MessageCollection | ( | ) |
Destructor.
Definition at line 59 of file message_collection_impl.hpp.
unsigned warehouse_ros::MessageCollection< M >::count | ( | ) |
Count messages in collection.
Definition at line 133 of file message_collection_impl.hpp.
Metadata::Ptr warehouse_ros::MessageCollection< M >::createMetadata | ( | ) | const |
Definition at line 151 of file message_collection_impl.hpp.
Query::Ptr warehouse_ros::MessageCollection< M >::createQuery | ( | ) | const |
Definition at line 145 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 111 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 72 of file message_collection_impl.hpp.
bool warehouse_ros::MessageCollection< M >::md5SumMatches | ( | ) | const |
Check if the md5 sum of the messages previously stored in the database matches that of the compiled message.
Definition at line 139 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 127 of file message_collection_impl.hpp.
MessageCollection< M > & warehouse_ros::MessageCollection< M >::operator= | ( | const MessageCollection< M > & | other | ) |
Definition at line 64 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 90 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 101 of file message_collection_impl.hpp.
unsigned warehouse_ros::MessageCollection< M >::removeMessages | ( | Query::ConstPtr | query | ) |
Remove messages matching query.
Definition at line 121 of file message_collection_impl.hpp.
|
private |
Definition at line 131 of file message_collection.h.
|
private |
Definition at line 132 of file message_collection.h.