Public Types | Public Member Functions | Private Attributes | List of all members
warehouse_ros::MessageCollection< M > Class Template Reference

#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...
 
MessageCollectionoperator= (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_
 

Detailed Description

template<class M>
class warehouse_ros::MessageCollection< M >

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.

Member Typedef Documentation

template<class M>
typedef M warehouse_ros::MessageCollection< M >::message_type

Definition at line 128 of file message_collection.h.

Definition at line 127 of file message_collection.h.

Constructor & Destructor Documentation

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.

template<class M >
warehouse_ros::MessageCollection< M >::MessageCollection ( const MessageCollection< M > &  rhs)

Copy constructor.

Definition at line 53 of file message_collection_impl.hpp.

template<class M >
warehouse_ros::MessageCollection< M >::~MessageCollection ( )

Destructor.

Definition at line 59 of file message_collection_impl.hpp.

Member Function Documentation

template<class M >
unsigned warehouse_ros::MessageCollection< M >::count ( )

Count messages in collection.

Definition at line 133 of file message_collection_impl.hpp.

template<class M >
Metadata::Ptr warehouse_ros::MessageCollection< M >::createMetadata ( ) const

Definition at line 151 of file message_collection_impl.hpp.

template<class M >
Query::Ptr warehouse_ros::MessageCollection< M >::createQuery ( ) const

Definition at line 145 of file message_collection_impl.hpp.

template<class M >
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.

Exceptions
NoMatchingMessageException

Definition at line 111 of file message_collection_impl.hpp.

template<class M>
void warehouse_ros::MessageCollection< M >::insert ( const M &  msg,
Metadata::Ptr  metadata 
)

Insert a ROS message, together with some optional metadata, into the db.

Exceptions
mongo::DBExceptionif unable to insert
Parameters
metadataMetadata 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.

template<class M >
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.

template<class M >
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.

template<class M >
MessageCollection< M > & warehouse_ros::MessageCollection< M >::operator= ( const MessageCollection< M > &  other)

Definition at line 64 of file message_collection_impl.hpp.

template<class M >
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
Return values
Iteratorrange over matching messages
Parameters
queryA query object
metadata_onlyIf 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.

template<class M >
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.

template<class M >
unsigned warehouse_ros::MessageCollection< M >::removeMessages ( Query::ConstPtr  query)

Remove messages matching query.

Definition at line 121 of file message_collection_impl.hpp.

Member Data Documentation

template<class M>
MessageCollectionHelper::Ptr warehouse_ros::MessageCollection< M >::collection_
private

Definition at line 131 of file message_collection.h.

template<class M>
bool warehouse_ros::MessageCollection< M >::md5sum_matches_
private

Definition at line 132 of file message_collection.h.


The documentation for this class was generated from the following files:


warehouse_ros
Author(s): Bhaskara Marthi , Connor Brew
autogenerated on Mon Apr 26 2021 02:23:26