17#ifndef CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_MANAGER_H_
18#define CYBER_SERVICE_DISCOVERY_SPECIFIC_MANAGER_MANAGER_H_
25#include "fastrtps/Domain.h"
26#include "fastrtps/attributes/PublisherAttributes.h"
27#include "fastrtps/attributes/SubscriberAttributes.h"
28#include "fastrtps/participant/Participant.h"
29#include "fastrtps/publisher/Publisher.h"
30#include "fastrtps/subscriber/Subscriber.h"
33#include "cyber/proto/topology_change.pb.h"
38namespace service_discovery {
40using proto::ChangeMsg;
43using proto::RoleAttributes;
100 bool need_publish =
true);
Base class for management of Topology elements.
void Notify(const ChangeMsg &msg)
bool StartDiscovery(RtpsParticipant *participant)
Startup topology discovery
void Convert(const RoleAttributes &attr, RoleType role, OperateType opt, ChangeMsg *msg)
eprosima::fastrtps::PublisherAttributes RtpsPublisherAttr
std::function< void(const ChangeMsg &)> ChangeFunc
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_
eprosima::fastrtps::Subscriber * subscriber_
virtual ~Manager()
Destroy the Manager object
virtual void Dispose(const ChangeMsg &msg)=0
bool CreatePublisher(RtpsParticipant *participant)
eprosima::fastrtps::Participant RtpsParticipant
bool CreateSubscriber(RtpsParticipant *participant)
std::atomic< bool > is_discovery_started_
Manager()
Construct a new Manager object
void OnRemoteChange(const std::string &msg_str)
SubscriberListener * listener_
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.
eprosima::fastrtps::Publisher * publisher_
bool Leave(const RoleAttributes &attr, RoleType role)
Leave the topology
eprosima::fastrtps::SubscriberAttributes RtpsSubscriberAttr
virtual bool Check(const RoleAttributes &attr)=0
void StopDiscovery()
Stop topology discovery
virtual bool NeedPublish(const ChangeMsg &msg) const
virtual void Shutdown()
Shutdown module