#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. | |
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. | |
void | insert (const M &msg, Metadata::Ptr metadata) |
Insert a ROS message, together with some optional metadata, into the db. | |
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) | |
Will connect to given database and collection. Collection is created if it doesn't exist. | |
MessageCollection (const MessageCollection &rhs) | |
Copy constructor. | |
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. | |
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. | |
unsigned | removeMessages (Query::ConstPtr query) |
Remove messages matching query. | |
~MessageCollection () | |
Destructor. | |
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 68 of file message_collection.h.
typedef M warehouse_ros::MessageCollection< M >::message_type |
Definition at line 131 of file message_collection.h.
typedef boost::shared_ptr<MessageCollection<M> > warehouse_ros::MessageCollection< M >::Ptr |
Definition at line 130 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 44 of file message_collection_impl.hpp.
warehouse_ros::MessageCollection< M >::MessageCollection | ( | const MessageCollection< M > & | rhs | ) |
Copy constructor.
Definition at line 55 of file message_collection_impl.hpp.
warehouse_ros::MessageCollection< M >::~MessageCollection | ( | ) |
Destructor.
Definition at line 61 of file message_collection_impl.hpp.
unsigned warehouse_ros::MessageCollection< M >::count | ( | ) |
Count messages in collection.
Definition at line 135 of file message_collection_impl.hpp.
Metadata::Ptr warehouse_ros::MessageCollection< M >::createMetadata | ( | ) | const |
Definition at line 153 of file message_collection_impl.hpp.
Query::Ptr warehouse_ros::MessageCollection< M >::createQuery | ( | ) | const |
Definition at line 147 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 113 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 74 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 141 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 129 of file message_collection_impl.hpp.
MessageCollection< M > & warehouse_ros::MessageCollection< M >::operator= | ( | const MessageCollection< M > & | other | ) |
Definition at line 66 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 92 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 103 of file message_collection_impl.hpp.
unsigned warehouse_ros::MessageCollection< M >::removeMessages | ( | Query::ConstPtr | query | ) |
Remove messages matching query.
Definition at line 123 of file message_collection_impl.hpp.
MessageCollectionHelper::Ptr warehouse_ros::MessageCollection< M >::collection_ [private] |
Definition at line 134 of file message_collection.h.
bool warehouse_ros::MessageCollection< M >::md5sum_matches_ [private] |
Definition at line 135 of file message_collection.h.