Apollo  6.0
Open source self driving car software
service_manager.h
Go to the documentation of this file.
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 
29 namespace apollo {
30 namespace cyber {
31 namespace service_discovery {
32 
33 class TopologyManager;
34 
39 class 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_
virtual ~ServiceManager()
Destroy the Service Manager object.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
ServiceManager()
Construct a new Service Manager object.
elements in Cyber – Node, Channel, Service, Writer, Reader, Client and Server&#39;s relationship is pres...
Definition: topology_manager.h:64
bool HasService(const std::string &service_name)
Inquire whether service_name exists in topology.
void GetServers(RoleAttrVec *servers)
Get the All Server in the topology.
Base class for management of Topology elements. Manager can Join/Leave the Topology, and Listen the topology change.
Definition: manager.h:51
std::vector< RoleAttributes > RoleAttrVec
Definition: service_manager.h:43
Topology Manager of Service related.
Definition: service_manager.h:39
void GetClients(const std::string &service_name, RoleAttrVec *clients)
Get the Clients object that subscribes service_name
Definition: multi_value_warehouse.h:31
Definition: single_value_warehouse.h:31