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 ()=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
 

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 68 of file message_collection.h.

Member Typedef Documentation

◆ message_type

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

Definition at line 124 of file message_collection.h.

◆ Ptr

Definition at line 123 of file message_collection.h.

Constructor & Destructor Documentation

◆ MessageCollection() [1/2]

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.

◆ MessageCollection() [2/2]

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

Default constructor.

Member Function Documentation

◆ count()

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

Count messages in collection.

Definition at line 114 of file message_collection_impl.hpp.

◆ createMetadata()

template<class M >
Metadata::Ptr warehouse_ros::MessageCollection< M >::createMetadata

Definition at line 132 of file message_collection_impl.hpp.

◆ createQuery()

template<class M >
Query::Ptr warehouse_ros::MessageCollection< M >::createQuery

Definition at line 126 of file message_collection_impl.hpp.

◆ findOne()

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 92 of file message_collection_impl.hpp.

◆ insert()

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 53 of file message_collection_impl.hpp.

◆ md5SumMatches()

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

◆ modifyMetadata()

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 108 of file message_collection_impl.hpp.

◆ query()

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 71 of file message_collection_impl.hpp.

◆ queryList()

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 82 of file message_collection_impl.hpp.

◆ removeMessages()

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

Remove messages matching query.

Definition at line 102 of file message_collection_impl.hpp.

Member Data Documentation

◆ collection_

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

Definition at line 127 of file message_collection.h.

◆ md5sum_matches_

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

Definition at line 128 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 Wed Oct 16 2024 02:42:07