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

Topology Manager of Service related. More...

#include <service_manager.h>

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

Public Types

using RoleAttrVec = std::vector< RoleAttributes >
 
using ServerWarehouse = SingleValueWarehouse
 
using ClientWarehouse = MultiValueWarehouse
 
- 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

 ServiceManager ()
 Construct a new Service Manager object. More...
 
virtual ~ServiceManager ()
 Destroy the Service Manager object. More...
 
bool HasService (const std::string &service_name)
 Inquire whether service_name exists in topology. More...
 
void GetServers (RoleAttrVec *servers)
 Get the All Server in the topology. More...
 
void GetClients (const std::string &service_name, RoleAttrVec *clients)
 Get the Clients object that subscribes service_name 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

◆ ClientWarehouse

◆ RoleAttrVec

◆ ServerWarehouse

Constructor & Destructor Documentation

◆ ServiceManager()

apollo::cyber::service_discovery::ServiceManager::ServiceManager ( )

Construct a new Service Manager object.

◆ ~ServiceManager()

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

Destroy the Service Manager object.

Member Function Documentation

◆ GetClients()

void apollo::cyber::service_discovery::ServiceManager::GetClients ( const std::string &  service_name,
RoleAttrVec clients 
)

Get the Clients object that subscribes service_name

Parameters
service_nameName of service you want to get
clientsresult vector

◆ GetServers()

void apollo::cyber::service_discovery::ServiceManager::GetServers ( RoleAttrVec servers)

Get the All Server in the topology.

Parameters
serversresult RoleAttr vector

◆ HasService()

bool apollo::cyber::service_discovery::ServiceManager::HasService ( const std::string &  service_name)

Inquire whether service_name exists in topology.

Parameters
service_namethe name we inquire
Returns
true if service exists
false if service not exists

Friends And Related Function Documentation

◆ TopologyManager

friend class TopologyManager
friend

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