warehouse::Collection< M > Class Template Reference

Class used to query and update a collection in the warehouse External code shouldn't directly create objects of this class: instead, use WarehouseClient::setupCollection. More...

#include <collection.h>

List of all members.

Classes

struct  Impl

Public Member Functions

 Collection ()
 Default constructor. Can be called by external code if you want to create a Collection object and assign it later.
 Collection (const Collection &pub)
 Copy constructor. Should not be called by external code. Should only be used when rhs is about to go out of scope.
 Collection (const std::string &topic, const std::string &db, const std::string &collection, const ros::NodeHandle &nh)
 Constructor. Should not be called by external code.
std::string collectionName () const
 Get the collection name.
Collection< M > & operator= (const Collection< M > &c)
 Assignment operator.
std::string publish (const M &msg, const std::string &metadata=std::string())
 Publishes a message with given metadata. Waits for notification and returns the id of the message.
std::vector< typename
MessageWithMetadata< M >
::ConstPtr > 
pullAllResults (const std::vector< Condition > &conditions, bool metadata_only=false, const OrderingCriterion &order=OrderingCriterion()) const
 Front-end to queryResults that fetches all the results and puts them into a vector.
QueryResults< M >::range_t queryResults (const std::vector< Condition > &conditions, bool metadata_only=false, const OrderingCriterion &order=OrderingCriterion()) const
 Query the collection.
unsigned removeMessages (const std::vector< Condition > &conditions)
 Remove messages from a collection.

Private Types

typedef boost::shared_ptr< ImplImplPtr

Private Member Functions

void addMetadata (const std::string &id, const std::string &metadata)
 Assumes lock is held on mutex_.

Private Attributes

ImplPtr impl_

Detailed Description

template<class M>
class warehouse::Collection< M >

Class used to query and update a collection in the warehouse External code shouldn't directly create objects of this class: instead, use WarehouseClient::setupCollection.

Definition at line 52 of file collection.h.


Member Typedef Documentation

template<class M>
typedef boost::shared_ptr<Impl> warehouse::Collection< M >::ImplPtr [private]

Definition at line 145 of file collection.h.


Constructor & Destructor Documentation

template<class M>
warehouse::Collection< M >::Collection ( const std::string &  topic,
const std::string &  db,
const std::string &  collection,
const ros::NodeHandle &  nh 
)

Constructor. Should not be called by external code.

template<class M >
warehouse::Collection< M >::Collection ( const Collection< M > &  pub  )  [inline]

Copy constructor. Should not be called by external code. Should only be used when rhs is about to go out of scope.

Definition at line 65 of file collection_impl.h.

template<class M >
warehouse::Collection< M >::Collection (  )  [inline]

Default constructor. Can be called by external code if you want to create a Collection object and assign it later.

Definition at line 71 of file collection_impl.h.


Member Function Documentation

template<class M>
void warehouse::Collection< M >::addMetadata ( const std::string &  id,
const std::string &  metadata 
) [private]

Assumes lock is held on mutex_.

template<class M >
string warehouse::Collection< M >::collectionName (  )  const [inline]

Get the collection name.

Definition at line 312 of file collection_impl.h.

template<class M >
Collection< M > & warehouse::Collection< M >::operator= ( const Collection< M > &  c  )  [inline]

Assignment operator.

Definition at line 76 of file collection_impl.h.

template<class M>
std::string warehouse::Collection< M >::publish ( const M &  msg,
const std::string &  metadata = std::string() 
)

Publishes a message with given metadata. Waits for notification and returns the id of the message.

Parameters:
metadata A yaml encoded dictionary of key-value pairs, where the keys are strings and the values are numbers or strings (use the yaml_cpp library to generate)
Template Parameters:
M must equal the advertised type of this Collection
template<class M>
std::vector<typename MessageWithMetadata<M>::ConstPtr > warehouse::Collection< M >::pullAllResults ( const std::vector< Condition > &  conditions,
bool  metadata_only = false,
const OrderingCriterion order = OrderingCriterion() 
) const

Front-end to queryResults that fetches all the results and puts them into a vector.

template<class M>
QueryResults<M>::range_t warehouse::Collection< M >::queryResults ( const std::vector< Condition > &  conditions,
bool  metadata_only = false,
const OrderingCriterion order = OrderingCriterion() 
) const

Query the collection.

Template Parameters:
Message type. Must match message type in collection
Parameters:
metadata_only If true, only get the metadata, not the message objects themselves (i.e., default constructed message objects will be returned, which saves space if the actual messages include large arrays)
Exceptions:
WarehouseClientException if any of the service calls involved fails
Return values:
The return value is a pair of iterators, that models Boost single pass range. In other words, you can use the iterators in loops and STL operations, or use the returned range directly in something like BOOST_FOREACH. The iterators lazily pull messages from the warehouse as needed.

Can conceivably get stuck if the warehouse dies during the interaction

template<class M>
unsigned warehouse::Collection< M >::removeMessages ( const std::vector< Condition > &  conditions  ) 

Remove messages from a collection.

Return values:
Number of messages removed
Exceptions:
WarehouseClientException 

Member Data Documentation

template<class M>
ImplPtr warehouse::Collection< M >::impl_ [private]

Definition at line 146 of file collection.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Defines


warehouse
Author(s): Nate Koenig, Bhaskara Marthi
autogenerated on Fri Jan 11 10:09:02 2013