| helics 3.6.1

CommonCore.hpp
1 /*
2 Copyright (c) 2017-2025,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 #pragma once
8
9 #include "../common/GuardedTypes.hpp"
10 #include "../common/JsonBuilder.hpp"
11 #include "ActionMessage.hpp"
12 #include "BrokerBase.hpp"
13 #include "Core.hpp"
14 #include "FederateIdExtra.hpp"
15 #include "HandleManager.hpp"
16 #include "gmlc/concurrency/DelayedObjects.hpp"
17 #include "gmlc/concurrency/TriggerVariable.hpp"
18 #include "gmlc/containers/AirLock.hpp"
19 #include "gmlc/containers/DualStringMappedVector.hpp"
20 #include "gmlc/containers/MappedPointerVector.hpp"
21 #include "gmlc/containers/SimpleQueue.hpp"
22 #include "helics/helics-config.h"
23 #include "helicsTime.hpp"
24
25 #include <any>
26 #include <array>
27 #include <atomic>
28 #include <chrono>
29 #include <deque>
30 #include <map>
31 #include <memory>
32 #include <set>
33 #include <string>
34 #include <tuple>
35 #include <unordered_map>
36 #include <utility>
37 #include <vector>
38
39 namespace helics {
40 class TestHandle;
41 class FederateState;
42
43 class BasicHandleInfo;
44 class FilterCoordinator;
45 class FilterInfo;
46 class FilterFederate;
47 class TranslatorFederate;
48 class TimeoutMonitor;
49 enum class InterfaceType : char;
50 enum class QueryReuse : std::uint8_t;
52 enum class OperatingState : std::uint8_t { OPERATING = 0, ERROR_STATE = 5, DISCONNECTED = 10 };
53
55 const std::string& stateString(OperatingState state);
56
58 class FedInfo {
59 public:
60 FederateState* fed = nullptr;
61 OperatingState state{OperatingState::OPERATING};
62
63 constexpr FedInfo() = default;
64 constexpr explicit FedInfo(FederateState* newfed) noexcept: fed(newfed) {}
65 FederateState* operator->() noexcept { return fed; }
66 const FederateState* operator->() const noexcept { return fed; }
67 operator bool() const noexcept { return (fed != nullptr); }
68 };
69
74 class CommonCore: public Core, public BrokerBase {
75 public:
77 CommonCore() noexcept;
80 explicit CommonCore(bool arg) noexcept;
82 explicit CommonCore(std::string_view coreName);
84 virtual ~CommonCore() override;
85 virtual void configure(std::string_view configureString) override final;
86 virtual void configureFromArgs(int argc, char* argv[]) override final;
87 virtual void configureFromVector(std::vector<std::string> args) override final;
88 virtual bool isConfigured() const override final;
89 virtual bool isOpenToNewFederates() const override final;
90 virtual bool hasError() const override final;
91 virtual void globalError(LocalFederateId federateID,
92 int errorCode,
93 std::string_view errorString) override final;
94 virtual void localError(LocalFederateId federateID,
95 int errorCode,
96 std::string_view errorString) override final;
97 virtual int getErrorCode() const override final;
98 virtual std::string getErrorMessage() const override final;
99 virtual void finalize(LocalFederateId federateID) override final;
100 virtual bool enterInitializingMode(LocalFederateId federateID,
101 IterationRequest request) override final;
102 virtual void setCoreReadyToInit() override final;
103 virtual iteration_time
104 enterExecutingMode(LocalFederateId federateID,
105 IterationRequest iterate = NO_ITERATION) override final;
106 virtual LocalFederateId registerFederate(std::string_view name,
107 const CoreFederateInfo& info) override final;
108 virtual const std::string& getFederateName(LocalFederateId federateID) const override final;
109 virtual LocalFederateId getFederateId(std::string_view name) const override final;
110 virtual int32_t getFederationSize() override final;
111 virtual Time timeRequest(LocalFederateId federateID, Time next) override final;
112 virtual iteration_time requestTimeIterative(LocalFederateId federateID,
113 Time next,
114 IterationRequest iterate) override final;
115 virtual void processCommunications(LocalFederateId federateID,
116 std::chrono::milliseconds msToWait) override final;
117 virtual Time getCurrentTime(LocalFederateId federateID) const override final;
118 virtual void
119 setTimeProperty(LocalFederateId federateID, int32_t property, Time time) override final;
120 virtual void setIntegerProperty(LocalFederateId federateID,
121 int32_t property,
122 int16_t propertyValue) override final;
123 virtual Time getTimeProperty(LocalFederateId federateID, int32_t property) const override final;
124 virtual int16_t getIntegerProperty(LocalFederateId federateID,
125 int32_t property) const override final;
126 virtual void setFlagOption(LocalFederateId federateID,
127 int32_t flag,
128 bool flagValue = true) override final;
129 virtual bool getFlagOption(LocalFederateId federateID, int32_t flag) const override final;
130
131 virtual InterfaceHandle registerPublication(LocalFederateId federateID,
132 std::string_view key,
133 std::string_view type,
134 std::string_view units) override final;
135 virtual InterfaceHandle getPublication(LocalFederateId federateID,
136 std::string_view key) const override final;
137 virtual InterfaceHandle registerInput(LocalFederateId federateID,
138 std::string_view key,
139 std::string_view type,
140 std::string_view units) override final;
141
142 virtual InterfaceHandle getInput(LocalFederateId federateID,
143 std::string_view key) const override final;
144
145 virtual const std::string& getHandleName(InterfaceHandle handle) const override final;
146
147 virtual void setHandleOption(InterfaceHandle handle,
148 int32_t option,
149 int32_t option_value) override final;
150
151 virtual int32_t getHandleOption(InterfaceHandle handle, int32_t option) const override final;
152 virtual void closeHandle(InterfaceHandle handle) override final;
153 virtual void removeTarget(InterfaceHandle handle,
154 std::string_view targetToRemove) override final;
155 virtual void addDestinationTarget(InterfaceHandle handle,
156 std::string_view dest,
157 InterfaceType hint) override final;
158 virtual void addSourceTarget(InterfaceHandle handle,
159 std::string_view name,
160 InterfaceType hint) override final;
161 virtual const std::string& getDestinationTargets(InterfaceHandle handle) const override final;
162
163 virtual const std::string& getSourceTargets(InterfaceHandle handle) const override final;
164 virtual const std::string& getInjectionUnits(InterfaceHandle handle) const override final;
165 virtual const std::string& getExtractionUnits(InterfaceHandle handle) const override final;
166 virtual const std::string& getInjectionType(InterfaceHandle handle) const override final;
167 virtual const std::string& getExtractionType(InterfaceHandle handle) const override final;
168 virtual void setValue(InterfaceHandle handle, const char* data, uint64_t len) override final;
169 virtual const std::shared_ptr<const SmallBuffer>& getValue(InterfaceHandle handle,
170 uint32_t* inputIndex) override final;
171 virtual const std::vector<std::shared_ptr<const SmallBuffer>>&
172 getAllValues(InterfaceHandle handle) override final;
173 virtual const std::vector<InterfaceHandle>&
174 getValueUpdates(LocalFederateId federateID) override final;
175 virtual InterfaceHandle registerEndpoint(LocalFederateId federateID,
176 std::string_view name,
177 std::string_view type) override final;
178
179 virtual InterfaceHandle registerTargetedEndpoint(LocalFederateId federateID,
180 std::string_view name,
181 std::string_view type) override final;
182 virtual InterfaceHandle getEndpoint(LocalFederateId federateID,
183 std::string_view name) const override final;
184
185 virtual InterfaceHandle registerDataSink(LocalFederateId federateID,
186 std::string_view name) override final;
187
188 virtual InterfaceHandle getDataSink(LocalFederateId federateID,
189 std::string_view name) const override final;
190
191 virtual InterfaceHandle registerFilter(std::string_view filterName,
192 std::string_view type_in,
193 std::string_view type_out) override final;
194 virtual InterfaceHandle registerCloningFilter(std::string_view filterName,
195 std::string_view type_in,
196 std::string_view type_out) override final;
197 virtual InterfaceHandle registerTranslator(std::string_view translatorName,
198 std::string_view endpointType,
199 std::string_view units) override final;
200 virtual InterfaceHandle getFilter(std::string_view name) const override final;
201 virtual InterfaceHandle getTranslator(std::string_view name) const override final;
202 virtual void addDependency(LocalFederateId federateID,
203 std::string_view federateName) override final;
204 virtual void linkEndpoints(std::string_view source, std::string_view dest) override final;
205 virtual void addAlias(std::string_view interfaceKey, std::string_view alias) override final;
206 virtual void makeConnections(const std::string& file) override final;
207 virtual void dataLink(std::string_view source, std::string_view target) override final;
208 virtual void addSourceFilterToEndpoint(std::string_view filter,
209 std::string_view endpoint) override final;
210 virtual void addDestinationFilterToEndpoint(std::string_view filter,
211 std::string_view endpoint) override final;
212 virtual void
213 send(InterfaceHandle sourceHandle, const void* data, uint64_t length) override final;
214 virtual void sendAt(InterfaceHandle sourceHandle,
215 const void* data,
216 uint64_t length,
217 Time time) override final;
218 virtual void sendTo(InterfaceHandle sourceHandle,
219 const void* data,
220 uint64_t length,
221 std::string_view destination) override final;
222 virtual void sendToAt(InterfaceHandle sourceHandle,
223 const void* data,
224 uint64_t length,
225 std::string_view destination,
226 Time time) override final;
227 virtual void sendMessage(InterfaceHandle sourceHandle,
228 std::unique_ptr<Message> message) override final;
229 virtual uint64_t receiveCount(InterfaceHandle destination) override final;
230 virtual std::unique_ptr<Message> receive(InterfaceHandle destination) override final;
231 virtual std::unique_ptr<Message> receiveAny(LocalFederateId federateID,
232 InterfaceHandle& endpoint_id) override final;
233 virtual uint64_t receiveCountAny(LocalFederateId federateID) override final;
234 virtual void logMessage(LocalFederateId federateID,
235 int logLevel,
236 std::string_view messageToLog) override final;
237 virtual void setFilterOperator(InterfaceHandle filter,
238 std::shared_ptr<FilterOperator> callback) override final;
239 virtual void
240 setTranslatorOperator(InterfaceHandle translator,
241 std::shared_ptr<TranslatorOperator> callbacks) override final;
242 virtual void setFederateOperator(LocalFederateId federateID,
243 std::shared_ptr<FederateOperator> callback) override;
245 void setIdentifier(std::string_view name);
247 virtual const std::string& getIdentifier() const override final;
248 virtual const std::string& getAddress() const override final;
249 const std::string& getFederateNameNoThrow(GlobalFederateId federateID) const noexcept;
250
252 virtual void setLoggingLevel(int logLevel) override;
253 virtual void setLoggingCallback(
254 LocalFederateId federateID,
255 std::function<void(int, std::string_view, std::string_view)> logFunction) override final;
256
257 virtual void setLogFile(std::string_view lfile) override final;
258
259 virtual std::string query(std::string_view target,
260 std::string_view queryStr,
261 HelicsSequencingModes mode) override;
262 virtual void setQueryCallback(LocalFederateId federateID,
263 std::function<std::string(std::string_view)> queryFunction,
264 int order) override;
265 virtual void setGlobal(std::string_view valueName, std::string_view value) override;
266 virtual void sendCommand(std::string_view target,
267 std::string_view commandStr,
268 std::string_view source,
269 HelicsSequencingModes mode) override;
270 virtual std::pair<std::string, std::string> getCommand(LocalFederateId federateID) override;
271
272 virtual std::pair<std::string, std::string> waitCommand(LocalFederateId federateID) override;
273
274 virtual bool connect() override final;
275 virtual bool isConnected() const override final;
276 virtual void disconnect() override final;
277 virtual bool waitForDisconnect(
278 std::chrono::milliseconds msToWait = std::chrono::milliseconds(0)) const override final;
280 void unregister();
283 virtual void processDisconnect(bool skipUnregister = false) override final;
284
287 void checkInFlightQueriesForDisconnect();
288
290 virtual void setInterfaceInfo(InterfaceHandle handle, std::string_view info) override final;
292 virtual const std::string& getInterfaceInfo(InterfaceHandle handle) const override final;
293
294 virtual void setInterfaceTag(InterfaceHandle handle,
295 std::string_view tag,
296 std::string_view value) override final;
297 virtual const std::string& getInterfaceTag(InterfaceHandle handle,
298 std::string_view tag) const override final;
299
300 virtual void setFederateTag(LocalFederateId fid,
301 std::string_view tag,
302 std::string_view value) override final;
303 virtual const std::string& getFederateTag(LocalFederateId fid,
304 std::string_view tag) const override final;
305
306 private:
309 virtual bool brokerConnect() = 0;
312 virtual void brokerDisconnect() = 0;
313
314 protected:
315 virtual void processCommand(ActionMessage&& command) override final;
316
317 virtual void processPriorityCommand(ActionMessage&& command) override final;
318
322 virtual void transmit(route_id rid, const ActionMessage& command) = 0;
326 virtual void transmit(route_id rid, ActionMessage&& command) = 0;
333 virtual void addRoute(route_id rid, int interfaceId, std::string_view routeInfo) = 0;
337 virtual void removeRoute(route_id rid) = 0;
339 FederateState* getFederateAt(LocalFederateId federateID) const;
341 FederateState* getFederate(std::string_view federateName) const;
344 FederateState* getHandleFederate(InterfaceHandle handle);
346 const BasicHandleInfo* getHandleInfo(InterfaceHandle handle) const;
348 const BasicHandleInfo* getLocalEndpoint(std::string_view name) const;
349
351 bool allInitReady() const;
353 bool allDisconnected() const;
355 OperatingState minFederateState() const;
356
357 virtual double getSimulationTime() const override;
358
359 private:
361 FederateState* getFederateCore(GlobalFederateId federateID);
363 FederateState* getFederateCore(std::string_view federateName);
367 FederateState* getHandleFederateCore(InterfaceHandle handle);
368
369 private:
370 std::atomic<double> simTime{BrokerBase::mInvalidSimulationTime};
371 GlobalFederateId keyFed{};
372 std::string prevIdentifier;
374 std::map<GlobalFederateId, route_id> routing_table;
376 gmlc::containers::SimpleQueue<ActionMessage> delayTransmitQueue;
378 std::unordered_map<std::string, route_id> knownExternalEndpoints;
379 std::vector<std::pair<std::string, std::string>> tags;
381 std::unique_ptr<TimeoutMonitor> timeoutMon;
383 void transmitDelayedMessages();
385 void errorRespondDelayedMessages(std::string_view estring);
389 void transmitDelayedMessages(GlobalFederateId source);
390
392 void routeMessage(ActionMessage& cmd, GlobalFederateId dest);
395 void routeMessage(const ActionMessage& cmd);
396
398 void routeMessage(ActionMessage&& cmd, GlobalFederateId dest);
401 void routeMessage(ActionMessage&& cmd);
403 FederateState*
404 checkNewInterface(LocalFederateId federateID, std::string_view key, InterfaceType type);
406 void checkDependencies();
408 void processQueryResponse(const ActionMessage& message);
410 void checkQueryTimeouts();
412 void processCommandsForCore(const ActionMessage& cmd);
414 void processCoreConfigureCommands(ActionMessage& cmd);
416 void processInitRequest(ActionMessage& cmd);
418 void processExecRequest(ActionMessage& cmd);
420 void processDisconnectCommand(ActionMessage& cmd);
421
423 void processTimingTick(ActionMessage& cmd);
425 void processQueryCommand(ActionMessage& cmd);
427 void processLogAndErrorCommand(ActionMessage& cmd);
429 void processLinkingCommand(ActionMessage& cmd);
432 bool checkForLocalPublication(ActionMessage& cmd);
434 uint16_t getNextAirlockIndex();
436 void loadBasicJsonInfo(
437 nlohmann::json& base,
438 const std::function<void(nlohmann::json& fedval, const FedInfo& fed)>& fedLoader) const;
445 void initializeMapBuilder(std::string_view request,
446 std::uint16_t index,
447 QueryReuse reuse,
448 bool force_ordering) const;
450 std::string coreQuery(std::string_view queryStr, bool force_ordering) const;
451
454 std::string quickCoreQueries(std::string_view queryStr) const;
455
457 std::string filteredEndpointQuery(const FederateState* fed) const;
459 void processCommandInstruction(ActionMessage& command);
460
461 private:
462 int32_t mGlobalFederationSize{0};
464 std::atomic<int16_t> delayInitCounter{0};
465 bool filterTiming{false};
467 shared_guarded<gmlc::containers::MappedPointerVector<FederateState, std::string>> federates;
469 gmlc::containers::DualStringMappedVector<FedInfo, GlobalFederateId> loopFederates;
470
473 std::atomic<int32_t> messageCounter{54};
474 ordered_guarded<HandleManager> handles;
476 HandleManager loopHandles;
478 std::vector<std::pair<GlobalFederateId, int32_t>> timeBlocks;
479 TranslatorFederate* translatorFed{nullptr};
480 std::atomic<std::thread::id> translatorThread{std::thread::id{}};
481 std::atomic<GlobalFederateId> translatorFedID;
482
484 std::map<int32_t, std::vector<ActionMessage>> delayedTimingMessages;
485
487 std::atomic<int> queryCounter{1};
489 gmlc::concurrency::DelayedObjects<std::string> activeQueries;
491 std::deque<std::pair<int32_t, decltype(std::chrono::steady_clock::now())>> queryTimeouts;
493 mutable std::vector<std::tuple<fileops::JsonMapBuilder, std::vector<ActionMessage>, QueryReuse>>
494 mapBuilders;
495
496 FilterFederate* filterFed{nullptr};
497 std::atomic<std::thread::id> filterThread{std::thread::id{}};
498 std::atomic<GlobalFederateId> filterFedID;
499 std::atomic<uint16_t> nextAirLock{0};
501 std::array<gmlc::containers::AirLock<std::any>, 4> dataAirlocks;
502 gmlc::concurrency::TriggerVariable disconnection;
504 std::atomic<bool> initIterations{false};
505
506 private:
507 // generate a filter Federate
508 void generateFilterFederate();
509 // generate a translator Federate
510 void generateTranslatorFederate();
511 // generate a timing connection between the core and filter Federate
512 void connectFilterTiming();
514 bool hasTimeBlock(GlobalFederateId federateID);
516 bool waitCoreRegistration();
518 void generateMessages(ActionMessage& message,
519 const std::vector<std::pair<GlobalHandle, std::string_view>>& targets);
521 void deliverMessage(ActionMessage& message);
523 ActionMessage& processMessage(ActionMessage& message);
527 const BasicHandleInfo& createBasicHandle(GlobalFederateId global_federateId,
528 LocalFederateId local_federateId,
529 InterfaceType HandleType,
530 std::string_view key,
531 std::string_view type,
532 std::string_view units,
533 uint16_t flags = 0);
534
538 bool isLocal(GlobalFederateId global_fedid) const;
542 route_id getRoute(GlobalFederateId global_fedid) const;
544 void checkForNamedInterface(ActionMessage& command);
546 void removeNamedTarget(ActionMessage& command);
549 void setAsUsed(BasicHandleInfo* hand);
551 void registerInterface(ActionMessage& command);
553 void addTargetToInterface(ActionMessage& command);
555 void removeTargetFromInterface(ActionMessage& command);
557 void disconnectInterface(ActionMessage& command);
559 void manageTimeBlocks(const ActionMessage& command);
560
567 std::string federateQuery(const FederateState* fed,
568 std::string_view queryStr,
569 bool force_ordering) const;
570
572 void sendErrorToFederates(int errorCode, std::string_view message);
574 bool checkAndProcessDisconnect();
576 void sendDisconnect(action_message_def::action_t disconnectType = CMD_STOP);
578 void broadcastToFederates(ActionMessage& cmd);
580 int generateMapObjectCounter() const;
581 friend class TimeoutMonitor;
582 };
583
584 } // namespace helics
BrokerBase.hpp
NO_ITERATION
constexpr auto NO_ITERATION
simplified alias to indicate that no iterations are needed
Definition: CoreTypes.hpp:128
gmlc::libguarded::shared_guarded
Definition: application_api/Federate.hpp:27
helics::ActionMessage
Definition: ActionMessage.hpp:30
helics::BasicHandleInfo
Definition: BasicHandleInfo.hpp:20
helics::BrokerBase
Definition: BrokerBase.hpp:39
helics::CommonCore
Definition: CommonCore.hpp:74
helics::CommonCore::getHandleFederate
FederateState * getHandleFederate(InterfaceHandle handle)
Definition: CommonCore.cpp:306
helics::CommonCore::getFederateTag
virtual const std::string & getFederateTag(LocalFederateId fid, std::string_view tag) const override final
Definition: CommonCore.cpp:5599
helics::CommonCore::setIntegerProperty
virtual void setIntegerProperty(LocalFederateId federateID, int32_t property, int16_t propertyValue) override final
Definition: CommonCore.cpp:1015
helics::CommonCore::setFlagOption
virtual void setFlagOption(LocalFederateId federateID, int32_t flag, bool flagValue=true) override final
Definition: CommonCore.cpp:1088
helics::CommonCore::waitForDisconnect
virtual bool waitForDisconnect(std::chrono::milliseconds msToWait=std::chrono::milliseconds(0)) const override final
Definition: CommonCore.cpp:258
helics::CommonCore::getFederationSize
virtual int32_t getFederationSize() override final
Definition: CommonCore.cpp:859
helics::CommonCore::getExtractionType
virtual const std::string & getExtractionType(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1389
helics::CommonCore::getHandleOption
virtual int32_t getHandleOption(InterfaceHandle handle, int32_t option) const override final
Definition: CommonCore.cpp:1436
helics::CommonCore::receiveCount
virtual uint64_t receiveCount(InterfaceHandle destination) override final
Definition: CommonCore.cpp:2382
helics::CommonCore::removeRoute
virtual void removeRoute(route_id rid)=0
helics::CommonCore::transmit
virtual void transmit(route_id rid, ActionMessage &&command)=0
helics::CommonCore::processPriorityCommand
virtual void processPriorityCommand(ActionMessage &&command) override final
Definition: CommonCore.cpp:3181
helics::CommonCore::registerDataSink
virtual InterfaceHandle registerDataSink(LocalFederateId federateID, std::string_view name) override final
Definition: CommonCore.cpp:1860
helics::CommonCore::getErrorMessage
virtual std::string getErrorMessage() const override final
Definition: CommonCore.cpp:467
helics::CommonCore::getInjectionType
virtual const std::string & getInjectionType(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1365
helics::CommonCore::sendAt
virtual void sendAt(InterfaceHandle sourceHandle, const void *data, uint64_t length, Time time) override final
Definition: CommonCore.cpp:2236
helics::CommonCore::unregister
void unregister()
Definition: CommonCore.cpp:267
helics::CommonCore::sendCommand
virtual void sendCommand(std::string_view target, std::string_view commandStr, std::string_view source, HelicsSequencingModes mode) override
Definition: CommonCore.cpp:3153
helics::CommonCore::getPublication
virtual InterfaceHandle getPublication(LocalFederateId federateID, std::string_view key) const override final
Definition: CommonCore.cpp:1309
helics::CommonCore::setValue
virtual void setValue(InterfaceHandle handle, const char *data, uint64_t len) override final
Definition: CommonCore.cpp:1728
helics::CommonCore::registerTargetedEndpoint
virtual InterfaceHandle registerTargetedEndpoint(LocalFederateId federateID, std::string_view name, std::string_view type) override final
Definition: CommonCore.cpp:1882
helics::CommonCore::getHandleInfo
const BasicHandleInfo * getHandleInfo(InterfaceHandle handle) const
Definition: CommonCore.cpp:339
helics::CommonCore::getFederateAt
FederateState * getFederateAt(LocalFederateId federateID) const
Definition: CommonCore.cpp:294
helics::CommonCore::setFilterOperator
virtual void setFilterOperator(InterfaceHandle filter, std::shared_ptr< FilterOperator > callback) override final
Definition: CommonCore.cpp:2534
helics::CommonCore::allDisconnected
bool allDisconnected() const
Definition: CommonCore.cpp:526
helics::CommonCore::sendMessage
virtual void sendMessage(InterfaceHandle sourceHandle, std::unique_ptr< Message > message) override final
Definition: CommonCore.cpp:2262
helics::CommonCore::setGlobal
virtual void setGlobal(std::string_view valueName, std::string_view value) override
Definition: CommonCore.cpp:3143
helics::CommonCore::getCurrentTime
virtual Time getCurrentTime(LocalFederateId federateID) const override final
Definition: CommonCore.cpp:1006
helics::CommonCore::getFederateName
virtual const std::string & getFederateName(LocalFederateId federateID) const override final
Definition: CommonCore.cpp:822
helics::CommonCore::closeHandle
virtual void closeHandle(InterfaceHandle handle) override final
Definition: CommonCore.cpp:1461
helics::CommonCore::dataLink
virtual void dataLink(std::string_view source, std::string_view target) override final
Definition: CommonCore.cpp:2057
helics::CommonCore::getCommand
virtual std::pair< std::string, std::string > getCommand(LocalFederateId federateID) override
Definition: CommonCore.cpp:2469
helics::CommonCore::getTranslator
virtual InterfaceHandle getTranslator(std::string_view name) const override final
Definition: CommonCore.cpp:2011
helics::CommonCore::registerTranslator
virtual InterfaceHandle registerTranslator(std::string_view translatorName, std::string_view endpointType, std::string_view units) override final
Definition: CommonCore.cpp:1977
helics::CommonCore::timeRequest
virtual Time timeRequest(LocalFederateId federateID, Time next) override final
Definition: CommonCore.cpp:868
helics::CommonCore::registerCloningFilter
virtual InterfaceHandle registerCloningFilter(std::string_view filterName, std::string_view type_in, std::string_view type_out) override final
Definition: CommonCore.cpp:1948
helics::CommonCore::getErrorCode
virtual int getErrorCode() const override final
Definition: CommonCore.cpp:462
helics::CommonCore::requestTimeIterative
virtual iteration_time requestTimeIterative(LocalFederateId federateID, Time next, IterationRequest iterate) override final
Definition: CommonCore.cpp:926
helics::CommonCore::getFilter
virtual InterfaceHandle getFilter(std::string_view name) const override final
Definition: CommonCore.cpp:2001
helics::CommonCore::getSourceTargets
virtual const std::string & getSourceTargets(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1694
helics::CommonCore::processDisconnect
virtual void processDisconnect(bool skipUnregister=false) override final
Definition: CommonCore.cpp:203
helics::CommonCore::setQueryCallback
virtual void setQueryCallback(LocalFederateId federateID, std::function< std::string(std::string_view)> queryFunction, int order) override
Definition: CommonCore.cpp:2625
helics::CommonCore::addSourceTarget
virtual void addSourceTarget(InterfaceHandle handle, std::string_view name, InterfaceType hint) override final
Definition: CommonCore.cpp:1591
helics::CommonCore::connect
virtual bool connect() override final
Definition: CommonCore.cpp:130
helics::CommonCore::setTranslatorOperator
virtual void setTranslatorOperator(InterfaceHandle translator, std::shared_ptr< TranslatorOperator > callbacks) override final
Definition: CommonCore.cpp:2556
helics::CommonCore::setFederateOperator
virtual void setFederateOperator(LocalFederateId federateID, std::shared_ptr< FederateOperator > callback) override
Definition: CommonCore.cpp:2581
helics::CommonCore::receiveAny
virtual std::unique_ptr< Message > receiveAny(LocalFederateId federateID, InterfaceHandle &endpoint_id) override final
Definition: CommonCore.cpp:2404
helics::CommonCore::registerFilter
virtual InterfaceHandle registerFilter(std::string_view filterName, std::string_view type_in, std::string_view type_out) override final
Definition: CommonCore.cpp:1926
helics::CommonCore::getDataSink
virtual InterfaceHandle getDataSink(LocalFederateId federateID, std::string_view name) const override final
Definition: CommonCore.cpp:1916
helics::CommonCore::CommonCore
CommonCore() noexcept
Definition: CommonCore.cpp:73
helics::CommonCore::getInjectionUnits
virtual const std::string & getInjectionUnits(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1328
helics::CommonCore::registerEndpoint
virtual InterfaceHandle registerEndpoint(LocalFederateId federateID, std::string_view name, std::string_view type) override final
Definition: CommonCore.cpp:1833
helics::CommonCore::enterExecutingMode
virtual iteration_time enterExecutingMode(LocalFederateId federateID, IterationRequest iterate=NO_ITERATION) override final
Definition: CommonCore.cpp:650
helics::CommonCore::isConnected
virtual bool isConnected() const override final
Definition: CommonCore.cpp:183
helics::CommonCore::getValue
virtual const std::shared_ptr< const SmallBuffer > & getValue(InterfaceHandle handle, uint32_t *inputIndex) override final
Definition: CommonCore.cpp:1792
helics::CommonCore::getTimeProperty
virtual Time getTimeProperty(LocalFederateId federateID, int32_t property) const override final
Definition: CommonCore.cpp:1057
helics::CommonCore::setInterfaceTag
virtual void setInterfaceTag(InterfaceHandle handle, std::string_view tag, std::string_view value) override final
Definition: CommonCore.cpp:5571
helics::CommonCore::configureFromArgs
virtual void configureFromArgs(int argc, char *argv[]) override final
Definition: CommonCore.cpp:98
helics::CommonCore::configureFromVector
virtual void configureFromVector(std::vector< std::string > args) override final
Definition: CommonCore.cpp:114
helics::CommonCore::registerInput
virtual InterfaceHandle registerInput(LocalFederateId federateID, std::string_view key, std::string_view type, std::string_view units) override final
Definition: CommonCore.cpp:1239
helics::CommonCore::~CommonCore
virtual ~CommonCore() override
Definition: CommonCore.cpp:289
helics::CommonCore::getSimulationTime
virtual double getSimulationTime() const override
Definition: CommonCore.cpp:547
helics::CommonCore::allInitReady
bool allInitReady() const
Definition: CommonCore.cpp:510
helics::CommonCore::sendTo
virtual void sendTo(InterfaceHandle sourceHandle, const void *data, uint64_t length, std::string_view destination) override final
Definition: CommonCore.cpp:2094
helics::CommonCore::setLoggingLevel
virtual void setLoggingLevel(int logLevel) override
Definition: CommonCore.cpp:2451
helics::CommonCore::setLogFile
virtual void setLogFile(std::string_view lfile) override final
Definition: CommonCore.cpp:2460
helics::CommonCore::addSourceFilterToEndpoint
virtual void addSourceFilterToEndpoint(std::string_view filter, std::string_view endpoint) override final
Definition: CommonCore.cpp:2065
helics::CommonCore::enterInitializingMode
virtual bool enterInitializingMode(LocalFederateId federateID, IterationRequest request) override final
Definition: CommonCore.cpp:582
helics::CommonCore::processCommand
virtual void processCommand(ActionMessage &&command) override final
Definition: CommonCore.cpp:3450
helics::CommonCore::removeTarget
virtual void removeTarget(InterfaceHandle handle, std::string_view targetToRemove) override final
Definition: CommonCore.cpp:1478
helics::CommonCore::query
virtual std::string query(std::string_view target, std::string_view queryStr, HelicsSequencingModes mode) override
Definition: CommonCore.cpp:3052
helics::CommonCore::getInterfaceTag
virtual const std::string & getInterfaceTag(InterfaceHandle handle, std::string_view tag) const override final
Definition: CommonCore.cpp:5562
helics::CommonCore::waitCommand
virtual std::pair< std::string, std::string > waitCommand(LocalFederateId federateID) override
Definition: CommonCore.cpp:2478
helics::CommonCore::addDestinationTarget
virtual void addDestinationTarget(InterfaceHandle handle, std::string_view dest, InterfaceType hint) override final
Definition: CommonCore.cpp:1512
helics::CommonCore::getInput
virtual InterfaceHandle getInput(LocalFederateId federateID, std::string_view key) const override final
Definition: CommonCore.cpp:1270
helics::CommonCore::receiveCountAny
virtual uint64_t receiveCountAny(LocalFederateId federateID) override final
Definition: CommonCore.cpp:2418
helics::CommonCore::getEndpoint
virtual InterfaceHandle getEndpoint(LocalFederateId federateID, std::string_view name) const override final
Definition: CommonCore.cpp:1906
helics::CommonCore::getValueUpdates
virtual const std::vector< InterfaceHandle > & getValueUpdates(LocalFederateId federateID) override final
Definition: CommonCore.cpp:1824
helics::CommonCore::getIntegerProperty
virtual int16_t getIntegerProperty(LocalFederateId federateID, int32_t property) const override final
Definition: CommonCore.cpp:1066
helics::CommonCore::send
virtual void send(InterfaceHandle sourceHandle, const void *data, uint64_t length) override final
Definition: CommonCore.cpp:2211
helics::CommonCore::transmit
virtual void transmit(route_id rid, const ActionMessage &command)=0
helics::CommonCore::makeConnections
virtual void makeConnections(const std::string &file) override final
Definition: CommonCore.cpp:2021
helics::CommonCore::getFlagOption
virtual bool getFlagOption(LocalFederateId federateID, int32_t flag) const override final
Definition: CommonCore.cpp:1136
helics::CommonCore::minFederateState
OperatingState minFederateState() const
Definition: CommonCore.cpp:536
helics::CommonCore::getFederateId
virtual LocalFederateId getFederateId(std::string_view name) const override final
Definition: CommonCore.cpp:848
helics::CommonCore::setInterfaceInfo
virtual void setInterfaceInfo(InterfaceHandle handle, std::string_view info) override final
Definition: CommonCore.cpp:5556
helics::CommonCore::finalize
virtual void finalize(LocalFederateId federateID) override final
Definition: CommonCore.cpp:474
helics::CommonCore::getHandleName
virtual const std::string & getHandleName(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1319
helics::CommonCore::addDestinationFilterToEndpoint
virtual void addDestinationFilterToEndpoint(std::string_view filter, std::string_view endpoint) override final
Definition: CommonCore.cpp:2073
helics::CommonCore::addDependency
virtual void addDependency(LocalFederateId federateID, std::string_view federateName) override final
Definition: CommonCore.cpp:2082
helics::CommonCore::processCommunications
virtual void processCommunications(LocalFederateId federateID, std::chrono::milliseconds msToWait) override final
Definition: CommonCore.cpp:986
helics::CommonCore::logMessage
virtual void logMessage(LocalFederateId federateID, int logLevel, std::string_view messageToLog) override final
Definition: CommonCore.cpp:2431
helics::CommonCore::getAllValues
virtual const std::vector< std::shared_ptr< const SmallBuffer > > & getAllValues(InterfaceHandle handle) override final
Definition: CommonCore.cpp:1809
helics::CommonCore::receive
virtual std::unique_ptr< Message > receive(InterfaceHandle destination) override final
Definition: CommonCore.cpp:2391
helics::CommonCore::getAddress
virtual const std::string & getAddress() const override final
Definition: CommonCore.cpp:195
helics::CommonCore::getLocalEndpoint
const BasicHandleInfo * getLocalEndpoint(std::string_view name) const
Definition: CommonCore.cpp:344
helics::CommonCore::setHandleOption
virtual void setHandleOption(InterfaceHandle handle, int32_t option, int32_t option_value) override final
Definition: CommonCore.cpp:1407
helics::CommonCore::isOpenToNewFederates
virtual bool isOpenToNewFederates() const override final
Definition: CommonCore.cpp:366
helics::CommonCore::linkEndpoints
virtual void linkEndpoints(std::string_view source, std::string_view dest) override final
Definition: CommonCore.cpp:2041
helics::CommonCore::disconnect
virtual void disconnect() override final
Definition: CommonCore.cpp:232
helics::CommonCore::checkInFlightQueriesForDisconnect
void checkInFlightQueriesForDisconnect()
Definition: CommonCore.cpp:5323
helics::CommonCore::registerPublication
virtual InterfaceHandle registerPublication(LocalFederateId federateID, std::string_view key, std::string_view type, std::string_view units) override final
Definition: CommonCore.cpp:1280
helics::CommonCore::getInterfaceInfo
virtual const std::string & getInterfaceInfo(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:5547
helics::CommonCore::configure
virtual void configure(std::string_view configureString) override final
Definition: CommonCore.cpp:82
helics::CommonCore::setFederateTag
virtual void setFederateTag(LocalFederateId fid, std::string_view tag, std::string_view value) override final
Definition: CommonCore.cpp:5618
helics::CommonCore::setCoreReadyToInit
virtual void setCoreReadyToInit() override final
Definition: CommonCore.cpp:552
helics::CommonCore::getExtractionUnits
virtual const std::string & getExtractionUnits(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1350
helics::CommonCore::getFederate
FederateState * getFederate(std::string_view federateName) const
Definition: CommonCore.cpp:300
helics::CommonCore::sendToAt
virtual void sendToAt(InterfaceHandle sourceHandle, const void *data, uint64_t length, std::string_view destination, Time time) override final
Definition: CommonCore.cpp:2134
helics::CommonCore::setIdentifier
void setIdentifier(std::string_view name)
Definition: CommonCore.cpp:2604
helics::CommonCore::setTimeProperty
virtual void setTimeProperty(LocalFederateId federateID, int32_t property, Time time) override final
Definition: CommonCore.cpp:1041
helics::CommonCore::registerFederate
virtual LocalFederateId registerFederate(std::string_view name, const CoreFederateInfo &info) override final
Definition: CommonCore.cpp:697
helics::CommonCore::setLoggingCallback
virtual void setLoggingCallback(LocalFederateId federateID, std::function< void(int, std::string_view, std::string_view)> logFunction) override final
Definition: CommonCore.cpp:2487
helics::CommonCore::getDestinationTargets
virtual const std::string & getDestinationTargets(InterfaceHandle handle) const override final
Definition: CommonCore.cpp:1663
helics::CommonCore::getIdentifier
virtual const std::string & getIdentifier() const override final
Definition: CommonCore.cpp:190
helics::CommonCore::addAlias
virtual void addAlias(std::string_view interfaceKey, std::string_view alias) override final
Definition: CommonCore.cpp:2049
helics::CommonCore::addRoute
virtual void addRoute(route_id rid, int interfaceId, std::string_view routeInfo)=0
helics::CommonCore::isConfigured
virtual bool isConfigured() const override final
Definition: CommonCore.cpp:361
helics::CoreFederateInfo
Definition: CoreFederateInfo.hpp:16
helics::Core
Definition: core/Core.hpp:41
helics::FedInfo
Definition: CommonCore.hpp:58
helics::FederateState
Definition: FederateState.hpp:50
helics::GlobalFederateId
Definition: GlobalFederateId.hpp:75
helics::InterfaceHandle
Definition: LocalFederateId.hpp:65
helics::LocalFederateId
Definition: LocalFederateId.hpp:22
helics::route_id
Definition: GlobalFederateId.hpp:187
helicsTime.hpp
HelicsSequencingModes
HelicsSequencingModes
Definition: helics_enums.h:427
helics::action_message_def::action_t
action_t
Definition: ActionMessageDefintions.hpp:20
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::stateString
const std::string & stateString(OperatingState state)
Definition: CommonCore.cpp:56
helics::IterationRequest
IterationRequest
Definition: CoreTypes.hpp:103
helics::InterfaceType
InterfaceType
Definition: CoreTypes.hpp:112
helics::QueryReuse
QueryReuse
Enumeration of if query result is reusable.
Definition: queryHelpers.hpp:39
helics::Time
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
helics::OperatingState
OperatingState
Definition: CommonCore.hpp:52
helics::iteration_time
Definition: helicsTime.hpp:43