9 #include "Endpoints.hpp"
10 #include "Federate.hpp"
11 #include "data_view.hpp"
16 #include <string_view>
19 class MessageFederateManager;
40 const std::shared_ptr<Core>& core,
58 MessageFederate(std::string_view name,
const std::string& configString);
90 virtual void startupToInitializeStateTransition()
override;
91 virtual void initializeToExecuteStateTransition(
IterationResult result)
override;
92 virtual void updateTime(
Time newTime,
Time oldTime)
override;
93 virtual std::string localQuery(std::string_view queryStr)
const override;
101 Endpoint& registerEndpoint(std::string_view eptName = std::string_view(),
102 std::string_view type = std::string_view());
109 Endpoint& registerTargetedEndpoint(std::string_view eptName = std::string_view(),
110 std::string_view type = std::string_view());
118 Endpoint& registerGlobalEndpoint(std::string_view eptName,
119 std::string_view type = std::string_view());
126 Endpoint& registerGlobalTargetedEndpoint(std::string_view eptName,
127 std::string_view type = std::string_view());
137 std::string_view type = std::string_view())
139 return registerGlobalEndpoint(std::string(eptName) +
'_' + std::to_string(index1), type);
142 virtual void registerInterfaces(
const std::string& configString)
override;
149 void registerMessageInterfaces(
const std::string& configString);
156 void registerMessageInterfacesJson(
const std::string& jsonString);
162 void registerMessageInterfacesToml(
const std::string& tomlString);
169 void subscribe(
const Endpoint& ept, std::string_view key);
171 bool hasMessage()
const;
173 bool hasMessage(
const Endpoint& ept)
const;
178 uint64_t pendingMessageCount(
const Endpoint& ept)
const;
182 uint64_t pendingMessageCount()
const;
186 std::unique_ptr<Message> getMessage(
const Endpoint& ept);
191 std::unique_ptr<Message> getMessage();
196 Endpoint& getEndpoint(std::string_view name)
const;
201 Endpoint& getEndpoint(
int index)
const;
206 void setMessageNotificationCallback(
const std::function<
void(
Endpoint&,
Time)>& callback);
211 void setMessageNotificationCallback(
const Endpoint& ept,
214 virtual void disconnect()
override;
217 int getEndpointCount()
const;
221 std::unique_ptr<MessageFederateManager> mfManager;