9 #include "Federate.hpp"
10 #include "data_view.hpp"
17 class MessageFederateManager;
38 const std::shared_ptr<Core>& core,
56 MessageFederate(
const std::string& name,
const std::string& configString);
88 virtual void startupToInitializeStateTransition()
override;
89 virtual void initializeToExecuteStateTransition(
iteration_result result)
override;
90 virtual void updateTime(
Time newTime,
Time oldTime)
override;
91 virtual std::string localQuery(
const std::string& queryStr)
const override;
99 Endpoint& registerEndpoint(
const std::string& eptName = std::string(),
100 const std::string& type = std::string());
108 Endpoint& registerGlobalEndpoint(
const std::string& eptName,
109 const std::string& type = std::string());
119 const std::string& type = std::string())
121 return registerGlobalEndpoint(eptName +
'_' + std::to_string(index1), type);
124 virtual void registerInterfaces(
const std::string& configString)
override;
131 void registerMessageInterfaces(
const std::string& configString);
138 void registerMessageInterfacesJson(
const std::string& jsonString);
144 void registerMessageInterfacesToml(
const std::string& tomlString);
153 void registerKnownCommunicationPath(
const Endpoint& localEndpoint,
154 const std::string& remoteEndpoint);
159 void subscribe(
const Endpoint& ept,
const std::string& key);
161 bool hasMessage()
const;
163 bool hasMessage(
const Endpoint& ept)
const;
168 uint64_t pendingMessages(
const Endpoint& ept)
const;
172 uint64_t pendingMessages()
const;
176 std::unique_ptr<Message> getMessage(
const Endpoint& ept);
181 std::unique_ptr<Message> getMessage();
191 const std::string& dest,
203 void sendMessage(
const Endpoint& source,
const std::string& dest,
const data_view& message);
213 const std::string& dest,
218 sendMessage(source, dest,
data_view(
data, dataLength), sendTime);
227 void sendMessage(
const Endpoint& source,
228 const std::string& dest,
236 void sendMessage(
const Endpoint& source, std::unique_ptr<Message> message);
248 Endpoint& getEndpoint(
const std::string& name)
const;
253 Endpoint& getEndpoint(
int index)
const;
258 void setMessageNotificationCallback(
const std::function<
void(
Endpoint&,
Time)>& callback);
263 void setMessageNotificationCallback(
const Endpoint& ept,
267 void addSourceFilter(
const Endpoint& ept,
const std::string& filterName);
269 void addDestinationFilter(
const Endpoint& ept,
const std::string& filterName);
271 virtual void disconnect()
override;
274 int getEndpointCount()
const;
278 std::unique_ptr<MessageFederateManager> mfManager;