Apollo  6.0
Open source self driving car software
Public Types | Public Member Functions | List of all members
apollo::cyber::Service< Request, Response > Class Template Reference

Service handles Request from the Client, and send a Response to it. More...

#include <service.h>

Inheritance diagram for apollo::cyber::Service< Request, Response >:
Inheritance graph
Collaboration diagram for apollo::cyber::Service< Request, Response >:
Collaboration graph

Public Types

using ServiceCallback = std::function< void(const std::shared_ptr< Request > &, std::shared_ptr< Response > &)>
 

Public Member Functions

 Service (const std::string &node_name, const std::string &service_name, const ServiceCallback &service_callback)
 Construct a new Service object. More...
 
 Service (const std::string &node_name, const std::string &service_name, ServiceCallback &&service_callback)
 Construct a new Service object. More...
 
 Service ()=delete
 Forbid default constructing. More...
 
 ~Service ()
 
bool Init ()
 Init the Service. More...
 
void destroy ()
 Destroy the Service. More...
 
- Public Member Functions inherited from apollo::cyber::ServiceBase
 ServiceBase (const std::string &service_name)
 Construct a new Service Base object. More...
 
virtual ~ServiceBase ()
 
const std::string & service_name () const
 Get the service name. More...
 

Additional Inherited Members

- Protected Attributes inherited from apollo::cyber::ServiceBase
std::string service_name_
 

Detailed Description

template<typename Request, typename Response>
class apollo::cyber::Service< Request, Response >

Service handles Request from the Client, and send a Response to it.

Template Parameters
Requestthe request type
Responsethe response type

Member Typedef Documentation

◆ ServiceCallback

template<typename Request, typename Response>
using apollo::cyber::Service< Request, Response >::ServiceCallback = std::function<void(const std::shared_ptr<Request>&, std::shared_ptr<Response>&)>

Constructor & Destructor Documentation

◆ Service() [1/3]

template<typename Request, typename Response>
apollo::cyber::Service< Request, Response >::Service ( const std::string &  node_name,
const std::string &  service_name,
const ServiceCallback service_callback 
)
inline

Construct a new Service object.

Parameters
node_nameused to fill RoleAttribute when join the topology
service_namethe service name we provide
service_callbackreference of ServiceCallback object

◆ Service() [2/3]

template<typename Request, typename Response>
apollo::cyber::Service< Request, Response >::Service ( const std::string &  node_name,
const std::string &  service_name,
ServiceCallback &&  service_callback 
)
inline

Construct a new Service object.

Parameters
node_nameused to fill RoleAttribute when join the topology
service_namethe service name we provide
service_callbackrvalue reference of ServiceCallback object

◆ Service() [3/3]

template<typename Request, typename Response>
apollo::cyber::Service< Request, Response >::Service ( )
delete

Forbid default constructing.

◆ ~Service()

template<typename Request, typename Response>
apollo::cyber::Service< Request, Response >::~Service ( )
inline

Member Function Documentation

◆ destroy()

template<typename Request , typename Response >
void apollo::cyber::Service< Request, Response >::destroy ( )
virtual

Destroy the Service.

Implements apollo::cyber::ServiceBase.

◆ Init()

template<typename Request , typename Response >
bool apollo::cyber::Service< Request, Response >::Init ( )

Init the Service.


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