46 #ifndef ROBOT_ACTIVITY_RESOURCE_MANAGED_SERVICESERVER_H 47 #define ROBOT_ACTIVITY_RESOURCE_MANAGED_SERVICESERVER_H 123 template <
typename ...Args>
141 template<
class MReq,
class MRes>
143 const std::string& service,
147 ROS_DEBUG(
"makeLazyAcquirer ServiceCallback<MReq&, MRes&>&");
151 return nh->advertiseService(
172 template<
class ServiceEvent>
174 const std::string& service,
178 ROS_DEBUG(
"makeLazyAcquirer ServiceEventCallback<ServiceEvent&>&");
182 return nh->advertiseService(
205 template<
class T,
class MReq,
class MRes>
207 const std::string& service,
208 bool(T::*srv_func)(MReq&, MRes&),
232 template<
class T,
class MReq,
class MRes>
234 const std::string& service,
239 = boost::bind(srv_func, obj, _1);
262 template<
class T,
class MReq,
class MRes>
264 const std::string& service,
265 bool(T::*srv_func)(MReq &, MRes &),
291 template<
class T,
class MReq,
class MRes>
293 const std::string& service,
298 = boost::bind(srv_func, obj.get(), _1);
317 template<
class MReq,
class MRes>
319 const std::string& service,
320 bool(*srv_func)(MReq&, MRes&))
const 340 template<
class MReq,
class MRes>
342 const std::string& service,
346 = boost::bind(srv_func);
385 template <
typename ...Args>
389 return [
this, &callback](Args ... args) ->
bool 396 return callback(std::forward<Args>(args)...);
404 #endif // ROBOT_ACTIVITY_RESOURCE_MANAGED_SERVICESERVER_H void shutdown()
Shutdowns the ROS service.
ServiceCallback< Args... > wrapServiceCallback(const ServiceCallback< Args... > &callback) const
Wraps the service callback.
std::atomic< bool > paused_
Atomic flag specifing whether the resource is paused or not.
Implementation of Managed class for ros::ServiceServer.
LazyAcquirer makeLazyAcquirer(const std::string &service, bool(T::*srv_func)(ros::ServiceEvent< MReq, MRes > &), T *obj) const
Creates a function that advertises a ROS service when called.
std::function< ros::ServiceServer(const ros::NodeHandlePtr &)> LazyAcquirer
LazyAcquirer makeLazyAcquirer(const std::string &service, bool(T::*srv_func)(ros::ServiceEvent< MReq, MRes > &), const boost::shared_ptr< T > &obj) const
Creates a function that advertises a ROS service when called.
LazyAcquirer makeLazyAcquirer(const std::string &service, const ServiceCallback< MReq &, MRes & > &callback, const ros::VoidConstPtr &tracked_object=ros::VoidConstPtr()) const
Creates a function that advertises a ROS service when called.
Wrapper around ROS resources, such as ros::Subscriber and ros::ServiceServer.
void release()
Releases the resource if it's already acquired. shutdown() method in case of ros::Subscriber and ros:...
LazyAcquirer makeLazyAcquirer(const std::string &service, const ServiceCallback< ServiceEvent & > &callback, const ros::VoidConstPtr &tracked_object=ros::VoidConstPtr()) const
Creates a function that advertises a ROS service when called.
boost::function< bool(Args...)> ServiceCallback
Typedef for ROS service callbacks.
LazyAcquirer makeLazyAcquirer(const std::string &service, bool(*srv_func)(ros::ServiceEvent< MReq, MRes > &)) const
Creates a function that advertises a ROS service when called.
LazyAcquirer makeLazyAcquirer(const std::string &service, bool(*srv_func)(MReq &, MRes &)) const
Creates a function that advertises a ROS service when called.
LazyAcquirer makeLazyAcquirer(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj) const
Creates a function that advertises a ROS service when called.
void advertiseService(const ros::NodeHandlePtr &node_handle)
Advertises the ROS service given a node handle.
LazyAcquirer makeLazyAcquirer(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), const boost::shared_ptr< T > &obj) const
Creates a function that advertises a ROS service when called.
void acquire(const ros::NodeHandlePtr &node_handle)
Acquires the resource if it's not already acquired.
Managed<Derived,R> class implements a base class which manages ROS resources, such as ros::Subscriber...