Apollo 10.0
自动驾驶开放平台
apollo::cyber::service_discovery::TopologyManager类 参考

elements in Cyber – Node, Channel, Service, Writer, Reader, Client and Server's relationship is presented by Topology. 更多...

#include <topology_manager.h>

apollo::cyber::service_discovery::TopologyManager 的协作图:

Public 类型

using ChangeSignal = base::Signal< const ChangeMsg & >
 
using ChangeFunc = std::function< void(const ChangeMsg &)>
 
using ChangeConnection = base::Connection< const ChangeMsg & >
 
using ParticipantPtr = std::shared_ptr< transport::Participant >
 
using PartNameContainer = std::map< eprosima::fastrtps::rtps::GUID_t, std::string >
 

Public 成员函数

virtual ~TopologyManager ()
 
void Shutdown ()
 Shutdown the TopologyManager
 
ChangeConnection AddChangeListener (const ChangeFunc &func)
 To observe the topology change, you can register a ChangeFunc
 
void RemoveChangeListener (const ChangeConnection &conn)
 Remove the observe function connect to change_signal_ by conn
 
NodeManagerPtrnode_manager ()
 Get shared_ptr for NodeManager
 
ChannelManagerPtrchannel_manager ()
 Get shared_ptr for ChannelManager
 
ServiceManagerPtrservice_manager ()
 Get shared_ptr for ServiceManager
 

详细描述

elements in Cyber – Node, Channel, Service, Writer, Reader, Client and Server's relationship is presented by Topology.

You can Imagine that a directed graph – Node is the container of Server/Client/Writer/Reader, and they are the vertice of the graph and Channel is the Edge from Writer flow to the Reader, Service is the Edge from Server to Client. Thus we call Writer and Server Upstream, Reader and Client Downstream To generate this graph, we use TopologyManager, it has three sub managers – NodeManager: You can find Nodes in this topology ChannelManager: You can find Channels in this topology, and their Writers and Readers ServiceManager: You can find Services in this topology, and their Servers and Clients TopologyManager use fast-rtps' Participant to communicate. It can broadcast Join or Leave messages of those elements. Also, you can register you own ChangeFunc to monitor topology change

在文件 topology_manager.h64 行定义.

成员类型定义说明

◆ ChangeConnection

◆ ChangeFunc

在文件 topology_manager.h67 行定义.

◆ ChangeSignal

◆ ParticipantPtr

◆ PartNameContainer

using apollo::cyber::service_discovery::TopologyManager::PartNameContainer = std::map<eprosima::fastrtps::rtps::GUID_t, std::string>

在文件 topology_manager.h70 行定义.

构造及析构函数说明

◆ ~TopologyManager()

apollo::cyber::service_discovery::TopologyManager::~TopologyManager ( )
virtual

在文件 topology_manager.cc36 行定义.

36{ Shutdown(); }
void Shutdown()
Shutdown the TopologyManager

成员函数说明

◆ AddChangeListener()

TopologyManager::ChangeConnection apollo::cyber::service_discovery::TopologyManager::AddChangeListener ( const ChangeFunc func)

To observe the topology change, you can register a ChangeFunc

参数
funcis the observe function
返回
ChangeConnection is the connection that connected to change_signal_. Used to Remove your observe function

在文件 topology_manager.cc53 行定义.

54 {
55 return change_signal_.Connect(func);
56}
ConnectionType Connect(const Callback &cb)
Definition signal.h:65

◆ channel_manager()

ChannelManagerPtr & apollo::cyber::service_discovery::TopologyManager::channel_manager ( )
inline

Get shared_ptr for ChannelManager

在文件 topology_manager.h102 行定义.

102{ return channel_manager_; }

◆ node_manager()

NodeManagerPtr & apollo::cyber::service_discovery::TopologyManager::node_manager ( )
inline

Get shared_ptr for NodeManager

在文件 topology_manager.h97 行定义.

97{ return node_manager_; }

◆ RemoveChangeListener()

void apollo::cyber::service_discovery::TopologyManager::RemoveChangeListener ( const ChangeConnection conn)

Remove the observe function connect to change_signal_ by conn

在文件 topology_manager.cc58 行定义.

58 {
59 auto local_conn = conn;
60 local_conn.Disconnect();
61}

◆ service_manager()

ServiceManagerPtr & apollo::cyber::service_discovery::TopologyManager::service_manager ( )
inline

Get shared_ptr for ServiceManager

在文件 topology_manager.h107 行定义.

107{ return service_manager_; }

◆ Shutdown()

void apollo::cyber::service_discovery::TopologyManager::Shutdown ( )

Shutdown the TopologyManager

在文件 topology_manager.cc38 行定义.

38 {
39 ADEBUG << "topology shutdown.";
40 // avoid shutdown twice
41 if (!init_.exchange(false)) {
42 return;
43 }
44
45 node_manager_->Shutdown();
46 channel_manager_->Shutdown();
47 service_manager_->Shutdown();
48 participant_->Shutdown();
49
50 change_signal_.DisconnectAllSlots();
51}
#define ADEBUG
Definition log.h:41

该类的文档由以下文件生成: