Apollo  6.0
Open source self driving car software
Public Types | Public Member Functions | Friends | List of all members
apollo::cyber::service_discovery::ChannelManager Class Reference

Topology Manager of Service related. More...

#include <channel_manager.h>

Inheritance diagram for apollo::cyber::service_discovery::ChannelManager:
Inheritance graph
Collaboration diagram for apollo::cyber::service_discovery::ChannelManager:
Collaboration graph

Public Types

using RoleAttrVec = std::vector< proto::RoleAttributes >
 
using WriterWarehouse = MultiValueWarehouse
 
using ReaderWarehouse = MultiValueWarehouse
 
using ExemptedMessageTypes = std::unordered_set< std::string >
 
- Public Types inherited from apollo::cyber::service_discovery::Manager
using ChangeSignal = base::Signal< const ChangeMsg & >
 
using ChangeFunc = std::function< void(const ChangeMsg &)>
 
using ChangeConnection = base::Connection< const ChangeMsg & >
 
using RtpsParticipant = eprosima::fastrtps::Participant
 
using RtpsPublisherAttr = eprosima::fastrtps::PublisherAttributes
 
using RtpsSubscriberAttr = eprosima::fastrtps::SubscriberAttributes
 

Public Member Functions

 ChannelManager ()
 Construct a new Channel Manager object. More...
 
virtual ~ChannelManager ()
 Destroy the Channel Manager object. More...
 
void GetChannelNames (std::vector< std::string > *channels)
 Get all channel names in the topology. More...
 
void GetProtoDesc (const std::string &channel_name, std::string *proto_desc)
 Get the Protocol Desc of channel_name More...
 
void GetMsgType (const std::string &channel_name, std::string *msg_type)
 Get the Msg Type of channel_name More...
 
bool HasWriter (const std::string &channel_name)
 Inquire if there is at least one Writer that publishes channel_name More...
 
void GetWriters (RoleAttrVec *writers)
 Get All Writers object. More...
 
void GetWritersOfNode (const std::string &node_name, RoleAttrVec *writers)
 Get the Writers Of Node object. More...
 
void GetWritersOfChannel (const std::string &channel_name, RoleAttrVec *writers)
 Get the Writers Of Channel object. More...
 
bool HasReader (const std::string &channel_name)
 Inquire if there is at least one Reader that publishes channel_name More...
 
void GetReaders (RoleAttrVec *readers)
 Get All Readers object. More...
 
void GetReadersOfNode (const std::string &node_name, RoleAttrVec *readers)
 Get the Readers Of Node object. More...
 
void GetReadersOfChannel (const std::string &channel_name, RoleAttrVec *readers)
 Get the Readers Of Channel object. More...
 
void GetUpstreamOfNode (const std::string &node_name, RoleAttrVec *upstream_nodes)
 Get the Upstream Of Node object. If Node A has writer that publishes channel-1, and Node B has reader that subscribes channel-1 then A is B's Upstream node, and B is A's Downstream node. More...
 
void GetDownstreamOfNode (const std::string &node_name, RoleAttrVec *downstream_nodes)
 Get the Downstream Of Node object. If Node A has writer that publishes channel-1, and Node B has reader that subscribes channel-1 then A is B's Upstream node, and B is A's Downstream node. More...
 
FlowDirection GetFlowDirection (const std::string &lhs_node_name, const std::string &rhs_node_name)
 Get the Flow Direction from lhs_node_node to rhs_node_name You can see FlowDirection's description for more information. More...
 
bool IsMessageTypeMatching (const std::string &lhs, const std::string &rhs)
 Is lhs and rhs have same MessageType. More...
 
- Public Member Functions inherited from apollo::cyber::service_discovery::Manager
 Manager ()
 Construct a new Manager object. More...
 
virtual ~Manager ()
 Destroy the Manager object. More...
 
bool StartDiscovery (RtpsParticipant *participant)
 Startup topology discovery. More...
 
void StopDiscovery ()
 Stop topology discovery. More...
 
virtual void Shutdown ()
 Shutdown module. More...
 
bool Join (const RoleAttributes &attr, RoleType role, bool need_publish=true)
 Join the topology. More...
 
bool Leave (const RoleAttributes &attr, RoleType role)
 Leave the topology. More...
 
ChangeConnection AddChangeListener (const ChangeFunc &func)
 Add topology change listener, when topology changed, func will be called. More...
 
void RemoveChangeListener (const ChangeConnection &conn)
 Remove our listener for topology change. More...
 

Friends

class TopologyManager
 

Additional Inherited Members

- Protected Member Functions inherited from apollo::cyber::service_discovery::Manager
bool CreatePublisher (RtpsParticipant *participant)
 
bool CreateSubscriber (RtpsParticipant *participant)
 
virtual bool NeedPublish (const ChangeMsg &msg) const
 
void Convert (const RoleAttributes &attr, RoleType role, OperateType opt, ChangeMsg *msg)
 
void Notify (const ChangeMsg &msg)
 
bool Publish (const ChangeMsg &msg)
 
void OnRemoteChange (const std::string &msg_str)
 
bool IsFromSameProcess (const ChangeMsg &msg)
 
- Protected Attributes inherited from apollo::cyber::service_discovery::Manager
std::atomic< bool > is_shutdown_
 
std::atomic< bool > is_discovery_started_
 
int allowed_role_
 
ChangeType change_type_
 
std::string host_name_
 
int process_id_
 
std::string channel_name_
 
eprosima::fastrtps::Publisher * publisher_
 
std::mutex lock_
 
eprosima::fastrtps::Subscriber * subscriber_
 
SubscriberListenerlistener_
 
ChangeSignal signal_
 

Detailed Description

Topology Manager of Service related.

Member Typedef Documentation

◆ ExemptedMessageTypes

◆ ReaderWarehouse

◆ RoleAttrVec

using apollo::cyber::service_discovery::ChannelManager::RoleAttrVec = std::vector<proto::RoleAttributes>

◆ WriterWarehouse

Constructor & Destructor Documentation

◆ ChannelManager()

apollo::cyber::service_discovery::ChannelManager::ChannelManager ( )

Construct a new Channel Manager object.

◆ ~ChannelManager()

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

Destroy the Channel Manager object.

Member Function Documentation

◆ GetChannelNames()

void apollo::cyber::service_discovery::ChannelManager::GetChannelNames ( std::vector< std::string > *  channels)

Get all channel names in the topology.

Parameters
channelsresult vector

◆ GetDownstreamOfNode()

void apollo::cyber::service_discovery::ChannelManager::GetDownstreamOfNode ( const std::string &  node_name,
RoleAttrVec downstream_nodes 
)

Get the Downstream Of Node object. If Node A has writer that publishes channel-1, and Node B has reader that subscribes channel-1 then A is B's Upstream node, and B is A's Downstream node.

Parameters
node_namenode's name we want to inquire
downstream_nodesresult RoleAttribute vector

◆ GetFlowDirection()

FlowDirection apollo::cyber::service_discovery::ChannelManager::GetFlowDirection ( const std::string &  lhs_node_name,
const std::string &  rhs_node_name 
)

Get the Flow Direction from lhs_node_node to rhs_node_name You can see FlowDirection's description for more information.

Returns
FlowDirection result direction

◆ GetMsgType()

void apollo::cyber::service_discovery::ChannelManager::GetMsgType ( const std::string &  channel_name,
std::string *  msg_type 
)

Get the Msg Type of channel_name

Parameters
channel_namechannel name we want to inquire
msg_typeresult string, empty if inquire failed

◆ GetProtoDesc()

void apollo::cyber::service_discovery::ChannelManager::GetProtoDesc ( const std::string &  channel_name,
std::string *  proto_desc 
)

Get the Protocol Desc of channel_name

Parameters
channel_namechannel name we want to inquire
proto_descresult string, empty if inquire failed

◆ GetReaders()

void apollo::cyber::service_discovery::ChannelManager::GetReaders ( RoleAttrVec readers)

Get All Readers object.

Parameters
readersresult RoleAttr vector

◆ GetReadersOfChannel()

void apollo::cyber::service_discovery::ChannelManager::GetReadersOfChannel ( const std::string &  channel_name,
RoleAttrVec readers 
)

Get the Readers Of Channel object.

Parameters
channel_namechannel's name we want to inquire
readersresult RoleAttribute vector

◆ GetReadersOfNode()

void apollo::cyber::service_discovery::ChannelManager::GetReadersOfNode ( const std::string &  node_name,
RoleAttrVec readers 
)

Get the Readers Of Node object.

Parameters
node_namenode's name we want to inquire
readersresult RoleAttribute vector

◆ GetUpstreamOfNode()

void apollo::cyber::service_discovery::ChannelManager::GetUpstreamOfNode ( const std::string &  node_name,
RoleAttrVec upstream_nodes 
)

Get the Upstream Of Node object. If Node A has writer that publishes channel-1, and Node B has reader that subscribes channel-1 then A is B's Upstream node, and B is A's Downstream node.

Parameters
node_namenode's name we want to inquire
upstream_nodesresult RoleAttribute vector

◆ GetWriters()

void apollo::cyber::service_discovery::ChannelManager::GetWriters ( RoleAttrVec writers)

Get All Writers object.

Parameters
writersresult RoleAttr vector

◆ GetWritersOfChannel()

void apollo::cyber::service_discovery::ChannelManager::GetWritersOfChannel ( const std::string &  channel_name,
RoleAttrVec writers 
)

Get the Writers Of Channel object.

Parameters
channel_namechannel's name we want to inquire
writersresult RoleAttribute vector

◆ GetWritersOfNode()

void apollo::cyber::service_discovery::ChannelManager::GetWritersOfNode ( const std::string &  node_name,
RoleAttrVec writers 
)

Get the Writers Of Node object.

Parameters
node_namenode's name we want to inquire
writersresult RoleAttribute vector

◆ HasReader()

bool apollo::cyber::service_discovery::ChannelManager::HasReader ( const std::string &  channel_name)

Inquire if there is at least one Reader that publishes channel_name

Parameters
channel_namechannel name we want to inquire
Returns
true if there is at least one Reader
false if there are no Reader

◆ HasWriter()

bool apollo::cyber::service_discovery::ChannelManager::HasWriter ( const std::string &  channel_name)

Inquire if there is at least one Writer that publishes channel_name

Parameters
channel_namechannel name we want to inquire
Returns
true if there is at least one Writer
false if there are no Writers

◆ IsMessageTypeMatching()

bool apollo::cyber::service_discovery::ChannelManager::IsMessageTypeMatching ( const std::string &  lhs,
const std::string &  rhs 
)

Is lhs and rhs have same MessageType.

Parameters
lhsthe left message type to compare
rhsthe right message type to compare
Returns
true if type matches
false if type does not matches

Friends And Related Function Documentation

◆ TopologyManager

friend class TopologyManager
friend

The documentation for this class was generated from the following file: