17#ifndef CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_MANAGER_H_
18#define CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_MANAGER_H_
28#include "fastdds/dds/publisher/qos/PublisherQos.hpp"
29#include "fastdds/dds/subscriber/qos/SubscriberQos.hpp"
31#include "cyber/proto/topology_change.pb.h"
41namespace service_discovery {
43using proto::ChangeMsg;
46using proto::RoleAttributes;
101 bool need_publish =
true);
Base class for management of Topology elements.
void Notify(const ChangeMsg &msg)
void Convert(const RoleAttributes &attr, RoleType role, OperateType opt, ChangeMsg *msg)
std::function< void(const ChangeMsg &)> ChangeFunc
std::shared_ptr< transport::Participant > ParticipantPtr
bool Join(const RoleAttributes &attr, RoleType role, bool need_publish=true)
Join the topology
std::atomic< bool > is_shutdown_
bool IsFromSameProcess(const ChangeMsg &msg)
bool Publish(const ChangeMsg &msg)
void RemoveChangeListener(const ChangeConnection &conn)
Remove our listener for topology change.
std::string channel_name_
SubscriberPtr subscriber_
bool StartDiscovery(const ParticipantPtr &participant)
Startup topology discovery
std::shared_ptr< transport::Publisher > PublisherPtr
bool CreateSubscriber(const ParticipantPtr &participant)
virtual ~Manager()
Destroy the Manager object
virtual void Dispose(const ChangeMsg &msg)=0
void OnRemoteChange(const std::shared_ptr< std::string > &msg_str)
std::atomic< bool > is_discovery_started_
Manager()
Construct a new Manager object
virtual void OnTopoModuleLeave(const std::string &host_name, int process_id)=0
Called when a process' topology manager instance leave
ChangeConnection AddChangeListener(const ChangeFunc &func)
Add topology change listener, when topology changed, func will be called.
std::shared_ptr< transport::Subscriber > SubscriberPtr
bool Leave(const RoleAttributes &attr, RoleType role)
Leave the topology
virtual bool Check(const RoleAttributes &attr)=0
ParticipantPtr participant_
void StopDiscovery()
Stop topology discovery
virtual bool NeedPublish(const ChangeMsg &msg) const
virtual void Shutdown()
Shutdown module
bool CreatePublisher(const ParticipantPtr &participant)