Apollo  6.0
Open source self driving car software
node_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_NODE_MANAGER_H_
18 #define CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_NODE_MANAGER_H_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
27 
28 namespace apollo {
29 namespace cyber {
30 namespace service_discovery {
31 
32 class TopologyManager;
33 
38 class NodeManager : public Manager {
39  friend class TopologyManager;
40 
41  public:
42  using RoleAttrVec = std::vector<RoleAttributes>;
44 
48  NodeManager();
49 
53  virtual ~NodeManager();
54 
62  bool HasNode(const std::string& node_name);
63 
69  void GetNodes(RoleAttrVec* nodes);
70 
71  private:
72  bool Check(const RoleAttributes& attr) override;
73  void Dispose(const ChangeMsg& msg) override;
74  void OnTopoModuleLeave(const std::string& host_name, int process_id) override;
75 
76  void DisposeJoin(const ChangeMsg& msg);
77  void DisposeLeave(const ChangeMsg& msg);
78 
79  NodeWarehouse nodes_;
80 };
81 
82 } // namespace service_discovery
83 } // namespace cyber
84 } // namespace apollo
85 
86 #endif // CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_NODE_MANAGER_H_
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Topology Manager of Node related.
Definition: node_manager.h:38
elements in Cyber – Node, Channel, Service, Writer, Reader, Client and Server&#39;s relationship is pres...
Definition: topology_manager.h:64
Base class for management of Topology elements. Manager can Join/Leave the Topology, and Listen the topology change.
Definition: manager.h:51
NodeManager()
Construct a new Node Manager object.
void GetNodes(RoleAttrVec *nodes)
Get the Nodes object.
bool HasNode(const std::string &node_name)
Checkout whether we have node_name in topology.
std::vector< RoleAttributes > RoleAttrVec
Definition: node_manager.h:42
Definition: single_value_warehouse.h:31
virtual ~NodeManager()
Destroy the Node Manager object.