helics
3.5.3
|
#include <CommonCore.hpp>
Public Member Functions | |
CommonCore () noexcept | |
CommonCore (bool arg) noexcept | |
CommonCore (std::string_view coreName) | |
virtual | ~CommonCore () override |
virtual void | configure (std::string_view configureString) override final |
virtual void | configureFromArgs (int argc, char *argv[]) override final |
virtual void | configureFromVector (std::vector< std::string > args) override final |
virtual bool | isConfigured () const override final |
virtual bool | isOpenToNewFederates () const override final |
virtual bool | hasError () const override final |
virtual void | globalError (LocalFederateId federateID, int errorCode, std::string_view errorString) override final |
virtual void | localError (LocalFederateId federateID, int errorCode, std::string_view errorString) override final |
virtual int | getErrorCode () const override final |
virtual std::string | getErrorMessage () const override final |
virtual void | finalize (LocalFederateId federateID) override final |
virtual bool | enterInitializingMode (LocalFederateId federateID, IterationRequest request) override final |
virtual void | setCoreReadyToInit () override final |
virtual iteration_time | enterExecutingMode (LocalFederateId federateID, IterationRequest iterate=NO_ITERATION) override final |
virtual LocalFederateId | registerFederate (std::string_view name, const CoreFederateInfo &info) override final |
virtual const std::string & | getFederateName (LocalFederateId federateID) const override final |
virtual LocalFederateId | getFederateId (std::string_view name) const override final |
virtual int32_t | getFederationSize () override final |
virtual Time | timeRequest (LocalFederateId federateID, Time next) override final |
virtual iteration_time | requestTimeIterative (LocalFederateId federateID, Time next, IterationRequest iterate) override final |
virtual void | processCommunications (LocalFederateId federateID, std::chrono::milliseconds msToWait) override final |
virtual Time | getCurrentTime (LocalFederateId federateID) const override final |
virtual void | setTimeProperty (LocalFederateId federateID, int32_t property, Time time) override final |
virtual void | setIntegerProperty (LocalFederateId federateID, int32_t property, int16_t propertyValue) override final |
virtual Time | getTimeProperty (LocalFederateId federateID, int32_t property) const override final |
virtual int16_t | getIntegerProperty (LocalFederateId federateID, int32_t property) const override final |
virtual void | setFlagOption (LocalFederateId federateID, int32_t flag, bool flagValue=true) override final |
virtual bool | getFlagOption (LocalFederateId federateID, int32_t flag) const override final |
virtual InterfaceHandle | registerPublication (LocalFederateId federateID, std::string_view key, std::string_view type, std::string_view units) override final |
virtual InterfaceHandle | getPublication (LocalFederateId federateID, std::string_view key) const override final |
virtual InterfaceHandle | registerInput (LocalFederateId federateID, std::string_view key, std::string_view type, std::string_view units) override final |
virtual InterfaceHandle | getInput (LocalFederateId federateID, std::string_view key) const override final |
virtual const std::string & | getHandleName (InterfaceHandle handle) const override final |
virtual void | setHandleOption (InterfaceHandle handle, int32_t option, int32_t option_value) override final |
virtual int32_t | getHandleOption (InterfaceHandle handle, int32_t option) const override final |
virtual void | closeHandle (InterfaceHandle handle) override final |
virtual void | removeTarget (InterfaceHandle handle, std::string_view targetToRemove) override final |
virtual void | addDestinationTarget (InterfaceHandle handle, std::string_view dest, InterfaceType hint) override final |
virtual void | addSourceTarget (InterfaceHandle handle, std::string_view name, InterfaceType hint) override final |
virtual const std::string & | getDestinationTargets (InterfaceHandle handle) const override final |
virtual const std::string & | getSourceTargets (InterfaceHandle handle) const override final |
virtual const std::string & | getInjectionUnits (InterfaceHandle handle) const override final |
virtual const std::string & | getExtractionUnits (InterfaceHandle handle) const override final |
virtual const std::string & | getInjectionType (InterfaceHandle handle) const override final |
virtual const std::string & | getExtractionType (InterfaceHandle handle) const override final |
virtual void | setValue (InterfaceHandle handle, const char *data, uint64_t len) override final |
virtual const std::shared_ptr< const SmallBuffer > & | getValue (InterfaceHandle handle, uint32_t *inputIndex) override final |
virtual const std::vector< std::shared_ptr< const SmallBuffer > > & | getAllValues (InterfaceHandle handle) override final |
virtual const std::vector< InterfaceHandle > & | getValueUpdates (LocalFederateId federateID) override final |
virtual InterfaceHandle | registerEndpoint (LocalFederateId federateID, std::string_view name, std::string_view type) override final |
virtual InterfaceHandle | registerTargetedEndpoint (LocalFederateId federateID, std::string_view name, std::string_view type) override final |
virtual InterfaceHandle | getEndpoint (LocalFederateId federateID, std::string_view name) const override final |
virtual InterfaceHandle | registerDataSink (LocalFederateId federateID, std::string_view name) override final |
virtual InterfaceHandle | getDataSink (LocalFederateId federateID, std::string_view name) const override final |
virtual InterfaceHandle | registerFilter (std::string_view filterName, std::string_view type_in, std::string_view type_out) override final |
virtual InterfaceHandle | registerCloningFilter (std::string_view filterName, std::string_view type_in, std::string_view type_out) override final |
virtual InterfaceHandle | registerTranslator (std::string_view translatorName, std::string_view endpointType, std::string_view units) override final |
virtual InterfaceHandle | getFilter (std::string_view name) const override final |
virtual InterfaceHandle | getTranslator (std::string_view name) const override final |
virtual void | addDependency (LocalFederateId federateID, std::string_view federateName) override final |
virtual void | linkEndpoints (std::string_view source, std::string_view dest) override final |
virtual void | addAlias (std::string_view interfaceKey, std::string_view alias) override final |
virtual void | makeConnections (const std::string &file) override final |
virtual void | dataLink (std::string_view source, std::string_view target) override final |
virtual void | addSourceFilterToEndpoint (std::string_view filter, std::string_view endpoint) override final |
virtual void | addDestinationFilterToEndpoint (std::string_view filter, std::string_view endpoint) override final |
virtual void | send (InterfaceHandle sourceHandle, const void *data, uint64_t length) override final |
virtual void | sendAt (InterfaceHandle sourceHandle, const void *data, uint64_t length, Time time) override final |
virtual void | sendTo (InterfaceHandle sourceHandle, const void *data, uint64_t length, std::string_view destination) override final |
virtual void | sendToAt (InterfaceHandle sourceHandle, const void *data, uint64_t length, std::string_view destination, Time time) override final |
virtual void | sendMessage (InterfaceHandle sourceHandle, std::unique_ptr< Message > message) override final |
virtual uint64_t | receiveCount (InterfaceHandle destination) override final |
virtual std::unique_ptr< Message > | receive (InterfaceHandle destination) override final |
virtual std::unique_ptr< Message > | receiveAny (LocalFederateId federateID, InterfaceHandle &endpoint_id) override final |
virtual uint64_t | receiveCountAny (LocalFederateId federateID) override final |
virtual void | logMessage (LocalFederateId federateID, int logLevel, std::string_view messageToLog) override final |
virtual void | setFilterOperator (InterfaceHandle filter, std::shared_ptr< FilterOperator > callback) override final |
virtual void | setTranslatorOperator (InterfaceHandle translator, std::shared_ptr< TranslatorOperator > callbacks) override final |
virtual void | setFederateOperator (LocalFederateId federateID, std::shared_ptr< FederateOperator > callback) override |
void | setIdentifier (std::string_view name) |
virtual const std::string & | getIdentifier () const override final |
virtual const std::string & | getAddress () const override final |
const std::string & | getFederateNameNoThrow (GlobalFederateId federateID) const noexcept |
virtual void | setLoggingLevel (int logLevel) override |
virtual void | setLoggingCallback (LocalFederateId federateID, std::function< void(int, std::string_view, std::string_view)> logFunction) override final |
virtual void | setLogFile (std::string_view lfile) override final |
virtual std::string | query (std::string_view target, std::string_view queryStr, HelicsSequencingModes mode) override |
virtual void | setQueryCallback (LocalFederateId federateID, std::function< std::string(std::string_view)> queryFunction, int order) override |
virtual void | setGlobal (std::string_view valueName, std::string_view value) override |
virtual void | sendCommand (std::string_view target, std::string_view commandStr, std::string_view source, HelicsSequencingModes mode) override |
virtual std::pair< std::string, std::string > | getCommand (LocalFederateId federateID) override |
virtual std::pair< std::string, std::string > | waitCommand (LocalFederateId federateID) override |
virtual bool | connect () override final |
virtual bool | isConnected () const override final |
virtual void | disconnect () override final |
virtual bool | waitForDisconnect (std::chrono::milliseconds msToWait=std::chrono::milliseconds(0)) const override final |
void | unregister () |
virtual void | processDisconnect (bool skipUnregister=false) override final |
void | checkInFlightQueriesForDisconnect () |
virtual void | setInterfaceInfo (InterfaceHandle handle, std::string_view info) override final |
virtual const std::string & | getInterfaceInfo (InterfaceHandle handle) const override final |
virtual void | setInterfaceTag (InterfaceHandle handle, std::string_view tag, std::string_view value) override final |
virtual const std::string & | getInterfaceTag (InterfaceHandle handle, std::string_view tag) const override final |
virtual void | setFederateTag (LocalFederateId fid, std::string_view tag, std::string_view value) override final |
virtual const std::string & | getFederateTag (LocalFederateId fid, std::string_view tag) const override final |
Public Member Functions inherited from helics::Core | |
Core ()=default | |
virtual | ~Core ()=default |
virtual void | globalError (LocalFederateId federateID, int32_t errorCode, std::string_view errorString)=0 |
virtual void | localError (LocalFederateId federateID, int32_t errorCode, std::string_view errorString)=0 |
Public Member Functions inherited from helics::BrokerBase | |
BrokerBase (bool DisableQueue=false) noexcept | |
BrokerBase (std::string_view broker_name, bool DisableQueue=false) | |
int | parseArgs (int argc, char *argv[]) |
int | parseArgs (std::vector< std::string > args) |
int | parseArgs (std::string_view initializationString) |
virtual void | configureBase () |
void | addActionMessage (const ActionMessage &message) |
void | addActionMessage (ActionMessage &&message) |
void | setLoggerFunction (std::function< void(int level, std::string_view identifier, std::string_view message)> logFunction) |
void | logFlush () |
bool | isRunning () const |
void | setLogLevel (int32_t level) |
void | setLogLevels (int32_t consoleLevel, int32_t fileLevel) |
GlobalBrokerId | getGlobalId () const |
std::function< void(int, std::string_view, std::string_view)> | getLoggingCallback () const |
void | joinAllThreads () |
std::size_t | currentMessageCounter () const |
Protected Member Functions | |
virtual void | processCommand (ActionMessage &&command) override final |
virtual void | processPriorityCommand (ActionMessage &&command) override final |
virtual void | transmit (route_id rid, const ActionMessage &command)=0 |
virtual void | transmit (route_id rid, ActionMessage &&command)=0 |
virtual void | addRoute (route_id rid, int interfaceId, std::string_view routeInfo)=0 |
virtual void | removeRoute (route_id rid)=0 |
FederateState * | getFederateAt (LocalFederateId federateID) const |
FederateState * | getFederate (std::string_view federateName) const |
FederateState * | getHandleFederate (InterfaceHandle handle) |
const BasicHandleInfo * | getHandleInfo (InterfaceHandle handle) const |
const BasicHandleInfo * | getLocalEndpoint (std::string_view name) const |
bool | allInitReady () const |
bool | allDisconnected () const |
OperatingState | minFederateState () const |
virtual double | getSimulationTime () const override |
Protected Member Functions inherited from helics::BrokerBase | |
void | setTickForwarding (TickForwardingReasons reason, bool value=true) |
BrokerState | getBrokerState () const |
bool | setBrokerState (BrokerState newState) |
bool | transitionBrokerState (BrokerState expectedState, BrokerState newState) |
virtual bool | tryReconnect ()=0 |
bool | sendToLogger (GlobalFederateId federateID, int logLevel, std::string_view name, std::string_view message, bool fromRemote=false) const |
void | saveProfilingData (std::string_view message) |
void | writeProfilingData () |
void | generateNewIdentifier () |
virtual std::string | generateLocalAddressString () const =0 |
virtual std::shared_ptr< helicsCLI11App > | generateCLI () |
void | setErrorState (int eCode, std::string_view estring) |
void | setLoggingFile (std::string_view lfile) |
bool | getFlagValue (int32_t flag) const |
std::pair< bool, std::vector< std::string_view > > | processBaseCommands (ActionMessage &command) |
void | addBaseInformation (Json::Value &base, bool hasParent) const |
Friends | |
class | TimeoutMonitor |
Additional Inherited Members | |
Protected Types inherited from helics::BrokerBase | |
enum class | BrokerState : int16_t { CREATED = -10 , CONFIGURING = -7 , CONFIGURED = -6 , CONNECTING = -4 , CONNECTED = -3 , INITIALIZING = -1 , OPERATING = 0 , CONNECTED_ERROR = 3 , TERMINATING = 4 , TERMINATING_ERROR = 5 , TERMINATED = 6 , ERRORED = 7 } |
enum class | TickForwardingReasons : uint32_t { NONE = 0 , NO_COMMS = 0x01 , PING_RESPONSE = 0x02 , QUERY_TIMEOUT = 0x04 , GRANT_TIMEOUT = 0x08 , DISCONNECT_TIMEOUT = 0x10 } |
Static Protected Member Functions inherited from helics::BrokerBase | |
static bool | isReasonForTick (std::uint32_t code, TickForwardingReasons reason) |
Protected Attributes inherited from helics::BrokerBase | |
std::atomic< GlobalBrokerId > | global_id {parent_broker_id} |
GlobalBrokerId | global_broker_id_local {} |
GlobalBrokerId | higher_broker_id {0} |
the id code of the broker 1 level about this broker | |
std::atomic< int32_t > | maxLogLevel {HELICS_LOG_LEVEL_NO_PRINT} |
int32_t | minFederateCount {1} |
int32_t | minBrokerCount {0} |
int32_t | maxFederateCount {(std::numeric_limits<int32_t>::max)()} |
int32_t | maxBrokerCount {(std::numeric_limits<int32_t>::max)()} |
int32_t | minChildCount {0} |
int32_t | maxIterationCount {10000} |
the maximum number of iterative loops that are allowed | |
Time | tickTimer {5.0} |
the length of each heartbeat tick | |
Time | timeout {30.0} |
timeout to wait to establish a broker connection before giving up | |
Time | networkTimeout {-1.0} |
timeout to establish a socket connection before giving up | |
Time | queryTimeout {15.0} |
Time | errorDelay {0.0} |
time to delay before terminating after error state | |
Time | grantTimeout {-1.0} |
timeout for triggering diagnostic action waiting for a time grant | |
Time | maxCoSimDuration {-1.0} |
the maximum lifetime (wall clock time) of the co-simulation | |
std::string | identifier |
an identifier for the broker | |
std::string | brokerKey |
std::string | address |
network location of the broker | |
std::thread | queueProcessingThread |
std::atomic< bool > | haltOperations {false} |
flag indicating that no further message should be processed | |
bool | restrictive_time_policy {false} |
flag indicating the broker should use a conservative time policy | |
bool | terminate_on_error {false} |
flag indicating that the federation should halt on any error | |
bool | debugging {false} |
flag indicating operation in a user debugging mode | |
bool | observer {false} |
flag indicating that the broker is an observer only | |
bool | globalTime {false} |
flag indicating that the broker should use a global time coordinator | |
bool | asyncTime {false} |
flag indicating the use of async time keeping | |
bool | dynamicFederation {false} |
flag indicating that the broker supports dynamic federates | |
bool | disableDynamicSources {false} |
flag disabling dynamic data sources | |
std::unique_ptr< BaseTimeCoordinator > | timeCoord |
object managing the time control | |
gmlc::containers::BlockingPriorityQueue< ActionMessage > | actionQueue |
primary routing queue | |
std::shared_ptr< LogManager > | mLogManager |
object to handle the logging considerations | |
bool | noAutomaticID {false} |
the broker should not automatically generate an ID | |
bool | hasTimeDependency {false} |
bool | enteredExecutionMode {false} |
flag indicating that the broker has entered execution mode | |
bool | waitingForBrokerPingReply {false} |
flag indicating we are waiting for a ping reply | |
bool | hasFilters {false} |
flag indicating filters come through the broker | |
bool | no_ping {false} |
indicator that the broker is not very responsive to ping requests | |
bool | uuid_like {false} |
will be set to true if the name looks like a uuid | |
bool | useJsonSerialization {false} |
bool | enable_profiling {false} |
indicator that profiling is enabled | |
bool | allowRemoteControl {true} |
bool | errorOnUnmatchedConnections {false} |
error if there are unmatched connections on init | |
decltype(std::chrono::steady_clock::now()) | errorTimeStart |
time when the error condition started; related to the errorDelay | |
decltype(std::chrono::steady_clock::now()) | disconnectTime |
time when the disconnect started | |
std::atomic< int > | lastErrorCode {0} |
storage for last error code | |
std::string | lastErrorString |
storage for last error string | |
Static Protected Attributes inherited from helics::BrokerBase | |
static constexpr double | mInvalidSimulationTime {-98763.2} |
base class implementing a standard interaction strategy between federates
the CommonCore is virtual class that manages local federates and handles most of the interaction between federate it is meant to be instantiated for specific inter-federate communication strategies
|
noexcept |
default constructor
|
explicitnoexcept |
function mainly to match some other object constructors does the same thing as the default constructor
|
explicit |
construct from a core name
|
overridevirtual |
virtual destructor
References helics::BrokerBase::joinAllThreads().
|
finaloverridevirtual |
add an interface alias This allows an interface to be referred to by multiple keys
interfaceKey | the name of the interface to generate an alias for |
alias | the additional identification string |
Implements helics::Core.
References helics::BrokerBase::addActionMessage().
|
finaloverridevirtual |
add a time dependency between federates
this function is primarily useful for Message federates which do not otherwise restrict the dependencies adding a dependency gives additional information to the core that the specified federate(given by id) will be sending Messages to the named Federate(by federateName)
federateID | the identifier for the federate |
federateName | the name of the dependent federate |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), getFederateAt(), helics::FederateState::global_id, helics::ActionMessage::name(), and helics::ActionMessage::source_id.
|
finaloverridevirtual |
create a filter connection between a named filter and a named endpoint for destination processing
filter | the name of the filter |
target | the name of the source target |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::destination_target, helics::ActionMessage::name(), and helics::setActionFlag().
|
finaloverridevirtual |
adds a destination for interface data, the handle can be a publication, endpoint, filter, or translators
a filter will create an additional processing step for messages before they get to a destination endpoint, for publications this will establish a linkage from the publication to the named input
handle | an interface to add the target to |
dest | the target endpoint for the filter |
hint | the interface type for the destination target |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::checkActionFlag(), helics::clone_flag, helics::ActionMessage::counter, helics::destination_target, helics::ENDPOINT, helics::FILTER, helics::ActionMessage::flags, getHandleInfo(), helics::INPUT, helics::ActionMessage::payload, helics::PUBLICATION, helics::receive_only_flag, helics::ActionMessage::setAction(), helics::setActionFlag(), helics::ActionMessage::setSource(), helics::SINK, and helics::TRANSLATOR.
|
protectedpure virtual |
add a route to whatever internal structure manages the routes
rid | the identification of the route |
interfaceId | an interface id code that can be used to identify the interface route should be added to, in most cases this should be zero since there is only one interface |
routeInfo | a string containing the information necessary to connect |
|
finaloverridevirtual |
create a filter connection between a named filter and a named endpoint for messages coming from that endpoint
filter | the name of the filter |
target | the name of the source target |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), and helics::ActionMessage::name().
|
finaloverridevirtual |
adds a source of data to an interface, the handle can be an input, filter, translator, or endpoint
for subscriptions and inputs this establishes a link from a publication, for endpoints this creates a linkage to a particular publication, for filters it add a source endpoint to filter
handle | the identifier of the interface |
name | the name of the filter or its target |
hint | the interface type for the source target |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::checkActionFlag(), helics::clone_flag, helics::ActionMessage::counter, helics::ENDPOINT, helics::FILTER, helics::ActionMessage::flags, getHandleInfo(), helics::INPUT, helics::ActionMessage::payload, helics::PUBLICATION, helics::ActionMessage::setAction(), helics::setActionFlag(), helics::ActionMessage::setSource(), helics::SINK, helics::source_only_flag, and helics::TRANSLATOR.
|
protected |
check if all connections are disconnected (feds and time dependencies)
References minFederateState().
|
protected |
check if all federates managed by the core are ready to enter initialization state
References helics::BrokerBase::minChildCount, and helics::BrokerBase::minFederateCount.
void helics::CommonCore::checkInFlightQueriesForDisconnect | ( | ) |
check to make sure there are no in-flight queries that need to be resolved before disconnect
References helics::BrokerBase::global_broker_id_local.
|
finaloverridevirtual |
close a handle from further connections
handle | the handle from the publication, input, endpoint or filter |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::checkActionFlag(), helics::disconnected_flag, getHandleInfo(), helics::ActionMessage::messageID, helics::setActionFlag(), and helics::ActionMessage::setSource().
|
finaloverridevirtual |
Configure the core from a configuration string
Should be invoked a single time to initialize the co-simulation core.
Implements helics::Core.
References helics::BrokerBase::configureBase(), helics::BrokerBase::CONFIGURING, helics::BrokerBase::CREATED, and helics::BrokerBase::parseArgs().
|
finaloverridevirtual |
Configure the core from command line arguments.
Should be invoked a single time to configure the co-simulation core for operation
Implements helics::Core.
References helics::BrokerBase::configureBase(), helics::BrokerBase::CONFIGURING, helics::BrokerBase::CREATED, and helics::BrokerBase::parseArgs().
|
finaloverridevirtual |
Configure the core from command line arguments contained in a vector in reverse order
Should be invoked a single time to configure the co-simulation core for operations
Implements helics::Core.
References helics::BrokerBase::configureBase(), helics::BrokerBase::CONFIGURING, helics::BrokerBase::CREATED, and helics::BrokerBase::parseArgs().
|
finaloverridevirtual |
connect the core to a broker if needed
Implements helics::Core.
References helics::BrokerBase::brokerKey, helics::BrokerBase::CONFIGURED, helics::BrokerBase::CONNECTED, helics::BrokerBase::CONNECTING, helics::core_flag, helics::BrokerBase::ERRORED, getAddress(), getIdentifier(), helics::ActionMessage::name(), helics::BrokerBase::no_ping, helics::BrokerBase::observer, helics::observer_flag, helics::setActionFlag(), helics::slow_responding_flag, helics::ActionMessage::source_id, helics::BrokerBase::timeout, transmit(), helics::use_json_serialization_flag, and helics::BrokerBase::useJsonSerialization.
|
finaloverridevirtual |
create a data connection between a named publication and a named input
source | the name of the publication |
target | the name of the input |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), and helics::ActionMessage::name().
|
finaloverridevirtual |
disconnect the core from its broker
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), and waitForDisconnect().
|
finaloverridevirtual |
Change the federate state to the Executing state.
May only be invoked in Initializing state.
federateID | the identifier of the federate |
iterate | the requested iteration mode if nonconverged the federate requests an iterative update |
Implements helics::Core.
References helics::FederateState::addAction(), helics::BrokerBase::addActionMessage(), helics::BrokerBase::CONNECTED_ERROR, helics::ActionMessage::dest_id, helics::FederateState::enterExecutingMode(), helics::BrokerBase::ERRORED, helics::EXECUTING, getFederateAt(), helics::FederateState::getState(), helics::FederateState::global_id, helics::FederateState::grantedTime(), helics::indicator_flag, helics::INITIALIZING, helics::FederateState::isCallbackFederate(), helics::NEXT_STEP, helics::setActionFlag(), helics::setIterationFlags(), helics::ActionMessage::source_id, helics::BrokerBase::TERMINATED, helics::BrokerBase::TERMINATING, and helics::BrokerBase::TERMINATING_ERROR.
|
finaloverridevirtual |
Federates may be in five Modes.
federateID | the identifier of the federate |
iterate | the requested iteration mode, ITERATE_IF_NEEDED will operate identically to FORCE_ITERATION in this case |
May only be invoked in Created state otherwise an error is thrown for callback federates this call passes full control to the core
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::FederateState::enterInitializingMode(), helics::ERROR_CONDITION, finalize(), helics::FORCE_ITERATION, getFederateAt(), helics::FederateState::getState(), helics::FederateState::global_id, helics::HALT_OPERATIONS, helics::HALTED, helics::INITIALIZING, helics::FederateState::initRequested, helics::FederateState::isCallbackFederate(), helics::ITERATE_IF_NEEDED, helics::ITERATING, helics::NEXT_STEP, helics::NO_ITERATIONS, helics::setIterationFlags(), and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Federate has completed.
Should be invoked a single time to complete the simulation.
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::dest_id, helics::BrokerBase::ERRORED, getFederateAt(), helics::ActionMessage::source_id, helics::BrokerBase::TERMINATED, helics::BrokerBase::TERMINATING, and helics::BrokerBase::TERMINATING_ERROR.
Referenced by enterInitializingMode().
|
finaloverridevirtual |
get the connection network or connection address for the core
Implements helics::Core.
References helics::BrokerBase::address, helics::BrokerBase::CONNECTED, and helics::BrokerBase::generateLocalAddressString().
Referenced by connect().
|
finaloverridevirtual |
Return all the available data for the specified handle or the latest input
Implements helics::Core.
References helics::FederateState::getAllValues(), getFederateAt(), getHandleInfo(), and helics::INPUT.
|
overridevirtual |
get a command for a specific federate
Implements helics::Core.
References helics::FederateState::getCommand(), and getFederateAt().
|
finaloverridevirtual |
get the most recent granted Time
federateID | the identifier of the federate to get the time |
Implements helics::Core.
References getFederateAt(), and helics::FederateState::grantedTime().
|
finaloverridevirtual |
get an interface handle to a data sink
federateID | the identifier for the federate |
name | the name of the data sink |
Implements helics::Core.
References helics::SINK.
|
finaloverridevirtual |
get the destinations for an interface
handle | an interface get the destination targets for |
Implements helics::Core.
References helics::ENDPOINT, helics::FILTER, helics::EndpointInfo::getDestinationTargets(), getFederateAt(), getHandleInfo(), helics::INPUT, helics::FederateState::interfaces(), and helics::PUBLICATION.
|
finaloverridevirtual |
get an endpoint Handle from its name
federateID | the identifier for the federate |
name | the name of the endpoint |
Implements helics::Core.
References helics::ENDPOINT.
|
finaloverridevirtual |
get the last error code from a core
Implements helics::Core.
References helics::BrokerBase::lastErrorCode.
|
finaloverridevirtual |
get the last error message
Implements helics::Core.
References helics::BrokerBase::lastErrorCode, and helics::BrokerBase::lastErrorString.
|
finaloverridevirtual |
get the type for which data comes out of an interface, this is the type for data coming into an interface
for filters this is the output type, for publications this is the specified type, for endpoints this is the specified type and for inputs this is the specified type
handle | the interface handle to get the injection type for |
Implements helics::Core.
References helics::ENDPOINT, helics::FILTER, getHandleInfo(), helics::INPUT, and helics::PUBLICATION.
|
finaloverridevirtual |
Implements helics::Core.
References getHandleInfo(), helics::INPUT, and helics::PUBLICATION.
|
protected |
get the federate Information from the federateID
Referenced by sendCommand().
|
protected |
get the federate Information from the federateID
References helics::LocalFederateId::baseValue().
Referenced by addDependency(), enterExecutingMode(), enterInitializingMode(), finalize(), getAllValues(), getCommand(), getCurrentTime(), getDestinationTargets(), getFederateName(), getFederateTag(), getInjectionType(), getInjectionUnits(), getIntegerProperty(), getSourceTargets(), getTimeProperty(), getValue(), getValueUpdates(), logMessage(), processCommunications(), receiveAny(), receiveCountAny(), removeTarget(), requestTimeIterative(), send(), sendAt(), sendMessage(), sendTo(), sendToAt(), setFederateOperator(), setFederateTag(), setIntegerProperty(), setLoggingCallback(), setQueryCallback(), setTimeProperty(), setValue(), timeRequest(), and waitCommand().
|
finaloverridevirtual |
|
finaloverridevirtual |
Returns the federate name.
Implements helics::Core.
References getFederateAt(), and helics::FederateState::getIdentifier().
|
finaloverridevirtual |
getter for the federate tags
fid | the identifier for the federate to get the tag data for |
tag | the name of the tag to retrieve |
Implements helics::Core.
References getFederateAt(), helics::gLocalCoreId(), HELICS_SEQUENCING_MODE_ORDERED, and query().
|
finaloverridevirtual |
Returns the global number of federates that are registered only return accurately after the initialization state has been entered
Implements helics::Core.
References helics::BrokerBase::OPERATING.
|
finaloverridevirtual |
get a filter Handle from its name or target(this may not be unique so it will only find the first one)
name | the name of the filter or its target |
Implements helics::Core.
References helics::FILTER.
|
finaloverridevirtual |
Set a flag in a a federate
federateID | the identifier for the federate |
flag | an index code for the flag to set |
Implements helics::Core.
References helics::DUMPLOG, helics::BrokerBase::getFlagValue(), and helics::gLocalCoreId().
|
protected |
get the federate Information from a handle
handle | a handle identifier as generated by the one of the functions |
Referenced by receive(), receiveCount(), and setHandleOption().
|
protected |
get the basic handle information
References helics::InterfaceHandle::baseValue().
Referenced by addDestinationTarget(), addSourceTarget(), closeHandle(), getAllValues(), getDestinationTargets(), getExtractionType(), getExtractionUnits(), getHandleName(), getHandleOption(), getInjectionType(), getInjectionUnits(), getInterfaceInfo(), getInterfaceTag(), getSourceTargets(), getValue(), removeTarget(), send(), sendAt(), sendMessage(), sendTo(), sendToAt(), setFilterOperator(), setHandleOption(), setInterfaceTag(), setTranslatorOperator(), and setValue().
|
finaloverridevirtual |
Returns the name or identifier for a specified handle
Implements helics::Core.
References getHandleInfo().
|
finaloverridevirtual |
get a handle option
handle | the handle from the publication, input, endpoint or filter |
option | the option to set see /ref defs::options |
Implements helics::Core.
References getHandleInfo().
|
finaloverridevirtual |
get the local identifier for the core
Implements helics::Core.
References helics::BrokerBase::identifier.
Referenced by connect(), processDisconnect(), query(), registerFederate(), sendCommand(), and helics::TimeoutMonitor::tick().
|
finaloverridevirtual |
get the injection type for an interface, this is the type for data coming into an interface
for filters this is the input type, for publications this is type used to transmit data, for endpoints this is the specified type and for inputs this is the type of the transmitting publication
handle | the interface handle to get the injection type for |
Implements helics::Core.
References helics::ENDPOINT, helics::FILTER, getFederateAt(), getHandleInfo(), helics::INPUT, and helics::FederateState::interfaces().
|
finaloverridevirtual |
get the injection units for an interface, this is the type for data coming into an interface
for publications this is the units associated with the transmitted data, for inputs this is the units of the transmitting publication
handle | the interface handle to get the injection type for |
Implements helics::Core.
References getFederateAt(), getHandleInfo(), helics::INPUT, helics::FederateState::interfaces(), and helics::PUBLICATION.
|
finaloverridevirtual |
get a subscription Handle from its key
federateID | the identifier for the federate |
key | the tag of the named input |
Implements helics::Core.
References helics::INPUT.
|
finaloverridevirtual |
get an integer property on a federate
federateID | the federate to set a time based property on |
property | the property to set see /ref defs::properties |
Implements helics::Core.
References getFederateAt(), helics::FederateState::getIntegerProperty(), helics::gLocalCoreId(), HELICS_PROPERTY_INT_CONSOLE_LOG_LEVEL, HELICS_PROPERTY_INT_FILE_LOG_LEVEL, HELICS_PROPERTY_INT_LOG_BUFFER, HELICS_PROPERTY_INT_LOG_LEVEL, and helics::BrokerBase::mLogManager.
|
finaloverridevirtual |
get the local information field of the interface
Implements helics::Core.
References getHandleInfo().
|
finaloverridevirtual |
getter for the interface tags
handle | the identifier for the interface to set the info data on |
tag | the name of the tag to retrieve |
Implements helics::Core.
References getHandleInfo().
|
protected |
get a localEndpoint from the name
References helics::ENDPOINT.
|
finaloverridevirtual |
get a publication Handle from its key
federateID | the identifier for the federate |
key | the name of the publication |
Implements helics::Core.
References helics::PUBLICATION.
|
overrideprotectedvirtual |
virtual function to return the current simulation time
Reimplemented from helics::BrokerBase.
|
finaloverridevirtual |
get the sources of data for an interface
handle | the identifier of the interface |
Implements helics::Core.
References helics::ENDPOINT, helics::FILTER, getFederateAt(), getHandleInfo(), helics::EndpointInfo::getSourceTargets(), helics::INPUT, helics::FederateState::interfaces(), helics::PUBLICATION, and helics::SINK.
|
finaloverridevirtual |
get a timebased property on a federate
federateID | the federate to set a time based property on |
property | the property to set see /ref defs::properties |
Implements helics::Core.
References getFederateAt(), and helics::FederateState::getTimeProperty().
|
finaloverridevirtual |
get a translator handle from its name or target (this may not be unique so it will only find the first one)
name | the name of the translator or its target |
Implements helics::Core.
References helics::TRANSLATOR.
|
finaloverridevirtual |
Return the data for the specified handle or the latest input
handle | the input handle from which to get the data | |
[out] | inputIndex | return the index of input (always 1 for inputs with only a single source) |
Implements helics::Core.
References getFederateAt(), getHandleInfo(), helics::FederateState::getValue(), and helics::INPUT.
|
finaloverridevirtual |
Returns vector of input handles that received an update during the last time request. The data remains valid until the next call to getValueUpdates for the given federateID
federateID | the identification code of the federate to get which interfaces have been updated |
Implements helics::Core.
References helics::FederateState::getEvents(), and getFederateAt().
|
finaloverridevirtual |
Returns true if the core has been configured.
Implements helics::Core.
References helics::BrokerBase::CONFIGURED.
|
finaloverridevirtual |
check if the core is connected properly
Implements helics::Core.
References helics::BrokerBase::CONNECTED, and helics::BrokerBase::CONNECTED_ERROR.
Referenced by helics::TimeoutMonitor::tick().
|
finaloverridevirtual |
check if the core is ready to accept new federates
Implements helics::Core.
References helics::BrokerBase::CREATED, helics::BrokerBase::dynamicFederation, helics::BrokerBase::OPERATING, and helics::BrokerBase::TERMINATING.
|
finaloverridevirtual |
Register communicating source/destination endpoint targets.
source | the endpoint that is sending data |
dest | the endpoint receiving the data |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), and helics::ActionMessage::name().
|
finaloverridevirtual |
send a log message to the Core for logging
federateID | the federate that is sending the log message |
logLevel | an integer for the log level /ref helics_log_levels |
messageToLog | the string to send to a logger |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::ActionMessage::dest_id, getFederateAt(), helics::BrokerBase::global_id, helics::FederateState::global_id, helics::gLocalCoreId(), helics::ActionMessage::messageID, helics::ActionMessage::payload, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
load a file containing connection information
file | a JSON or TOML file containing connection information |
Implements helics::Core.
|
protected |
get the minimum operating state of the connected federates
Referenced by allDisconnected().
|
finaloverrideprotectedvirtual |
process a single command action
cmd may be modified by this function
Implements helics::BrokerBase.
Referenced by helics::TimeoutMonitor::tick().
|
finaloverridevirtual |
blocking call that processes helics communication messages this call can be used when expecting communication from other federates or when the federate has nothing else to do and doesn't want to advance time
fedId | the ID of the federate to process communications for |
msToWait | the amount of time to wait before the function returns from processing communications |
Implements helics::Core.
References helics::FINISHED, getFederateAt(), helics::FederateState::getState(), helics::FederateState::isCallbackFederate(), helics::FederateState::processCommunications(), and helics::TERMINATING.
|
finaloverridevirtual |
TODO(PT): figure out how to make this non-public, it needs to be called in a lambda function, may need a helper class of some sort
Implements helics::BrokerBase.
References helics::BrokerBase::addActionMessage(), helics::BrokerBase::CONFIGURED, getIdentifier(), helics::BrokerBase::global_broker_id_local, helics::parent_broker_id, helics::ActionMessage::payload, helics::ActionMessage::source_id, helics::BrokerBase::TERMINATED, helics::BrokerBase::TERMINATING, transmit(), and unregister().
|
finaloverrideprotectedvirtual |
function to process a priority command independent of the main queue
called when processing a priority command. The priority command has a response message which gets sent this mainly deals with some of the registration functions
command | the command to process |
Implements helics::BrokerBase.
|
overridevirtual |
make a query for information from the co-simulation
the format is somewhat unspecified target is the name of an object typically one of "federation", "broker", "core", or the name of a specific object/core/broker target can also be "global_value" to query a global value stored in the broker, or "global" to get a json structure with the name and value
target | the specific target of the query |
queryStr | the actual query |
mode | the sequencing mode for the query, fast or ordered |
Implements helics::Core.
References helics::bufferToJson(), helics::generateJsonErrorResponse(), getIdentifier(), helics::BrokerBase::mLogManager, and helics::BrokerBase::TERMINATING.
Referenced by getFederateTag(), registerFederate(), and sendCommand().
|
finaloverridevirtual |
Returns the next buffered message the specified destination endpoint.
this is a non-blocking call and will return a nullptr if no message are available
Implements helics::Core.
References helics::EXECUTING, getHandleFederate(), helics::FederateState::getState(), and helics::FederateState::receive().
|
finaloverridevirtual |
Receives a message for any destination.
this is a non-blocking call and will return a nullptr if no messages are available
federateID | the identifier for the federate | |
[out] | endpoint_id | the endpoint handle related to the message gets stored here |
Implements helics::Core.
References getFederateAt(), helics::FederateState::getState(), and helics::FederateState::receiveAny().
|
finaloverridevirtual |
Returns the number of pending receives for the specified destination endpoint.
Implements helics::Core.
References getHandleFederate(), and helics::FederateState::getQueueSize().
|
finaloverridevirtual |
Returns number of messages for all destinations.
Implements helics::Core.
References getFederateAt(), helics::FederateState::getQueueSize(), and helics::FederateState::getState().
|
finaloverridevirtual |
Register a cloning filter, a cloning filter operates on a copy of the message vs the actual message
filterName | the name of the filter (may be left blank and one will be automatically assigned) |
type_in | the input type of the filter |
type_out | the output type of the filter (may be left blank if the filter doesn't change type) |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::clone_flag, helics::FILTER, helics::gLocalCoreId(), helics::make_flags(), helics::ActionMessage::name(), helics::setActionFlag(), helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Register a data sink which can only receive data from specific targets
federateID | the federate to associate the endpoint with |
name | the name of the sink |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::FederateState::createInterface(), helics::ActionMessage::flags, helics::FederateState::getInterfaceFlags(), helics::FederateState::global_id, helics::FederateState::local_id, helics::make_flags(), helics::ActionMessage::name(), helics::receive_only_flag, helics::SINK, helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::targeted_flag.
|
finaloverridevirtual |
Message interface. Designed for point-to-point communication patterns. Register an endpoint.
federateID | the federate to associate the endpoint with |
name | the name of the endpoint |
type | the type of data the endpoint should accept or generate(can be left empty) |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::FederateState::createInterface(), helics::ENDPOINT, helics::ActionMessage::flags, helics::FederateState::getInterfaceFlags(), helics::FederateState::global_id, helics::FederateState::local_id, helics::ActionMessage::name(), helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Register a federate.
The returned FederateId is local to invoking process, FederateId's should not be used as a global identifier.
May only be invoked in initialize state otherwise throws an error
this will block
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::counter, helics::BrokerBase::dynamicFederation, helics::BrokerBase::enable_profiling, helics::BrokerBase::ERRORED, helics::FED, helics::FINISHED, getIdentifier(), helics::FederateState::getOptionFlag(), helics::FederateState::getState(), HELICS_FLAG_OBSERVER, HELICS_FLAG_REENTRANT, HELICS_LOG_LEVEL_SUMMARY, HELICS_SEQUENCING_MODE_FAST, helics::FederateState::indexGroup, helics::CoreFederateInfo::intProps, helics::BrokerBase::lastErrorString, helics::FederateState::local_id, helics::ActionMessage::name(), helics::BrokerBase::observer, helics::observer_flag, helics::BrokerBase::OPERATING, helics::parent_broker_id, helics::PROFILING, query(), helics::reentrant_flag, helics::FederateState::reset(), helics::BrokerBase::sendToLogger(), helics::setActionFlag(), helics::FederateState::setLogger(), helics::FederateState::setOptionFlag(), and helics::FederateState::setParent().
|
finaloverridevirtual |
Register filter.
May only be invoked in the Initialization state.
filterName | the name of the filter (may be left blank and one will be automatically assigned) |
type_in | the input type of the filter |
type_out | the output type of the filter (may be left blank if the filter doesn't change type) this is important for ordering in filters with operators |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::FILTER, helics::gLocalCoreId(), helics::ActionMessage::name(), helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Register a control input for the specified federate.
May only be invoked in the initialize state.
federateID | the identifier for the federate to register an input interface on |
key | the name of the control input |
type | a string describing the type of the federate |
units | a string naming the units of the federate |
Implements helics::Core.
References helics::FederateState::createInterface(), helics::FederateState::getInterfaceFlags(), helics::FederateState::global_id, helics::INPUT, and helics::FederateState::local_id.
|
finaloverridevirtual |
Value interface. Register a publication.
May only be invoked in the initialize state.
federateID | the identifier for the federate |
key | the tag for the publication |
type | the type of data the publication produces |
units | the units associated with the publication |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::FederateState::createInterface(), helics::ActionMessage::flags, helics::FederateState::getInterfaceFlags(), helics::FederateState::global_id, helics::FederateState::local_id, helics::ActionMessage::name(), helics::PUBLICATION, helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Register an endpoint which can only send or receive to specific targets
federateID | the federate to associate the endpoint with |
name | the name of the endpoint |
type | the type of data the endpoint should accept or generate(can be left empty) |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::FederateState::createInterface(), helics::ENDPOINT, helics::ActionMessage::flags, helics::FederateState::getInterfaceFlags(), helics::FederateState::global_id, helics::FederateState::local_id, helics::make_flags(), helics::ActionMessage::name(), helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::targeted_flag.
|
finaloverridevirtual |
Register translator.
translatorName | the name of the translator (may be left blank and one will be automatically assigned) |
units | the specified units for the value side of the translator |
endpointType | a user specified name of the type data on the endpoint |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::gLocalCoreId(), helics::ActionMessage::name(), helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::TRANSLATOR.
|
protectedpure virtual |
remove or disconnect a route from use
rid | the identification of the route |
|
finaloverridevirtual |
remove a target from a handles operation
handle | the handle from the publication, input, endpoint or filter |
targetToRemove | the name of the target to remove |
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::FederateState::addAction(), helics::BrokerBase::addActionMessage(), helics::ENDPOINT, helics::FILTER, getFederateAt(), getHandleInfo(), helics::FederateState::grantedTime(), helics::INPUT, helics::ActionMessage::name(), helics::PUBLICATION, helics::ActionMessage::setAction(), and helics::ActionMessage::setSource().
|
finaloverridevirtual |
Request a new time advancement window for reiterative federates.
Reiterative federates block on requestTimeIterative() until all reiterative federates have invoked requestTimeIterative(). The bool returned a global AND of all localConverged values. If globalConverged is false, time returned is the previous granted time. Time should not advance and another iteration attempted. Federates should recompute state based on newly published values. Time is advanced only when all reiterative federates have converged. If globalConverged is True, grantedTime is the minimum of over all next times in both reiterative and non-reiterative federates.
If a federate determines it cannot converge it should invoke the error() method.
Federates only participate it in reiterations for times that are evenly divisible by the federates time delta.
May only be invoked in Executing state.
Non-reiterative federates may not invoke this method.
federateID | the identifier for the federate to process |
next | the requested time |
iterate | the requested iteration mode /ref iteration_request |
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::FederateState::addAction(), helics::BrokerBase::addActionMessage(), helics::BrokerBase::CONNECTED_ERROR, helics::ActionMessage::dest_id, helics::ERROR_RESULT, helics::BrokerBase::ERRORED, helics::ERRORED, helics::EXECUTING, helics::FINISHED, helics::FederateState::getCurrentIteration(), getFederateAt(), helics::FederateState::getState(), helics::FederateState::global_id, helics::HALTED, helics::indicator_flag, helics::INITIALIZING, helics::FederateState::isCallbackFederate(), helics::ITERATE_IF_NEEDED, helics::BrokerBase::maxIterationCount, helics::NO_ITERATIONS, helics::FederateState::requestTime(), helics::setActionFlag(), helics::setIterationFlags(), helics::ActionMessage::source_id, helics::BrokerBase::TERMINATED, helics::BrokerBase::TERMINATING, helics::TERMINATING, helics::BrokerBase::TERMINATING_ERROR, helics::timeZero, and helics::UNKNOWN.
|
finaloverridevirtual |
Send data from a source to its targets
Time is implicitly defined as the end of the current time advancement window (value returned by last call to nextTime().
This send version was designed to enable communication of data between federates with the possible introduction of source and destination filters to represent properties of a communication network. This enables simulations to be run with/without a communications model present.
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::SmallBuffer::assign(), helics::ENDPOINT, getFederateAt(), getHandleInfo(), helics::FederateState::getMessageDestinations(), helics::ActionMessage::messageID, helics::FederateState::nextAllowedSendTime(), helics::ActionMessage::payload, helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
Referenced by sendTo().
|
finaloverridevirtual |
Send data from source to destination with explicit expected delivery time.
Time supplied is the time that will be reported in the message in the receiving federate.
This send version was designed to enable communication of events between discrete event federates. For this use case the receiving federate can deserialize the data and schedule an event for the specified time.
sourceHandle | the source of the event |
data | the raw data for the event |
length | the record length of the event |
time | the time the event is scheduled for |
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::SmallBuffer::assign(), helics::ENDPOINT, getFederateAt(), getHandleInfo(), helics::FederateState::getMessageDestinations(), helics::ActionMessage::messageID, helics::FederateState::nextAllowedSendTime(), helics::ActionMessage::payload, helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
Referenced by sendToAt().
|
overridevirtual |
send a command to a specific target
the format is somewhat unspecified; target is the name of an object, typically one of "federation", "broker", "core", or the name of a specific object/core/broker
target | the specific target of the command |
commandStr | the actual command |
source | the designated source of the command, for return values or indication |
mode | the sequencing mode for the command, fast or ordered |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::dest_id, getFederate(), helics::BrokerBase::getGlobalId(), getIdentifier(), HELICS_SEQUENCING_MODE_ORDERED, helics::parent_broker_id, helics::ActionMessage::payload, query(), and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Send for filters.
Continues sending the message to the next filter or to final destination.
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::BrokerBase::addActionMessage(), helics::checkActionFlag(), helics::ENDPOINT, helics::gDirectSendHandle, getFederateAt(), getHandleInfo(), helics::FederateState::getMessageDestinations(), helics::BrokerBase::global_id, HELICS_LOG_LEVEL_DATA, helics::FederateState::loggingLevel(), helics::FederateState::logMessage(), helics::ActionMessage::messageID, helics::FederateState::nextAllowedSendTime(), helics::prettyPrintString(), helics::receive_only_flag, helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::targeted_flag.
|
finaloverridevirtual |
Send data from source to destination.
Time is implicitly defined as the end of the current time advancement window (value returned by last call to nextTime().
This send version was designed to enable communication of data between federates with the possible introduction of source and destination filters to represent properties of a communication network. This enables simulations to be run with/without a communications model present.
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::BrokerBase::addActionMessage(), helics::SmallBuffer::assign(), helics::checkActionFlag(), helics::ENDPOINT, helics::ActionMessage::flags, getFederateAt(), getHandleInfo(), helics::FederateState::getMessageDestinations(), helics::ActionMessage::messageID, helics::FederateState::nextAllowedSendTime(), helics::ActionMessage::payload, send(), helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::targeted_flag.
|
finaloverridevirtual |
Send data from source to destination with explicit expected delivery time.
Time supplied is the time that will be reported in the message in the receiving federate.
This send version was designed to enable communication of events between discrete event federates. For this use case the receiving federate can deserialize the data and schedule an event for the specified time.
sourceHandle | the source of the event |
data | the raw data for the event |
length | the record length of the event |
destination | the target of the event |
time | the time the event is scheduled for |
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::BrokerBase::addActionMessage(), helics::SmallBuffer::assign(), helics::checkActionFlag(), helics::ENDPOINT, helics::ActionMessage::flags, getFederateAt(), getHandleInfo(), helics::FederateState::getMessageDestinations(), helics::ActionMessage::messageID, helics::FederateState::nextAllowedSendTime(), helics::ActionMessage::payload, sendAt(), helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::targeted_flag.
|
finaloverridevirtual |
set the core to ready to enter init
this function only needs to be called for cores that don't have any federates but may have filters for cores with federates it won't do anything
Implements helics::Core.
References helics::gLocalCoreId(), and setFlagOption().
|
overridevirtual |
set the callback Federate operators
fed | the federate to set the callback for |
callback | pointer to the operator class executing the federate |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::ActionMessage::counter, getFederateAt(), helics::FederateState::global_id, helics::ActionMessage::messageID, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
setter for federate tags which are key-value pairs
fid | the identifier for the federate to set the tag data on |
tag | a string containing the name of the tag |
value | a string containing the value for the tag |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::dest_id, getFederateAt(), helics::BrokerBase::getGlobalId(), helics::gLocalCoreId(), and helics::ActionMessage::source_id.
|
finaloverridevirtual |
set the filter callback operator
filter | the handle of the filter |
callback | pointer to the operator class executing the filter |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::ActionMessage::counter, helics::FILTER, getHandleInfo(), helics::ActionMessage::messageID, helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Set a flag in a a federate
federateID | the identifier for the federate |
flag | an index code for the flag to set |
flagValue | the value to set the flag to |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::DUMPLOG, helics::gLocalCoreId(), helics::indicator_flag, helics::ActionMessage::messageID, and helics::setActionFlag().
Referenced by setCoreReadyToInit().
|
overridevirtual |
set a federation global value
this overwrites any previous value for this name
valueName | the name of the global to set |
value | the value of the global |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::dest_id, helics::gDirectCoreId, helics::gRootBrokerID, helics::ActionMessage::payload, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
set a handle option
handle | the handle from the publication, input, endpoint or filter |
option | the option to set |
option_value | the value to set the option (mostly 0 or 1) |
Implements helics::Core.
References helics::ActionMessage::counter, helics::ActionMessage::dest_handle, helics::ActionMessage::dest_id, helics::FILTER, getHandleFederate(), getHandleInfo(), helics::FederateState::global_id, helics::indicator_flag, helics::ActionMessage::messageID, helics::setActionFlag(), helics::ActionMessage::setExtraDestData(), and helics::FederateState::setProperties().
void helics::CommonCore::setIdentifier | ( | std::string_view | name | ) |
set the local identification for the core
References helics::BrokerBase::CREATED, and helics::BrokerBase::identifier.
|
finaloverridevirtual |
set an integer property on a federate
federateID | the federate to set a time based property on |
property | the property to set see /ref defs::properties |
propValue | the requested value of the property |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::dest_id, getFederateAt(), helics::BrokerBase::global_id, helics::gLocalCoreId(), helics::ActionMessage::messageID, helics::ActionMessage::setExtraData(), and helics::FederateState::setProperties().
|
finaloverridevirtual |
set the local information field of the interface
Implements helics::Core.
References helics::InterfaceHandle::baseValue().
|
finaloverridevirtual |
setter for interface tags which are key-value pairs
handle | the identifier for the interface to set the tag data on |
tag | a string containing the name of the tag |
value | a string containing the value for the tag |
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::InterfaceHandle::baseValue(), getHandleInfo(), helics::ActionMessage::setDestination(), and helics::ActionMessage::setSource().
|
finaloverridevirtual |
set the core logging file
Implements helics::Core.
References helics::BrokerBase::addActionMessage(), helics::ActionMessage::dest_id, helics::BrokerBase::global_id, helics::ActionMessage::messageID, and helics::ActionMessage::payload.
|
finaloverridevirtual |
define a logging function to use for logging message and notices from the federation and individual federate
federateID | the identifier for the individual federate or 0 for the Core Logger |
logFunction | the callback function for doing something with a log message it takes 3 inputs an integer for logLevel /ref helics_log_levels A string indicating the source of the message and another string with the actual message |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::ActionMessage::counter, helics::ActionMessage::dest_id, getFederateAt(), helics::BrokerBase::global_id, helics::gLocalCoreId(), helics::ActionMessage::messageID, helics::setActionFlag(), helics::FederateState::setLogger(), and helics::ActionMessage::source_id.
|
overridevirtual |
set the core logging level
Implements helics::Core.
References helics::ActionMessage::dest_id, helics::BrokerBase::global_id, and helics::ActionMessage::messageID.
|
overridevirtual |
supply a query callback function
the intention of the query callback is to allow federates to answer particular requests through the query interface this allows other federates to make requests or queries of other federates in an asynchronous fashion.
federateID | the identifier for the federate |
queryFunction | a function object that returns a string as a result of a query in the form of const string ref. This callback will be called when a federate received a query that cannot be answered that directed at a particular federate |
order | indicator of the execution order slot for query callbacks; the value is bound [1,10] inclusive and values given outside this range are clamped to the boundary values. The callback is overwritten if multiple callbacks at the same index are given. |
Implements helics::Core.
References getFederateAt(), and helics::FederateState::setQueryCallback().
|
finaloverridevirtual |
set a timebased property on a federate
federateID | the federate to set a time based property on |
property | the property to set see /ref defs::properties |
timeValue | the requested value of the property |
Implements helics::Core.
References helics::ActionMessage::actionTime, getFederateAt(), helics::ActionMessage::messageID, helics::FederateState::setProperties(), and helics::timeZero.
|
finaloverridevirtual |
set the translator callback operators
translator | the handle of the translator |
callback | pointer to the operator class executing the translator |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::ActionMessage::counter, getHandleInfo(), helics::ActionMessage::messageID, helics::ActionMessage::source_handle, helics::ActionMessage::source_id, and helics::TRANSLATOR.
|
finaloverridevirtual |
Publish specified data to the specified key.
handle | the handle from the publication, input, endpoint or filter |
data | the raw data to send |
len | the size of the data |
Implements helics::Core.
References helics::BrokerBase::actionQueue, helics::ActionMessage::actionTime, helics::appendMessage(), helics::SmallBuffer::assign(), helics::checkActionFlag(), helics::FederateState::checkAndSetValue(), helics::ActionMessage::counter, helics::disconnected_flag, helics::FederateState::getCurrentIteration(), getFederateAt(), getHandleInfo(), helics::FederateState::getIdentifier(), helics::FederateState::getSubscribers(), HELICS_LOG_LEVEL_DATA, helics::FederateState::loggingLevel(), helics::FederateState::logMessage(), helics::FederateState::nextAllowedSendTime(), helics::ActionMessage::payload, helics::PUBLICATION, helics::ActionMessage::setDestination(), helics::ActionMessage::source_handle, and helics::ActionMessage::source_id.
|
finaloverridevirtual |
Time management. Request a new time advancement window for non-reiterative federates.
RequestTime() blocks until all non-reiterative federates have invoked requestTime() and all reiterative federates have converged (called requestTimeIterative() with localConverged value of true). Return time is the minimum of all supplied times.
May only be invoked in Executing state.
Iterative federates may not invoke this method.
federateID | the identification of the federate requesting the time |
next | the next time that is requested from the federate |
Implements helics::Core.
References helics::ActionMessage::actionTime, helics::FederateState::addAction(), helics::BrokerBase::addActionMessage(), helics::BrokerBase::CONNECTED_ERROR, helics::ActionMessage::dest_id, helics::ERROR_RESULT, helics::BrokerBase::ERRORED, helics::EXECUTING, helics::FINISHED, getFederateAt(), helics::FederateState::getState(), helics::FederateState::global_id, helics::HALTED, HELICS_ERROR_REGISTRATION_FAILURE, helics::indicator_flag, helics::FederateState::isCallbackFederate(), helics::FederateState::lastErrorCode(), helics::FederateState::lastErrorString(), helics::NO_ITERATIONS, helics::FederateState::requestTime(), helics::setActionFlag(), helics::ActionMessage::source_id, helics::BrokerBase::TERMINATED, helics::BrokerBase::TERMINATING, and helics::BrokerBase::TERMINATING_ERROR.
|
protectedpure virtual |
transit an ActionMessage to another core or broker
rid | the identifier for the route information to send the message to |
command | the actionMessage to send |
|
protectedpure virtual |
transit an ActionMessage to another core or broker
rid | the identifier for the route information to send the message to |
command | the actionMessage to send |
Referenced by connect(), processDisconnect(), and helics::TimeoutMonitor::tick().
void helics::CommonCore::unregister | ( | ) |
unregister the core from any process find functions
References helics::CoreFactory::findCore(), helics::BrokerBase::identifier, and helics::CoreFactory::unregisterCore().
Referenced by processDisconnect().
|
overridevirtual |
get a command for a specific federate. block until a command is received
Implements helics::Core.
References getFederateAt(), and helics::FederateState::waitCommand().
|
finaloverridevirtual |
waits in the current thread until the core is disconnected
Implements helics::Core.
Referenced by disconnect().