Public Member Functions | Private Member Functions | Private Attributes | List of all members
warehouse_ros_mongo::MongoMessageCollection Class Reference

#include <message_collection.h>

Inheritance diagram for warehouse_ros_mongo::MongoMessageCollection:
Inheritance graph
[legend]

Public Member Functions

std::string collectionName () const
 Return name of collection. More...
 
unsigned count ()
 Count messages in collection. More...
 
Metadata::Ptr createMetadata () const
 
Query::Ptr createQuery () const
 
void ensureIndex (const std::string &field)
 
bool initialize (const std::string &datatype, const std::string &md5)
 
void insert (char *msg, size_t msg_size, Metadata::ConstPtr metadata)
 Insert a ROS message, together with some optional metadata, into the db. 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...
 
 MongoMessageCollection (const std::shared_ptr< mongo::DBClientConnection > &conn, const std::string &db_name, const std::string &collection_name)
 
ResultIteratorHelper::Ptr query (Query::ConstPtr query, const std::string &sort_by, bool ascending) const
 
unsigned removeMessages (Query::ConstPtr query)
 Remove messages matching query. More...
 
- Public Member Functions inherited from warehouse_ros::MessageCollectionHelper
virtual ~MessageCollectionHelper ()=default
 

Private Member Functions

MongoMetadatadowncastMetadata (Metadata::ConstPtr metadata) const
 
MongoQuerydowncastQuery (Query::ConstPtr query) const
 
void listMetadata (mongo::Query &mquery, std::vector< mongo::BSONObj > &metas)
 

Private Attributes

const std::string coll_
 
std::shared_ptr< mongo::DBClientConnection > conn_
 
const std::string db_
 
std::shared_ptr< mongo::GridFS > gfs_
 
const std::string ns_
 

Additional Inherited Members

- Public Types inherited from warehouse_ros::MessageCollectionHelper
typedef boost::shared_ptr< MessageCollectionHelperPtr
 

Detailed Description

Definition at line 52 of file message_collection.h.

Constructor & Destructor Documentation

◆ MongoMessageCollection()

warehouse_ros_mongo::MongoMessageCollection::MongoMessageCollection ( const std::shared_ptr< mongo::DBClientConnection > &  conn,
const std::string &  db_name,
const std::string &  collection_name 
)

Definition at line 50 of file message_collection.cpp.

Member Function Documentation

◆ collectionName()

string warehouse_ros_mongo::MongoMessageCollection::collectionName ( ) const
virtual

Return name of collection.

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 177 of file message_collection.cpp.

◆ count()

unsigned warehouse_ros_mongo::MongoMessageCollection::count ( )
virtual

Count messages in collection.

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 172 of file message_collection.cpp.

◆ createMetadata()

Metadata::Ptr warehouse_ros_mongo::MongoMessageCollection::createMetadata ( ) const
inlinevirtual

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 95 of file message_collection.h.

◆ createQuery()

Query::Ptr warehouse_ros_mongo::MongoMessageCollection::createQuery ( ) const
inlinevirtual

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 90 of file message_collection.h.

◆ downcastMetadata()

MongoMetadata& warehouse_ros_mongo::MongoMessageCollection::downcastMetadata ( Metadata::ConstPtr  metadata) const
inlineprivate

Definition at line 103 of file message_collection.h.

◆ downcastQuery()

MongoQuery& warehouse_ros_mongo::MongoMessageCollection::downcastQuery ( Query::ConstPtr  query) const
inlineprivate

Definition at line 108 of file message_collection.h.

◆ ensureIndex()

void warehouse_ros_mongo::MongoMessageCollection::ensureIndex ( const std::string &  field)
Postcondition
Ensure that there's an index on the given field. Note that index on _id and creation_time are always created.

Definition at line 75 of file message_collection.cpp.

◆ initialize()

bool warehouse_ros_mongo::MongoMessageCollection::initialize ( const std::string &  datatype,
const std::string &  md5 
)
virtual

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 56 of file message_collection.cpp.

◆ insert()

void warehouse_ros_mongo::MongoMessageCollection::insert ( char *  msg,
size_t  msg_size,
Metadata::ConstPtr  metadata 
)
virtual

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

Exceptions
mongo::DBExceptionif unable to insert

Get the BSON and id from the metadata

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 84 of file message_collection.cpp.

◆ listMetadata()

void warehouse_ros_mongo::MongoMessageCollection::listMetadata ( mongo::Query &  mquery,
std::vector< mongo::BSONObj > &  metas 
)
private

Definition at line 115 of file message_collection.cpp.

◆ modifyMetadata()

void warehouse_ros_mongo::MongoMessageCollection::modifyMetadata ( Query::ConstPtr  q,
Metadata::ConstPtr  m 
)
virtual

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.

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 147 of file message_collection.cpp.

◆ query()

ResultIteratorHelper::Ptr warehouse_ros_mongo::MongoMessageCollection::query ( Query::ConstPtr  query,
const std::string &  sort_by,
bool  ascending 
) const
virtual
Return values
Iteratorrange over matching messages
Parameters
queryA metadata object representing a query.
metadata_onlyIf this is true, only retrieve the metadata (returned message objects will just be default constructed)

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 105 of file message_collection.cpp.

◆ removeMessages()

unsigned warehouse_ros_mongo::MongoMessageCollection::removeMessages ( Query::ConstPtr  query)
virtual

Remove messages matching query.

Implements warehouse_ros::MessageCollectionHelper.

Definition at line 125 of file message_collection.cpp.

Member Data Documentation

◆ coll_

const std::string warehouse_ros_mongo::MongoMessageCollection::coll_
private

Definition at line 117 of file message_collection.h.

◆ conn_

std::shared_ptr<mongo::DBClientConnection> warehouse_ros_mongo::MongoMessageCollection::conn_
private

Definition at line 113 of file message_collection.h.

◆ db_

const std::string warehouse_ros_mongo::MongoMessageCollection::db_
private

Definition at line 116 of file message_collection.h.

◆ gfs_

std::shared_ptr<mongo::GridFS> warehouse_ros_mongo::MongoMessageCollection::gfs_
private

Definition at line 114 of file message_collection.h.

◆ ns_

const std::string warehouse_ros_mongo::MongoMessageCollection::ns_
private

Definition at line 115 of file message_collection.h.


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


warehouse_ros_mongo
Author(s): Bhaskara Marthi , Connor Brew
autogenerated on Sat Apr 2 2022 02:29:13