17 #ifndef CYBER_NODE_NODE_SERVICE_IMPL_H_ 18 #define CYBER_NODE_NODE_SERVICE_IMPL_H_ 49 : node_name_(node_name) {
52 attr_.set_node_name(node_name);
54 attr_.set_node_id(node_id);
69 template <
typename Request,
typename Response>
70 auto CreateService(
const std::string& service_name,
73 typename std::shared_ptr<Service<Request, Response>>;
75 template <
typename Request,
typename Response>
76 auto CreateClient(
const std::string& service_name) ->
77 typename std::shared_ptr<Client<Request, Response>>;
79 std::vector<std::weak_ptr<ServiceBase>> service_list_;
80 std::vector<std::weak_ptr<ClientBase>> client_list_;
81 std::string node_name_;
82 proto::RoleAttributes attr_;
85 template <
typename Request,
typename Response>
86 auto NodeServiceImpl::CreateService(
87 const std::string& service_name,
90 typename std::shared_ptr<Service<Request, Response>> {
91 auto service_ptr = std::make_shared<Service<Request, Response>>(
92 node_name_, service_name, service_callback);
95 service_list_.emplace_back(service_ptr);
96 attr_.set_service_name(service_name);
98 attr_.set_service_id(service_id);
100 attr_, RoleType::ROLE_SERVER);
104 template <
typename Request,
typename Response>
105 auto NodeServiceImpl::CreateClient(
const std::string& service_name) ->
106 typename std::shared_ptr<Client<Request, Response>> {
108 std::make_shared<Client<Request, Response>>(node_name_, service_name);
111 client_list_.emplace_back(client_ptr);
112 attr_.set_service_name(service_name);
114 attr_.set_service_id(service_id);
116 attr_, RoleType::ROLE_CLIENT);
123 #endif // CYBER_NODE_NODE_SERVICE_IMPL_H_
NodeServiceImpl()=delete
Forbid default-constructor.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
#define RETURN_VAL_IF(condition, val)
Definition: log.h:114
NodeServiceImpl(const std::string &node_name)
Construct a new Node Service Impl object.
Definition: node_service_impl.h:48
static uint64_t RegisterNode(const std::string &node_name)
std::function< void(const std::shared_ptr< Request > &, std::shared_ptr< Response > &)> ServiceCallback
Definition: service.h:45
Node is the fundamental building block of Cyber RT. every module contains and communicates through th...
Definition: node.h:44
static uint64_t RegisterService(const std::string &service)
~NodeServiceImpl()
Destroy the Node Service Impl object.
Definition: node_service_impl.h:66
The implementation for Node to create Objects connected by Param. e.g. Param Server and Client...
Definition: node_service_impl.h:39