helics  3.3.0
FederateState.hpp
1 /*
2 Copyright (c) 2017-2022,
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 "ActionMessage.hpp"
11 #include "BasicHandleInfo.hpp"
12 #include "CoreTypes.hpp"
13 #include "InterfaceInfo.hpp"
14 #include "core-data.hpp"
15 #include "gmlc/containers/BlockingQueue.hpp"
16 #include "helicsTime.hpp"
17 
18 #include <atomic>
19 #include <chrono>
20 #include <deque>
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <thread>
25 #include <utility>
26 #include <vector>
27 
28 namespace helics {
29 class SubscriptionInfo;
30 class PublicationInfo;
31 class EndpointInfo;
32 class FilterInfo;
33 class CommonCore;
34 class CoreFederateInfo;
35 
36 class TimeCoordinator;
37 class MessageTimer;
38 class LogManager;
39 
40 constexpr Time startupTime = Time::minVal();
41 constexpr Time initialTime{-1000000.0};
42 
44 enum class TimeSynchronizationMethod : uint8_t { DISTRIBUTED = 0, GLOBAL = 1, ASYNC = 2 };
45 
48  public:
50  FederateState(const std::string& fedName, const CoreFederateInfo& fedInfo);
51  // the destructor is defined so some classes linked with unique ptrs don't have to be defined in
52  // the header
54  FederateState(const FederateState&) = delete;
55  FederateState& operator=(const FederateState&) = delete;
58 
59  private:
60  const std::string name;
61  std::unique_ptr<TimeCoordinator> timeCoord;
63 
64  public:
66  std::atomic<GlobalFederateId> global_id;
67 
68  private:
69  std::atomic<FederateStates> state{
70  FederateStates::CREATED};
71  bool only_transmit_on_change{false};
72  bool realtime{false};
74  bool observer{false};
75  bool source_only{false};
76  bool ignore_time_mismatch_warnings{false};
79  bool strict_input_type_checking{false};
80  bool ignore_unit_mismatch{false};
81  bool slow_responding{false};
83  InterfaceInfo interfaceInformation;
84  std::unique_ptr<LogManager> mLogManager;
85  int maxLogLevel{HELICS_LOG_LEVEL_NO_PRINT};
86 
87  public:
88  std::atomic<bool> init_transmitted{false};
89  private:
91  bool wait_for_current_time{false};
93  bool mProfilerActive{false};
96  bool mLocalProfileCapture{false};
97  int errorCode{0};
98  CommonCore* parent_{nullptr};
99  std::string errorString;
100 
101  decltype(std::chrono::steady_clock::now()) start_clock_time;
102  Time rt_lag{timeZero};
103  Time rt_lead{timeZero};
104  Time grantTimeOutPeriod{timeZero};
105  std::int32_t realTimeTimerIndex{-1};
106  std::int32_t grantTimeoutTimeIndex{-1};
107  public:
109  std::atomic<bool> init_requested{false};
110  // temporary
111  std::atomic<bool> requestingMode{false};
112 
113  private:
114  bool iterating{false};
115  bool timeGranted_mode{false};
116  bool terminate_on_error{false};
118  TimeSynchronizationMethod timeMethod{TimeSynchronizationMethod::DISTRIBUTED};
122  std::uint32_t mGrantCount{0}; // this is intended to allow wrapping
124  std::shared_ptr<MessageTimer> mTimer;
126  gmlc::containers::BlockingQueue<ActionMessage> queue;
128  gmlc::containers::BlockingQueue<std::pair<std::string, std::string>> commandQueue;
130  std::atomic<uint16_t> interfaceFlags{0};
132  std::map<GlobalFederateId, std::deque<ActionMessage>> delayQueues;
133  std::vector<InterfaceHandle> events;
134  std::vector<InterfaceHandle> eventMessages;
135  std::vector<GlobalFederateId> delayedFederates;
136  Time time_granted{startupTime};
137  Time allowed_send_time{startupTime};
138  mutable std::atomic_flag processing = ATOMIC_FLAG_INIT;
139 
141  std::function<std::string(std::string_view)> queryCallback;
142 
143  std::vector<std::pair<std::string, std::string>> tags;
144  std::atomic<bool> queueProcessing{false};
146  Time nextValueTime() const;
148  Time nextMessageTime() const;
149 
151  void setState(FederateStates newState);
152 
154  bool messageShouldBeDelayed(const ActionMessage& cmd) const;
156  void addFederateToDelay(GlobalFederateId id);
158  void generateConfig(Json::Value& base) const;
159 
160  public:
162  void reset();
164  void reInit();
166  const std::string& getIdentifier() const { return name; }
168  FederateStates getState() const;
170  InterfaceInfo& interfaces() { return interfaceInformation; }
172  const InterfaceInfo& interfaces() const { return interfaceInformation; }
173 
175  uint64_t getQueueSize(InterfaceHandle id) const;
178  uint64_t getQueueSize() const;
182  int32_t getCurrentIteration() const;
186  std::unique_ptr<Message> receive(InterfaceHandle id);
189  std::unique_ptr<Message> receiveAny(InterfaceHandle& id);
193  const std::shared_ptr<const SmallBuffer>& getValue(InterfaceHandle handle,
194  uint32_t* inputIndex);
195 
200  const std::vector<std::shared_ptr<const SmallBuffer>>& getAllValues(InterfaceHandle handle);
201 
203  std::pair<SmallBuffer, Time> getPublishedValue(InterfaceHandle handle);
205  void setParent(CommonCore* coreObject) { parent_ = coreObject; }
210  void setProperties(const ActionMessage& cmd);
212  void setInterfaceProperty(const ActionMessage& cmd);
214  void setProperty(int timeProperty, Time propertyVal);
216  void setProperty(int intProperty, int propertyVal);
218  void setOptionFlag(int optionFlag, bool value);
220  Time getTimeProperty(int timeProperty) const;
222  bool getOptionFlag(int optionFlag) const;
224  int32_t getHandleOption(InterfaceHandle handle, char iType, int32_t option) const;
226  uint16_t getInterfaceFlags() const { return interfaceFlags.load(); }
228  int getIntegerProperty(int intProperty) const;
230  int publicationCount() const;
232  int endpointCount() const;
234  int inputCount() const;
236  void spinlock() const
237  {
238  while (processing.test_and_set()) {
239  ; // spin
240  }
241  }
243  void sleeplock() const
244  {
245  if (!processing.test_and_set()) {
246  return;
247  }
248  // spin for 10000 tries
249  for (int ii = 0; ii < 10000; ++ii) {
250  if (!processing.test_and_set()) {
251  return;
252  }
253  }
254  while (processing.test_and_set()) {
255  std::this_thread::yield();
256  }
257  }
259  void lock() { sleeplock(); }
260 
262  bool try_lock() const { return !processing.test_and_set(); }
264  void unlock() const { processing.clear(); }
266  int loggingLevel() const;
267 
269  void setTag(std::string_view tag, std::string_view value);
271  const std::string& getTag(std::string_view tag) const;
273  const std::pair<std::string, std::string>& getTagByIndex(size_t index) const
274  {
275  return tags[index];
276  }
278  auto tagCount() const { return tags.size(); }
279 
280  private:
290  MessageProcessingResult processQueue() noexcept;
291 
301  MessageProcessingResult processDelayQueue() noexcept;
305  MessageProcessingResult processActionMessage(ActionMessage& cmd);
309  void fillEventVectorUpTo(Time currentTime);
313  void fillEventVectorInclusive(Time currentTime);
317  void fillEventVectorNextIteration(Time currentTime);
319  void addDependency(GlobalFederateId fedToDependOn);
321  void addDependent(GlobalFederateId fedThatDependsOnThis);
323  int checkInterfaces();
325  std::string processQueryActual(std::string_view query) const;
329  void generateProfilingMessage(bool enterHelicsCode);
331  void generateProfilingMarker();
333  void updateMaxLogLevel();
334 
335  public:
337  Time grantedTime() const { return time_granted; }
339  Time nextAllowedSendTime() const { return allowed_send_time; }
342  const std::vector<InterfaceHandle>& getEvents() const;
345  std::vector<GlobalFederateId> getDependencies() const;
348  std::vector<GlobalFederateId> getDependents() const;
350  const std::string& lastErrorString() const { return errorString; }
352  int lastErrorCode() const noexcept { return errorCode; }
354  void setCoreObject(CommonCore* parent);
355  // the next 5 functions are the processing functions that actually process the queue
366  IterationResult enterExecutingMode(IterationRequest iterate, bool sendRequest = false);
374  iteration_time requestTime(Time nextTime, IterationRequest iterate, bool sendRequest = false);
378  std::vector<GlobalHandle> getSubscribers(InterfaceHandle handle);
379 
383  std::vector<std::pair<GlobalHandle, std::string_view>>
385 
392  void finalize();
394  void processCommunications(std::chrono::milliseconds period);
396  void addAction(const ActionMessage& action);
398  void addAction(ActionMessage&& action);
400  std::optional<ActionMessage> processPostTerminationAction(const ActionMessage& action);
401 
403  void forceProcessMessage(ActionMessage& action);
404 
412  void logMessage(int level,
413  std::string_view logMessageSource,
414  std::string_view message,
415  bool fromRemote = false) const;
416 
421  void setLogger(std::function<void(int, std::string_view, std::string_view)> logFunction);
422 
426  void setQueryCallback(std::function<std::string(std::string_view)> queryCallbackFunction)
427  {
428  queryCallback = std::move(queryCallbackFunction);
429  }
435  std::string processQuery(std::string_view query, bool force_ordering = false) const;
443  bool checkAndSetValue(InterfaceHandle pub_id, const char* data, uint64_t len);
444 
446  void routeMessage(const ActionMessage& msg);
447 
449  void routeMessage(ActionMessage&& msg);
451  void createInterface(InterfaceType htype,
452  InterfaceHandle handle,
453  std::string_view key,
454  std::string_view type,
455  std::string_view units,
456  uint16_t flags);
458  void closeInterface(InterfaceHandle handle, InterfaceType type);
460  void sendCommand(ActionMessage& command);
461 
463  std::pair<std::string, std::string> getCommand();
465  std::pair<std::string, std::string> waitCommand();
466 };
467 
468 } // namespace helics
helics::timeZero
constexpr Time timeZero
Definition: helicsTime.hpp:31
helics::destination_target
@ destination_target
indicator that the target is a destination target
Definition: flagOperations.hpp:43
HELICS_LOG_LEVEL_PROFILING
@ HELICS_LOG_LEVEL_PROFILING
Definition: helics_enums.h:190
helics::FederateState::receive
std::unique_ptr< Message > receive(InterfaceHandle id)
Definition: FederateState.cpp:230
helics::FederateState::getEvents
const std::vector< InterfaceHandle > & getEvents() const
Definition: FederateState.cpp:906
helics::FederateState::getAllValues
const std::vector< std::shared_ptr< const SmallBuffer > > & getAllValues(InterfaceHandle handle)
Definition: FederateState.cpp:273
helics::initializationTime
constexpr Time initializationTime
Definition: helicsTime.hpp:40
helics::indicator_flag
@ indicator_flag
flag used for setting values
Definition: flagOperations.hpp:18
helics::FederateState::getState
FederateStates getState() const
Definition: FederateState.cpp:174
helics::FederateState::nextAllowedSendTime
Time nextAllowedSendTime() const
Definition: FederateState.hpp:339
helics::FederateState::global_id
std::atomic< GlobalFederateId > global_id
global id code, default to invalid
Definition: FederateState.hpp:66
helics::returnableResult
bool returnableResult(MessageProcessingResult result)
Definition: CoreTypes.hpp:78
helics::FederateState::getMessageDestinations
std::vector< std::pair< GlobalHandle, std::string_view > > getMessageDestinations(InterfaceHandle handle)
Definition: FederateState.cpp:597
helics::FederateState::interfaces
InterfaceInfo & interfaces()
Definition: FederateState.hpp:170
helics::optional_flag
@ optional_flag
flag indicating that a connection is optional and may not be matched
Definition: flagOperations.hpp:53
helics::FederateState::lastErrorString
const std::string & lastErrorString() const
Definition: FederateState.hpp:350
helics::InterfaceInfo
Definition: InterfaceInfo.hpp:26
helics::SmallBuffer
Definition: SmallBuffer.hpp:24
HELICS_LOG_LEVEL_NO_PRINT
@ HELICS_LOG_LEVEL_NO_PRINT
Definition: helics_enums.h:186
helics::FederateState::receiveAny
std::unique_ptr< Message > receiveAny(InterfaceHandle &id)
Definition: FederateState.cpp:239
helics::FederateState::publicationCount
int publicationCount() const
Definition: FederateState.cpp:1914
helics::FederateState::enterExecutingMode
IterationResult enterExecutingMode(IterationRequest iterate, bool sendRequest=false)
Definition: FederateState.cpp:493
helics::EndpointInfo
Definition: EndpointInfo.hpp:32
core-data.hpp
helics::InterfaceType
InterfaceType
Definition: CoreTypes.hpp:99
helics::FederateState::createInterface
void createInterface(InterfaceType htype, InterfaceHandle handle, std::string_view key, std::string_view type, std::string_view units, uint16_t flags)
Definition: FederateState.cpp:331
helics::FederateState::getCurrentIteration
int32_t getCurrentIteration() const
Definition: FederateState.cpp:179
helics::FederateStates::TERMINATING
@ TERMINATING
the federate is in the process of shutting down
helics::EndpointInfo::id
const GlobalHandle id
identifier for the handle
Definition: EndpointInfo.hpp:40
helics_definitions.hpp
base helics enumerations for C++ API's, a namespace wrapper for the definitions defined in helics_enu...
helics::FederateState::getTimeProperty
Time getTimeProperty(int timeProperty) const
Definition: FederateState.cpp:1832
helics::FederateState::getTagByIndex
const std::pair< std::string, std::string > & getTagByIndex(size_t index) const
Definition: FederateState.hpp:273
helics::CommonCore
Definition: CommonCore.hpp:74
helics::getValue
X getValue(ValueFederate &fed, std::string_view key)
Definition: Subscriptions.hpp:31
helics::FederateState::getOptionFlag
bool getOptionFlag(int optionFlag) const
Definition: FederateState.cpp:1847
helics::InterfaceHandle
Definition: LocalFederateId.hpp:65
helics::async_timing_flag
@ async_timing_flag
flag indicating use of asynchronous timing on a global level
Definition: flagOperations.hpp:81
helics::Time
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
helics::FederateState::reset
void reset()
Definition: FederateState.cpp:156
FORCE_ITERATION
constexpr auto FORCE_ITERATION
simplified alias to force an iteration
Definition: CoreTypes.hpp:114
helics::FederateState::lock
void lock()
Definition: FederateState.hpp:259
helics::FederateState::processQuery
std::string processQuery(std::string_view query, bool force_ordering=false) const
Definition: FederateState.cpp:2328
LogManager.hpp
helics::FederateState::sendCommand
void sendCommand(ActionMessage &command)
Definition: FederateState.cpp:2064
helics::GlobalFederateId
Definition: GlobalFederateId.hpp:72
helics::ActionMessage
Definition: ActionMessage.hpp:30
helics::FederateState::init_transmitted
std::atomic< bool > init_transmitted
the initialization request has been transmitted
Definition: FederateState.hpp:88
helics::FederateState::waitSetup
IterationResult waitSetup()
Definition: FederateState.cpp:432
helics::parent_broker_id
constexpr GlobalBrokerId parent_broker_id
Definition: GlobalFederateId.hpp:64
helics::FederateState::local_id
LocalFederateId local_id
id code for the local federate descriptor
Definition: FederateState.hpp:65
helics::FederateState::reInit
void reInit()
Definition: FederateState.cpp:167
helics::FederateState::getIntegerProperty
int getIntegerProperty(int intProperty) const
Definition: FederateState.cpp:1900
helics::FederateState::lastErrorCode
int lastErrorCode() const noexcept
Definition: FederateState.hpp:352
helics::FederateState::try_lock
bool try_lock() const
Definition: FederateState.hpp:262
helics::ActionMessage::counter
uint16_t counter
26 counter for filter tracking or message counter
Definition: ActionMessage.hpp:41
helics::FederateState::inputCount
int inputCount() const
Definition: FederateState.cpp:1924
helics::FederateState::sleeplock
void sleeplock() const
Definition: FederateState.hpp:243
helics::GlobalHandle::handle
InterfaceHandle handle
the interface handle component
Definition: GlobalFederateId.hpp:147
helics::FederateState::setOptionFlag
void setOptionFlag(int optionFlag, bool value)
Definition: FederateState.cpp:1735
ITERATE_IF_NEEDED
constexpr auto ITERATE_IF_NEEDED
simplified alias to indicate that helics should iterate if warranted
Definition: CoreTypes.hpp:116
helics::FederateState::getIdentifier
const std::string & getIdentifier() const
Definition: FederateState.hpp:166
helics::FederateState::setLogger
void setLogger(std::function< void(int, std::string_view, std::string_view)> logFunction)
Definition: FederateState.cpp:224
helics::FederateState::setTag
void setTag(std::string_view tag, std::string_view value)
Definition: FederateState.cpp:2356
helics::FederateState::grantedTime
Time grantedTime() const
Definition: FederateState.hpp:337
helics::commandErrorString
const char * commandErrorString(int errorCode)
Definition: ActionMessage.cpp:828
helics::FederateState::processPostTerminationAction
std::optional< ActionMessage > processPostTerminationAction(const ActionMessage &action)
Definition: FederateState.cpp:409
helics::EndpointInfo::getMessage
std::unique_ptr< Message > getMessage(Time maxTime)
Definition: EndpointInfo.cpp:85
helics::FederateState::setProperty
void setProperty(int timeProperty, Time propertyVal)
Definition: FederateState.cpp:1657
helics::FederateState::waitCommand
std::pair< std::string, std::string > waitCommand()
Definition: FederateState.cpp:2166
helics::iteration_time::grantedTime
Time grantedTime
the time of the granted step
Definition: helicsTime.hpp:50
helics::IterationRequest
IterationRequest
Definition: CoreTypes.hpp:92
helics::ActionMessage::messageID
int32_t messageID
8 – message ID for a variety of purposes
Definition: ActionMessage.hpp:36
helics::FederateState::genericUnspecifiedQueueProcess
MessageProcessingResult genericUnspecifiedQueueProcess(bool busyReturn)
Definition: FederateState.cpp:805
helics::ActionMessage::setExtraData
void setExtraData(int32_t data)
Definition: ActionMessage.hpp:157
helics::setActionFlag
void setActionFlag(FlagContainer &M, FlagIndex flag)
Definition: flagOperations.hpp:130
helics::FederateState::getQueueSize
uint64_t getQueueSize() const
Definition: FederateState.cpp:215
helics::FederateState::setQueryCallback
void setQueryCallback(std::function< std::string(std::string_view)> queryCallbackFunction)
Definition: FederateState.hpp:426
helics::TimeSynchronizationMethod
TimeSynchronizationMethod
enumeration of possible time coordination methods
Definition: FederateState.hpp:44
helics::FederateState::getDependencies
std::vector< GlobalFederateId > getDependencies() const
Definition: FederateState.cpp:1929
helics::FederateState::unlock
void unlock() const
Definition: FederateState.hpp:264
helics::FederateState::setProperties
void setProperties(const ActionMessage &cmd)
Definition: FederateState.cpp:1550
helics::IterationResult
IterationResult
Definition: CoreTypes.hpp:83
helics::FederateStates::INITIALIZING
@ INITIALIZING
helics::FederateState::getInterfaceFlags
uint16_t getInterfaceFlags() const
Definition: FederateState.hpp:226
helics::FederateState::~FederateState
~FederateState()
helics::FederateState::spinlock
void spinlock() const
Definition: FederateState.hpp:236
helics::ActionMessage::payload
SmallBuffer payload
buffer to contain the data payload
Definition: ActionMessage.hpp:48
helics::ActionMessage::dest_id
GlobalFederateId dest_id
20 fed_id for a targeted message
Definition: ActionMessage.hpp:39
helics::FederateState::endpointCount
int endpointCount() const
Definition: FederateState.cpp:1919
helics::FederateState::processCommunications
void processCommunications(std::chrono::milliseconds period)
Definition: FederateState.cpp:880
helics::prettyPrintString
std::string prettyPrintString(const ActionMessage &command)
Definition: ActionMessage.cpp:846
helics::TimeCoordinator
Definition: TimeCoordinator.hpp:55
helics::FederateState::tagCount
auto tagCount() const
Definition: FederateState.hpp:278
helics::InterfaceInfo::setGlobalId
void setGlobalId(GlobalFederateId newglobalId)
Definition: InterfaceInfo.hpp:67
helics::FederateState::FederateState
FederateState(const std::string &fedName, const CoreFederateInfo &fedInfo)
Definition: FederateState.cpp:106
helics::FederateState::getCommand
std::pair< std::string, std::string > getCommand()
Definition: FederateState.cpp:2151
InterfaceInfo.hpp
helics::FederateState::finalize
void finalize()
Definition: FederateState.cpp:844
helics::FederateState::getTag
const std::string & getTag(std::string_view tag) const
Definition: FederateState.cpp:2370
helics::make_flags
constexpr uint16_t make_flags(unsigned int flag)
Definition: flagOperations.hpp:170
helics::MessageProcessingResult
MessageProcessingResult
Definition: CoreTypes.hpp:64
helics::FederateState
Definition: FederateState.hpp:47
helics::ActionMessage::actionTime
Time actionTime
40 the time an action took place or will take place //32
Definition: ActionMessage.hpp:44
helics::FederateState::init_requested
std::atomic< bool > init_requested
Definition: FederateState.hpp:109
helics::FederateState::forceProcessMessage
void forceProcessMessage(ActionMessage &action)
Definition: FederateState.cpp:422
helics::FederateState::loggingLevel
int loggingLevel() const
Definition: FederateState.cpp:2351
helics::ActionMessage::setDestination
void setDestination(GlobalHandle hand)
Definition: ActionMessage.hpp:99
helics::FederateState::enterInitializingMode
IterationResult enterInitializingMode()
Definition: FederateState.cpp:461
helics::FederateState::routeMessage
void routeMessage(const ActionMessage &msg)
Definition: FederateState.cpp:287
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::CoreFederateInfo
Definition: CoreFederateInfo.hpp:16
helics::iteration_time
Definition: helicsTime.hpp:49
HELICS_LOG_LEVEL_SUMMARY
@ HELICS_LOG_LEVEL_SUMMARY
Definition: helics_enums.h:194
HELICS_SEQUENCING_MODE_FAST
@ HELICS_SEQUENCING_MODE_FAST
Definition: helics_enums.h:397
helics::FederateState::interfaces
const InterfaceInfo & interfaces() const
Definition: FederateState.hpp:172
helics::FederateState::logMessage
void logMessage(int level, std::string_view logMessageSource, std::string_view message, bool fromRemote=false) const
Definition: FederateState.cpp:2006
helics::iteration_requested_flag
@ iteration_requested_flag
Definition: flagOperations.hpp:23
helics::global_timing_flag
@ global_timing_flag
flag indicating to use global timing (overload of indicator flag)
Definition: flagOperations.hpp:76
helics::checkActionFlag
bool checkActionFlag(uint16_t flags, FlagIndex flag)
Definition: flagOperations.hpp:138
helics::FederateStates::EXECUTING
@ EXECUTING
the federation has entered execution state and it now advancing in time
helics::createMessageFromCommand
std::unique_ptr< Message > createMessageFromCommand(const ActionMessage &cmd)
Definition: ActionMessage.cpp:633
helics::PublicationInfo::CheckSetValue
bool CheckSetValue(const char *dataToCheck, uint64_t len, Time currentTime, bool forceChangeCheck)
Definition: PublicationInfo.cpp:16
helics::LocalFederateId
Definition: LocalFederateId.hpp:22
helics::FederateStates::FINISHED
@ FINISHED
the federation has finished its execution
helics::FederateState::addAction
void addAction(const ActionMessage &action)
Definition: FederateState.cpp:317
helics::FederateState::setParent
void setParent(CommonCore *coreObject)
Definition: FederateState.hpp:205
helics::PROFILING
@ PROFILING
profiling log level
Definition: logging.hpp:24
helics::FederateState::requestTime
iteration_time requestTime(Time nextTime, IterationRequest iterate, bool sendRequest=false)
Definition: FederateState.cpp:606
helics::required_flag
@ required_flag
flag indicating that an action or match is required
Definition: flagOperations.hpp:45
helics::ActionMessage::action
action_message_def::action_t action() const noexcept
Definition: ActionMessage.hpp:88
helics::FederateState::getPublishedValue
std::pair< SmallBuffer, Time > getPublishedValue(InterfaceHandle handle)
Definition: FederateState.cpp:278
helics::FederateState::getValue
const std::shared_ptr< const SmallBuffer > & getValue(InterfaceHandle handle, uint32_t *inputIndex)
Definition: FederateState.cpp:266
helics::error_flag
@ error_flag
flag indicating an error condition associated with the command
Definition: flagOperations.hpp:17
helics::FederateState::closeInterface
void closeInterface(InterfaceHandle handle, InterfaceType type)
Definition: FederateState.cpp:367
helics::FederateState::getSubscribers
std::vector< GlobalHandle > getSubscribers(InterfaceHandle handle)
Definition: FederateState.cpp:586
helics::FederateState::setInterfaceProperty
void setInterfaceProperty(const ActionMessage &cmd)
Definition: FederateState.cpp:1591
helics::FederateState::getDependents
std::vector< GlobalFederateId > getDependents() const
Definition: FederateState.cpp:1934
helics::EndpointInfo::availableMessages
int32_t availableMessages() const
Definition: EndpointInfo.cpp:130
CoreTypes.hpp
helicsTime.hpp
helics::FederateStates::ERRORED
@ ERRORED
the federation has encountered an error
helics::ActionMessage::setSource
void setSource(GlobalHandle hand)
Definition: ActionMessage.hpp:93
helics::FederateStates
FederateStates
Definition: CoreTypes.hpp:21
helics::FederateState::checkAndSetValue
bool checkAndSetValue(InterfaceHandle pub_id, const char *data, uint64_t len)
Definition: FederateState.cpp:184
helics::fedStateString
const std::string & fedStateString(FederateStates state)
Definition: FederateState.cpp:2035
helics::FederateStates::UNKNOWN
@ UNKNOWN
unknown state
helics::FederateState::getHandleOption
int32_t getHandleOption(InterfaceHandle handle, char iType, int32_t option) const
Definition: FederateState.cpp:1884
helics::ActionMessage::source_id
GlobalFederateId source_id
12 – for federate_id or route_id
Definition: ActionMessage.hpp:37
helics::bufferToJson
void bufferToJson(const LogBuffer &buffer, Json::Value &base)
Definition: LogBuffer.cpp:60
helics::FederateState::setCoreObject
void setCoreObject(CommonCore *parent)
Definition: FederateState.cpp:1999
helics::setIterationFlags
void setIterationFlags(ActionMessage &command, IterationRequest iterate)
Definition: ActionMessage.cpp:936
helics::generateJsonErrorResponse
std::string generateJsonErrorResponse(JsonErrorCodes code, const std::string &message)
Definition: JsonGeneration.hpp:36