message_collection.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  */
30 
39 #ifndef WAREHOUSE_ROS_MESSAGE_COLLECTION_H
40 #define WAREHOUSE_ROS_MESSAGE_COLLECTION_H
41 
43 
44 namespace warehouse_ros
45 {
47 {
48 public:
49  virtual bool initialize(const std::string& datatype, const std::string& md5) = 0;
50  virtual void insert(char* msg, size_t msg_size, Metadata::ConstPtr metadata) = 0;
51  virtual ResultIteratorHelper::Ptr query(Query::ConstPtr query, const std::string& sort_by = "",
52  bool ascending = true) const = 0;
53  virtual unsigned removeMessages(Query::ConstPtr query) = 0;
54  virtual void modifyMetadata(Query::ConstPtr q, Metadata::ConstPtr m) = 0;
55  virtual unsigned count() = 0;
56  virtual Query::Ptr createQuery() const = 0;
57  virtual Metadata::Ptr createMetadata() const = 0;
58  virtual std::string collectionName() const = 0;
59 
61 };
62 
66 template <class M>
68 {
69 public:
73 
76 
79 
80  MessageCollection& operator=(const MessageCollection& other);
81 
87  void insert(const M& msg, Metadata::Ptr metadata);
88 
93  typename QueryResults<M>::range_t query(Query::ConstPtr query, bool metadata_only = false,
94  const std::string& sort_by = "", bool ascending = true) const;
95 
98  std::vector<typename MessageWithMetadata<M>::ConstPtr> queryList(Query::ConstPtr query, bool metadata_only = false,
99  const std::string& sort_by = "",
100  bool ascending = true) const;
101 
105  typename MessageWithMetadata<M>::ConstPtr findOne(Query::ConstPtr query, bool metadata_only = false) const;
106 
108  unsigned removeMessages(Query::ConstPtr query);
109 
115 
117  unsigned count();
118 
121  bool md5SumMatches() const;
122 
123  Query::Ptr createQuery() const;
124 
126 
128  typedef M message_type;
129 
130 private:
133 };
134 
135 } // namespace
136 
138 
139 #endif // include guard
virtual unsigned removeMessages(Query::ConstPtr query)=0
virtual void insert(char *msg, size_t msg_size, Metadata::ConstPtr metadata)=0
virtual void modifyMetadata(Query::ConstPtr q, Metadata::ConstPtr m)=0
std::pair< ResultIterator< M >, ResultIterator< M > > range_t
Definition: query_results.h:94
virtual std::string collectionName() const =0
boost::shared_ptr< MessageCollectionHelper > Ptr
MessageCollectionHelper::Ptr collection_
boost::shared_ptr< MessageCollection< M > > Ptr
virtual bool initialize(const std::string &datatype, const std::string &md5)=0
virtual Query::Ptr createQuery() const =0
virtual Metadata::Ptr createMetadata() const =0
virtual ResultIteratorHelper::Ptr query(Query::ConstPtr query, const std::string &sort_by="", bool ascending=true) const =0


warehouse_ros
Author(s): Bhaskara Marthi , Connor Brew
autogenerated on Fri Jun 7 2019 21:44:23