SMACC2
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
smacc2::client_behaviors::CbServiceCall< ServiceType > Class Template Reference

#include <cb_call_service.hpp>

Inheritance diagram for smacc2::client_behaviors::CbServiceCall< ServiceType >:
Inheritance graph
Collaboration diagram for smacc2::client_behaviors::CbServiceCall< ServiceType >:
Collaboration graph

Public Member Functions

 CbServiceCall (const char *serviceName)
 
 CbServiceCall (const char *serviceName, std::shared_ptr< typename ServiceType::Request >)
 
void onEntry () override
 
- Public Member Functions inherited from smacc2::SmaccAsyncClientBehavior
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
virtual ~SmaccAsyncClientBehavior ()
 
template<typename TCallback , typename T >
boost::signals2::connection onSuccess (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFinished (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFailure (TCallback callback, T *object)
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 

Public Attributes

std::shared_ptr< typename ServiceType::Response > result_
 

Protected Member Functions

void onServiceResponse (typename rclcpp::Client< ServiceType >::SharedFuture result)
 
- Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior
void postSuccessEvent ()
 
void postFailureEvent ()
 
virtual void dispose () override
 
bool isShutdownRequested ()
 
- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode ()
 
virtual rclcpp::Logger getLogger ()
 

Protected Attributes

std::shared_ptr< rclcpp::Client< ServiceType > > client_
 
std::string serviceName_
 
std::shared_ptr< typename ServiceType::Request > request_
 

Detailed Description

template<typename ServiceType>
class smacc2::client_behaviors::CbServiceCall< ServiceType >

Definition at line 29 of file cb_call_service.hpp.

Constructor & Destructor Documentation

◆ CbServiceCall() [1/2]

template<typename ServiceType >
smacc2::client_behaviors::CbServiceCall< ServiceType >::CbServiceCall ( const char *  serviceName)
inline

Definition at line 32 of file cb_call_service.hpp.

32: serviceName_(serviceName) {}

◆ CbServiceCall() [2/2]

template<typename ServiceType >
smacc2::client_behaviors::CbServiceCall< ServiceType >::CbServiceCall ( const char *  serviceName,
std::shared_ptr< typename ServiceType::Request >   
)
inline

Definition at line 34 of file cb_call_service.hpp.

35 : serviceName_(serviceName)
36 {
37 }

Member Function Documentation

◆ onEntry()

template<typename ServiceType >
void smacc2::client_behaviors::CbServiceCall< ServiceType >::onEntry ( )
inlineoverridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 39 of file cb_call_service.hpp.

40 {
41 RCLCPP_INFO_STREAM(
42 getLogger(), "[" << this->getName() << "] creating service client: " << serviceName_);
43
44 client_ = getNode()->create_client<ServiceType>(serviceName_);
45
46 result_ = client_->async_send_request(request_).get();
47
48 //, std::bind(&CbServiceCall<ServiceType>::onServiceResponse, this, std::placeholders::_1));
49 }
virtual rclcpp::Node::SharedPtr getNode()
std::shared_ptr< typename ServiceType::Response > result_
std::shared_ptr< typename ServiceType::Request > request_
std::shared_ptr< rclcpp::Client< ServiceType > > client_

References smacc2::client_behaviors::CbServiceCall< ServiceType >::client_, smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getNode(), smacc2::client_behaviors::CbServiceCall< ServiceType >::request_, smacc2::client_behaviors::CbServiceCall< ServiceType >::result_, and smacc2::client_behaviors::CbServiceCall< ServiceType >::serviceName_.

Referenced by cl_nav2z::CbResumeSlam::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onServiceResponse()

template<typename ServiceType >
void smacc2::client_behaviors::CbServiceCall< ServiceType >::onServiceResponse ( typename rclcpp::Client< ServiceType >::SharedFuture  result)
inlineprotected

Definition at line 59 of file cb_call_service.hpp.

60 {
61 result_ = result;
62 }

References smacc2::client_behaviors::CbServiceCall< ServiceType >::result_.

Member Data Documentation

◆ client_

template<typename ServiceType >
std::shared_ptr<rclcpp::Client<ServiceType> > smacc2::client_behaviors::CbServiceCall< ServiceType >::client_
protected

◆ request_

template<typename ServiceType >
std::shared_ptr<typename ServiceType::Request> smacc2::client_behaviors::CbServiceCall< ServiceType >::request_
protected

◆ result_

template<typename ServiceType >
std::shared_ptr<typename ServiceType::Response> smacc2::client_behaviors::CbServiceCall< ServiceType >::result_

◆ serviceName_

template<typename ServiceType >
std::string smacc2::client_behaviors::CbServiceCall< ServiceType >::serviceName_
protected

The documentation for this class was generated from the following file: