Apollo 10.0
自动驾驶开放平台
service_manager.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#ifndef CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_SERVICE_MANAGER_H_
18#define CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_SERVICE_MANAGER_H_
19
20#include <memory>
21#include <string>
22#include <vector>
23
28
29namespace apollo {
30namespace cyber {
31namespace service_discovery {
32
33class TopologyManager;
34
39class ServiceManager : public Manager {
40 friend class TopologyManager;
41
42 public:
43 using RoleAttrVec = std::vector<RoleAttributes>;
46
51
55 virtual ~ServiceManager();
56
64 bool HasService(const std::string& service_name);
65
71 void GetServers(RoleAttrVec* servers);
72
79 void GetClients(const std::string& service_name, RoleAttrVec* clients);
80
81 private:
82 bool Check(const RoleAttributes& attr) override;
83 void Dispose(const ChangeMsg& msg) override;
84 void OnTopoModuleLeave(const std::string& host_name, int process_id) override;
85
86 void DisposeJoin(const ChangeMsg& msg);
87 void DisposeLeave(const ChangeMsg& msg);
88
89 ServerWarehouse servers_;
90 ClientWarehouse clients_;
91};
92
93} // namespace service_discovery
94} // namespace cyber
95} // namespace apollo
96
97#endif // CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_SERVICE_MANAGER_H_
Base class for management of Topology elements.
Definition manager.h:54
Topology Manager of Service related
bool HasService(const std::string &service_name)
Inquire whether service_name exists in topology
virtual ~ServiceManager()
Destroy the Service Manager object
void GetClients(const std::string &service_name, RoleAttrVec *clients)
Get the Clients object that subscribes service_name
ServiceManager()
Construct a new Service Manager object
void GetServers(RoleAttrVec *servers)
Get the All Server in the topology
elements in Cyber – Node, Channel, Service, Writer, Reader, Client and Server's relationship is prese...
class register implement
Definition arena_queue.h:37