Implementation of Managed class for ros::ServiceServer. More...
#include <managed_serviceserver.h>
Public Member Functions | |
void | advertiseService (const ros::NodeHandlePtr &node_handle) |
Advertises the ROS service given a node handle. | |
template<class MReq , class MRes > | |
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. | |
template<class ServiceEvent > | |
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. | |
template<class T , class MReq , class MRes > | |
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. | |
template<class T , class MReq , class MRes > | |
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. | |
template<class T , class MReq , class MRes > | |
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. | |
template<class T , class MReq , class MRes > | |
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. | |
template<class MReq , class MRes > | |
LazyAcquirer | makeLazyAcquirer (const std::string &service, bool(*srv_func)(MReq &, MRes &)) const |
Creates a function that advertises a ROS service when called. | |
template<class MReq , class MRes > | |
LazyAcquirer | makeLazyAcquirer (const std::string &service, bool(*srv_func)(ros::ServiceEvent< MReq, MRes > &)) const |
Creates a function that advertises a ROS service when called. | |
void | shutdown () |
Shutdowns the ROS service. | |
Private Member Functions | |
template<typename... Args> | |
ServiceCallback< Args...> | wrapServiceCallback (const ServiceCallback< Args...> &callback) const |
Wraps the service callback. |
Implementation of Managed class for ros::ServiceServer.
Adds additional functionality to ros::ServiceServer resource by wrapping it. The service server can be shutdowned, advertised and paused. Shutting down has the same effect as in ROS, while advertising does not require any arguments, since they are passed in the inherited constructor. Pausing the service, will cause the callback to return false immediately.
Definition at line 71 of file managed_serviceserver.h.
void robot_activity::resource::ManagedServiceServer::advertiseService | ( | const ros::NodeHandlePtr & | node_handle | ) | [inline] |
Advertises the ROS service given a node handle.
Since the ROS service is fully desribed upon instantiation, advertising only requires a node handle. The function is idempotent and can be called multiple times without any side-effect. The service can also be re-advertised after being shutdowned without respecifying arguments describing the service.
node_handle | Node handle required for the actual call to ros::NodeHandle::advertiseService embedded inside |
Definition at line 102 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
const ServiceCallback< MReq &, MRes & > & | callback, | ||
const ros::VoidConstPtr & | tracked_object = ros::VoidConstPtr() |
||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
callback | Service callback specified as boost::function accepting two arguments |
tracked_object | Object to be tracked, whose destruction will terminate the service |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 142 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
const ServiceCallback< ServiceEvent & > & | callback, | ||
const ros::VoidConstPtr & | tracked_object = ros::VoidConstPtr() |
||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
callback | Service callback specified as boost::function accepting one argument |
tracked_object | Object to be tracked, whose destruction will terminate the service |
ServiceEvent | Service callback's event message type |
Definition at line 173 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
bool(T::*)(MReq &, MRes &) | srv_func, | ||
T * | obj | ||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
srv_func | Pointer to a member function of class T, which accepts two arguments: message request and response and returns a bool |
obj | Object to be used when calling the pointed function |
T | Class, where the member function is defined |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 206 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
bool(T::*)(ros::ServiceEvent< MReq, MRes > &) | srv_func, | ||
T * | obj | ||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
srv_func | Pointer to a member function of class T, which accepts one argument: service event and returns a bool |
obj | Raw pointer to the object to be used when calling the pointed function |
T | Class, where the member function is defined |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 233 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
bool(T::*)(MReq &, MRes &) | srv_func, | ||
const boost::shared_ptr< T > & | obj | ||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
srv_func | Pointer to a member function of class T, which accepts two arguments: message request and response and returns a bool |
obj | boost::shared_ptr to the object to be used when calling the pointed function, it will also be treated as the tracked object, whose destruction will trigger a service shutdown |
T | Class, where the the member function is defined |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 263 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
bool(T::*)(ros::ServiceEvent< MReq, MRes > &) | srv_func, | ||
const boost::shared_ptr< T > & | obj | ||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
srv_func | Pointer to a member function of class T, which accepts one argument: a service event and returns a bool |
obj | boost::shared_ptr to the object to be used when calling the pointed function, it will also be treated as the tracked object, whose destruction will trigger a service shutdown |
T | Class, where the the member function is defined |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 292 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
bool(*)(MReq &, MRes &) | srv_func | ||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
srv_func | Pointer to a function, which accepts two arguments: message request and response and returns a bool |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 318 of file managed_serviceserver.h.
LazyAcquirer robot_activity::resource::ManagedServiceServer::makeLazyAcquirer | ( | const std::string & | service, |
bool(*)(ros::ServiceEvent< MReq, MRes > &) | srv_func | ||
) | const [inline] |
Creates a function that advertises a ROS service when called.
Returns a lambda, which given a node handle will advertise the ROS service. This lambda is called during advertiseService call and the result is assigned as the managed resource, which in this case is ros::ServiceServer
service | Name of the service to be advertised |
srv_func | Pointer to a function, which accepts one argument: service event and returns a bool |
MReq | Service callback's message request type |
MRes | Service callback's message response type |
Definition at line 341 of file managed_serviceserver.h.
void robot_activity::resource::ManagedServiceServer::shutdown | ( | ) | [inline] |
Shutdowns the ROS service.
Has the same effect as ros::ServiceServer::shutdown function if the service was advertised, otherwise does not have any effect
Definition at line 113 of file managed_serviceserver.h.
ServiceCallback<Args...> robot_activity::resource::ManagedServiceServer::wrapServiceCallback | ( | const ServiceCallback< Args...> & | callback | ) | const [inline, private] |
Wraps the service callback.
Allows for pausing/resuming the servce by adding a check at run-time. If paused, the service will return false immediately.
callback | [description] |
Definition at line 386 of file managed_serviceserver.h.