30 #ifndef MCL_3DL_COMPAT_COMPATIBILITY_H 31 #define MCL_3DL_COMPAT_COMPATIBILITY_H 39 #define STATIC_ASSERT(EXPR) static_assert(EXPR, #EXPR) 46 #ifndef UNDEF_COMPATIBILITY_LEVEL 51 STATIC_ASSERT(supported_level <= current_level && current_level <= supported_level + 1);
52 STATIC_ASSERT(supported_level <= default_level && default_level <= current_level);
57 int compat(default_level);
66 const std::string message =
70 throw std::runtime_error(message);
74 const std::string message =
78 throw std::runtime_error(message);
83 "======= [Deprecated] %s is run in compatible mode =======\n" 84 "=========================================================\n" 85 "Set _compatible:=%d to switch to new topic namespaces.\n" 86 "Compatible mode will be obsolated in the future update.\n" 87 "=========================================================",
94 return std::string(
"~/");
99 template <
class M,
class T>
102 const std::string& topic_new,
104 const std::string& topic_old,
106 void (T::*fp)(M)
const,
113 "Use %s (%s%s) topic instead of %s (%s%s)",
118 return nh_old.
subscribe(topic_old, queue_size, fp, obj, transport_hints);
122 return nh_new.
subscribe(topic_new, queue_size, fp, obj, transport_hints);
125 template <
class M,
class T>
128 const std::string& topic_new,
130 const std::string& topic_old,
139 "Use %s (%s%s) topic instead of %s (%s%s)",
144 return nh_old.
subscribe(topic_old, queue_size, fp, obj, transport_hints);
148 return nh_new.
subscribe(topic_new, queue_size, fp, obj, transport_hints);
154 const std::string& topic_new,
156 const std::string& topic_old,
163 "Use %s (%s%s) topic instead of %s (%s%s)",
168 return nh_old.
advertise<M>(topic_old, queue_size, latch);
172 return nh_new.
advertise<M>(topic_new, queue_size, latch);
175 template <
class T,
class MReq,
class MRes>
178 const std::string& service_new,
180 const std::string& service_old,
181 bool (T::*srv_func)(MReq&, MRes&),
187 "Use %s (%s%s) service instead of %s (%s%s)",
200 template <
typename T>
203 const std::string& param_name_new,
204 const std::string& param_name_old)
209 "Use %s parameter instead of %s",
215 "%s is also defined. Ignoring %s.",
227 #endif // MCL_3DL_COMPAT_COMPATIBILITY_H const std::string & getUnresolvedNamespace() const
std::string getSimplifiedNamespace(ros::NodeHandle &nh)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
std::string resolveName(const std::string &name, bool remap=true) const
ROSCPP_DECL const std::string & getName()
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
const int supported_level
STATIC_ASSERT(supported_level<=current_level &¤t_level<=supported_level+1)
ros::ServiceServer advertiseService(ros::NodeHandle &nh_new, const std::string &service_new, ros::NodeHandle &nh_old, const std::string &service_old, bool(T::*srv_func)(MReq &, MRes &), T *obj)
#define ROS_ERROR_ONCE(...)
const std::string & getNamespace() const
ros::Publisher advertise(ros::NodeHandle &nh_new, const std::string &topic_new, ros::NodeHandle &nh_old, const std::string &topic_old, uint32_t queue_size, bool latch=false)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::Subscriber subscribe(ros::NodeHandle &nh_new, const std::string &topic_new, ros::NodeHandle &nh_old, const std::string &topic_old, uint32_t queue_size, void(T::*fp)(M) const, T *obj, const ros::TransportHints &transport_hints=ros::TransportHints())
bool getParam(const std::string &key, std::string &s) const
void paramRename(ros::NodeHandle &nh, const std::string ¶m_name_new, const std::string ¶m_name_old)
ROSCPP_DECL void shutdown()
bool hasParam(const std::string &key) const
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const