metadata.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_METADATA_H
40 #define WAREHOUSE_ROS_METADATA_H
41 
42 #include <ros/ros.h>
43 #include <boost/shared_ptr.hpp>
44 #include <set>
45 
46 namespace warehouse_ros
47 {
52 class Query
53 {
54 public:
57 
58  virtual ~Query()
59  {
60  }
61  virtual void append(const std::string& name, const std::string& val) = 0;
62  // explicitly provide signature for const char*, otherwise bool version is called
63  void append(const std::string& name, const char* val)
64  {
65  append(name, std::string(val));
66  }
67  virtual void append(const std::string& name, const double val) = 0;
68  virtual void append(const std::string& name, const int val) = 0;
69  virtual void append(const std::string& name, const bool val) = 0;
70  virtual void appendLT(const std::string& name, const double val) = 0;
71  virtual void appendLT(const std::string& name, const int val) = 0;
72  virtual void appendLTE(const std::string& name, const double val) = 0;
73  virtual void appendLTE(const std::string& name, const int val) = 0;
74  virtual void appendGT(const std::string& name, const double val) = 0;
75  virtual void appendGT(const std::string& name, const int val) = 0;
76  virtual void appendGTE(const std::string& name, const double val) = 0;
77  virtual void appendGTE(const std::string& name, const int val) = 0;
78  virtual void appendRange(const std::string& name, const double lower, const double upper) = 0;
79  virtual void appendRange(const std::string& name, const int lower, const int upper) = 0;
80  virtual void appendRangeInclusive(const std::string& name, const double lower, const double upper) = 0;
81  virtual void appendRangeInclusive(const std::string& name, const int lower, const int upper) = 0;
82 };
83 
88 class Metadata
89 {
90 public:
93 
94  virtual ~Metadata()
95  {
96  }
97  virtual void append(const std::string& name, const std::string& val) = 0;
98  void append(const std::string& name, const char* val)
99  {
100  append(name, std::string(val));
101  }
102  virtual void append(const std::string& name, const double val) = 0;
103  virtual void append(const std::string& name, const int val) = 0;
104  virtual void append(const std::string& name, const bool val) = 0;
105  virtual std::string lookupString(const std::string& name) const = 0;
106  virtual double lookupDouble(const std::string& name) const = 0;
107  virtual int lookupInt(const std::string& name) const = 0;
108  virtual bool lookupBool(const std::string& name) const = 0;
109  virtual bool lookupField(const std::string& name) const = 0;
110  virtual std::set<std::string> lookupFieldNames() const = 0;
111 };
112 
113 } // namespace warehouse_ros
114 
115 #endif // include guard
warehouse_ros::Metadata::lookupFieldNames
virtual std::set< std::string > lookupFieldNames() const =0
warehouse_ros::Metadata::Ptr
boost::shared_ptr< Metadata > Ptr
Definition: metadata.h:91
boost::shared_ptr
warehouse_ros::Query::appendRangeInclusive
virtual void appendRangeInclusive(const std::string &name, const double lower, const double upper)=0
warehouse_ros::Metadata::ConstPtr
boost::shared_ptr< const Metadata > ConstPtr
Definition: metadata.h:92
ros.h
warehouse_ros::Metadata::lookupInt
virtual int lookupInt(const std::string &name) const =0
warehouse_ros::Query::~Query
virtual ~Query()
Definition: metadata.h:58
warehouse_ros::Metadata
Represents metadata attached to a message.
Definition: metadata.h:88
warehouse_ros::Query::Ptr
boost::shared_ptr< Query > Ptr
Definition: metadata.h:55
warehouse_ros::Metadata::lookupField
virtual bool lookupField(const std::string &name) const =0
warehouse_ros::Metadata::~Metadata
virtual ~Metadata()
Definition: metadata.h:94
warehouse_ros::Query::append
void append(const std::string &name, const char *val)
Definition: metadata.h:63
warehouse_ros::Query::ConstPtr
boost::shared_ptr< const Query > ConstPtr
Definition: metadata.h:56
warehouse_ros::Query::appendLTE
virtual void appendLTE(const std::string &name, const double val)=0
warehouse_ros::Metadata::lookupString
virtual std::string lookupString(const std::string &name) const =0
warehouse_ros::Metadata::append
void append(const std::string &name, const char *val)
Definition: metadata.h:98
warehouse_ros::Metadata::lookupBool
virtual bool lookupBool(const std::string &name) const =0
warehouse_ros::Query::appendLT
virtual void appendLT(const std::string &name, const double val)=0
warehouse_ros::Metadata::lookupDouble
virtual double lookupDouble(const std::string &name) const =0
warehouse_ros::Metadata::append
virtual void append(const std::string &name, const std::string &val)=0
warehouse_ros::Query::appendGT
virtual void appendGT(const std::string &name, const double val)=0
warehouse_ros
Definition: database_connection.h:44
warehouse_ros::Query
Represents a query to the db.
Definition: metadata.h:52
warehouse_ros::Query::appendGTE
virtual void appendGTE(const std::string &name, const double val)=0
warehouse_ros::Query::append
virtual void append(const std::string &name, const std::string &val)=0
warehouse_ros::Query::appendRange
virtual void appendRange(const std::string &name, const double lower, const double upper)=0


warehouse_ros
Author(s): Bhaskara Marthi , Connor Brew
autogenerated on Wed Oct 16 2024 02:42:07