auto_config.h
Go to the documentation of this file.
1 /*
2  * (C) 2014, Intermodalics BVBA
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the names of its contributors
13  * may be used to endorse or promote products derived from this software
14  * without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef RTT_DYNAMIC_RECONFIGURE_AUTO_CONFIG_H
31 #define RTT_DYNAMIC_RECONFIGURE_AUTO_CONFIG_H
32 
34 #include <boost/thread/shared_mutex.hpp>
35 
37 
42 {
43 public:
45 
46  std::string prefix_;
47  std::string name;
48  std::string type;
49  int parent;
50  int id;
51  bool state;
52 
53  AutoConfig();
54  AutoConfig(const RTT::PropertyBag &bag);
55  ~AutoConfig();
56 
57  bool __fromMessage__(dynamic_reconfigure::Config &msg, const AutoConfig &sample);
58  static bool __fromMessage__(AutoConfig &config, dynamic_reconfigure::Config &msg, const AutoConfig &sample);
59  void __toMessage__(dynamic_reconfigure::Config &msg) const;
60  static void __toMessage__(const AutoConfig &config, dynamic_reconfigure::Config &msg);
61 
62  void __toServer__(const ros::NodeHandle &nh) const;
63  void __fromServer__(const ros::NodeHandle &nh);
64  void __clamp__(const ServerType *server);
65  uint32_t __level__(const AutoConfig &config) const;
66 
67  static dynamic_reconfigure::ConfigDescriptionPtr __getDescriptionMessage__(const ServerType *server);
68  static const AutoConfig& __getDefault__(const ServerType *server);
69  static const AutoConfig& __getMax__(const ServerType *server);
70  static const AutoConfig& __getMin__(const ServerType *server);
71 
72  static void __refreshDescription__(const ServerType *server);
73 
74  bool updateProperties(RTT::PropertyBag &) const;
75  bool fromProperties(const RTT::PropertyBag &);
76 
77 private:
78  struct Cache;
80  static std::map<const ServerType *, CachePtr> cache_;
81  static boost::shared_mutex cache_mutex_;
82  static void buildCache(const ServerType *server, RTT::TaskContext *owner);
83 };
84 
86  dynamic_reconfigure::ConfigDescriptionPtr description_message_;
90 };
91 
92 } // namespace rtt_dynamic_reconfigure
93 
94 
95 #include "server.h"
96 
97 namespace rtt_dynamic_reconfigure {
98 
99 template <>
101  static bool propertiesFromConfig(AutoConfig &config, uint32_t, RTT::PropertyBag &bag) { return config.updateProperties(bag); }
102  static bool configFromProperties(AutoConfig &config, const RTT::PropertyBag &bag) { return config.fromProperties(bag); }
103 };
104 
105 template <>
108 
109  static void getMin(AutoConfig &config, const ServerType *server) { config = AutoConfig::__getMin__(server); }
110  static void getMax(AutoConfig &config, const ServerType *server) { config = AutoConfig::__getMax__(server); }
111  static void getDefault(AutoConfig &config, const ServerType *server) { config = AutoConfig::__getDefault__(server); }
112  static dynamic_reconfigure::ConfigDescriptionPtr getDescriptionMessage(const ServerType *server) { return AutoConfig::__getDescriptionMessage__(server); }
113 
114  static const bool canRefresh = true;
115  static void refreshDescription(const ServerType *server) { AutoConfig::__refreshDescription__(server); }
116 
117  static void toMessage(AutoConfig &config, dynamic_reconfigure::Config &message, const ServerType *) { config.__toMessage__(message); }
118  static void fromMessage(AutoConfig &config, dynamic_reconfigure::Config &message, const ServerType *server) { config.__fromMessage__(message, server->getConfig()); }
119  static void clamp(AutoConfig &config, const ServerType *server) { config.__clamp__(server); }
120 
123  }
124 };
125 
126 } // namespace rtt_dynamic_reconfigure
127 
128 #endif // RTT_DYNAMIC_RECONFIGURE_AUTO_CONFIG_H
bool __fromMessage__(dynamic_reconfigure::Config &msg, const AutoConfig &sample)
bool updateProperties(RTT::PropertyBag &) const
Server< AutoConfig > ServerType
Definition: auto_config.h:44
static void getMin(AutoConfig &config, const ServerType *server)
Definition: auto_config.h:109
static bool configFromProperties(AutoConfig &config, const RTT::PropertyBag &bag)
Definition: auto_config.h:102
static dynamic_reconfigure::ConfigDescriptionPtr __getDescriptionMessage__(const ServerType *server)
static RTT::internal::AssignableDataSource< RTT::PropertyBag >::shared_ptr getDataSource(AutoConfig &config, const ServerType *)
Definition: auto_config.h:121
static void getDefault(AutoConfig &config, const ServerType *server)
Definition: auto_config.h:111
void __fromServer__(const ros::NodeHandle &nh)
void __toMessage__(dynamic_reconfigure::Config &msg) const
dynamic_reconfigure::ConfigDescriptionPtr description_message_
Definition: auto_config.h:86
bool fromProperties(const RTT::PropertyBag &)
const ConfigType & getConfig() const
Definition: server.h:245
static void refreshDescription(const ServerType *server)
Definition: auto_config.h:115
boost::shared_ptr< Cache > CachePtr
Definition: auto_config.h:78
static void clamp(AutoConfig &config, const ServerType *server)
Definition: auto_config.h:119
uint32_t __level__(const AutoConfig &config) const
static void buildCache(const ServerType *server, RTT::TaskContext *owner)
static void toMessage(AutoConfig &config, dynamic_reconfigure::Config &message, const ServerType *)
Definition: auto_config.h:117
static const AutoConfig & __getDefault__(const ServerType *server)
static const AutoConfig & __getMin__(const ServerType *server)
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
static void fromMessage(AutoConfig &config, dynamic_reconfigure::Config &message, const ServerType *server)
Definition: auto_config.h:118
static void __refreshDescription__(const ServerType *server)
void __clamp__(const ServerType *server)
static dynamic_reconfigure::ConfigDescriptionPtr getDescriptionMessage(const ServerType *server)
Definition: auto_config.h:112
static void getMax(AutoConfig &config, const ServerType *server)
Definition: auto_config.h:110
static std::map< const ServerType *, CachePtr > cache_
Definition: auto_config.h:80
static bool propertiesFromConfig(AutoConfig &config, uint32_t, RTT::PropertyBag &bag)
Definition: auto_config.h:101
static const AutoConfig & __getMax__(const ServerType *server)
void __toServer__(const ros::NodeHandle &nh) const
static boost::shared_mutex cache_mutex_
Definition: auto_config.h:81


rtt_dynamic_reconfigure
Author(s): Johannes Meyer
autogenerated on Mon May 10 2021 02:44:56