helics  3.5.2
Public Member Functions | List of all members
helics::EmptyCore Class Reference

#include <EmptyCore.hpp>

+ Inheritance diagram for helics::EmptyCore:

Public Member Functions

 EmptyCore () noexcept
 
virtual void configure (std::string_view configureString) override
 
virtual void configureFromArgs (int argc, char *argv[]) override
 
virtual void configureFromVector (std::vector< std::string > args) override
 
virtual bool isConfigured () const override
 
virtual bool isOpenToNewFederates () const override
 
virtual bool hasError () const override
 
virtual void globalError (LocalFederateId federateID, int errorCode, std::string_view errorString) override
 
virtual void localError (LocalFederateId federateID, int errorCode, std::string_view errorString) override
 
virtual int getErrorCode () const override
 
virtual std::string getErrorMessage () const override
 
virtual void finalize (LocalFederateId federateID) override
 
virtual bool enterInitializingMode (LocalFederateId federateID, IterationRequest request) override
 
virtual void setCoreReadyToInit () override
 
virtual iteration_time enterExecutingMode (LocalFederateId federateID, IterationRequest iterate=NO_ITERATION) override
 
virtual LocalFederateId registerFederate (std::string_view name, const CoreFederateInfo &info) override
 
virtual const std::string & getFederateName (LocalFederateId federateID) const override
 
virtual LocalFederateId getFederateId (std::string_view name) const override
 
virtual int32_t getFederationSize () override
 
virtual Time timeRequest (LocalFederateId federateID, Time next) override
 
virtual iteration_time requestTimeIterative (LocalFederateId federateID, Time next, IterationRequest iterate) override
 
virtual void processCommunications (LocalFederateId fedId, std::chrono::milliseconds msToWait) override final
 
virtual Time getCurrentTime (LocalFederateId federateID) const override
 
virtual void setTimeProperty (LocalFederateId federateID, int32_t property, Time time) override
 
virtual void setIntegerProperty (LocalFederateId federateID, int32_t property, int16_t propertyValue) override
 
virtual Time getTimeProperty (LocalFederateId federateID, int32_t property) const override
 
virtual int16_t getIntegerProperty (LocalFederateId federateID, int32_t property) const override
 
virtual void setFlagOption (LocalFederateId federateID, int32_t flag, bool flagValue=true) override
 
virtual bool getFlagOption (LocalFederateId federateID, int32_t flag) const override
 
virtual InterfaceHandle registerPublication (LocalFederateId federateID, std::string_view key, std::string_view type, std::string_view units) override
 
virtual InterfaceHandle getPublication (LocalFederateId federateID, std::string_view key) const override
 
virtual InterfaceHandle registerInput (LocalFederateId federateID, std::string_view key, std::string_view type, std::string_view units) override
 
virtual InterfaceHandle getInput (LocalFederateId federateID, std::string_view key) const override
 
virtual InterfaceHandle registerTranslator (std::string_view translatorName, std::string_view message_type, std::string_view units) override
 
virtual const std::string & getHandleName (InterfaceHandle handle) const override
 
virtual void setHandleOption (InterfaceHandle handle, int32_t option, int32_t option_value) override
 
virtual int32_t getHandleOption (InterfaceHandle handle, int32_t option) const override
 
virtual void closeHandle (InterfaceHandle handle) override
 
virtual void removeTarget (InterfaceHandle handle, std::string_view targetToRemove) override
 
virtual void addDestinationTarget (InterfaceHandle handle, std::string_view dest, InterfaceType hint) override
 
virtual void addSourceTarget (InterfaceHandle handle, std::string_view name, InterfaceType hint) override
 
virtual const std::string & getDestinationTargets (InterfaceHandle handle) const override
 
virtual const std::string & getSourceTargets (InterfaceHandle handle) const override
 
virtual const std::string & getInjectionUnits (InterfaceHandle handle) const override
 
virtual const std::string & getExtractionUnits (InterfaceHandle handle) const override
 
virtual const std::string & getInjectionType (InterfaceHandle handle) const override
 
virtual const std::string & getExtractionType (InterfaceHandle handle) const override
 
virtual void setValue (InterfaceHandle handle, const char *data, uint64_t len) override
 
virtual const std::shared_ptr< const SmallBuffer > & getValue (InterfaceHandle handle, uint32_t *inputIndex) override
 
virtual const std::vector< std::shared_ptr< const SmallBuffer > > & getAllValues (InterfaceHandle handle) override
 
virtual const std::vector< InterfaceHandle > & getValueUpdates (LocalFederateId federateID) override
 
virtual InterfaceHandle registerEndpoint (LocalFederateId federateID, std::string_view name, std::string_view type) override
 
virtual InterfaceHandle registerTargetedEndpoint (LocalFederateId federateID, std::string_view name, std::string_view type) override
 
virtual InterfaceHandle getEndpoint (LocalFederateId federateID, std::string_view name) const override
 
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
 
virtual InterfaceHandle registerCloningFilter (std::string_view filterName, std::string_view type_in, std::string_view type_out) override
 
virtual InterfaceHandle getFilter (std::string_view name) const override
 
virtual InterfaceHandle getTranslator (std::string_view name) const override
 
virtual void addDependency (LocalFederateId federateID, std::string_view federateName) override
 
virtual void linkEndpoints (std::string_view source, std::string_view dest) override
 
virtual void addAlias (std::string_view interfaceKey, std::string_view alias) override
 
virtual void makeConnections (const std::string &file) override
 
virtual void dataLink (std::string_view source, std::string_view target) override
 
virtual void addSourceFilterToEndpoint (std::string_view filter, std::string_view endpoint) override
 
virtual void addDestinationFilterToEndpoint (std::string_view filter, std::string_view endpoint) override
 
virtual void send (InterfaceHandle sourceHandle, const void *data, uint64_t length) override
 
virtual void sendAt (InterfaceHandle sourceHandle, const void *data, uint64_t length, Time time) override
 
virtual void sendTo (InterfaceHandle sourceHandle, const void *data, uint64_t length, std::string_view destination) override
 
virtual void sendToAt (InterfaceHandle sourceHandle, const void *data, uint64_t length, std::string_view destination, Time time) override
 
virtual void sendMessage (InterfaceHandle sourceHandle, std::unique_ptr< Message > message) override
 
virtual uint64_t receiveCount (InterfaceHandle destination) override
 
virtual std::unique_ptr< Messagereceive (InterfaceHandle destination) override
 
virtual std::unique_ptr< MessagereceiveAny (LocalFederateId federateID, InterfaceHandle &endpoint_id) override
 
virtual uint64_t receiveCountAny (LocalFederateId federateID) override
 
virtual void logMessage (LocalFederateId federateID, int logLevel, std::string_view messageToLog) override
 
virtual void setFilterOperator (InterfaceHandle filter, std::shared_ptr< FilterOperator > callback) override
 
virtual void setTranslatorOperator (InterfaceHandle translator, std::shared_ptr< TranslatorOperator > callback) override
 
virtual void setFederateOperator (LocalFederateId federateID, std::shared_ptr< FederateOperator > callback) override
 
virtual const std::string & getIdentifier () const override
 
virtual const std::string & getAddress () const override
 
virtual void setLoggingLevel (int logLevel) override
 
virtual void setLoggingCallback (LocalFederateId federateID, std::function< void(int, std::string_view, std::string_view)> logFunction) override
 
virtual void setLogFile (std::string_view lfile) override
 
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
 
virtual bool isConnected () const override
 
virtual void disconnect () override
 
virtual bool waitForDisconnect (std::chrono::milliseconds msToWait=std::chrono::milliseconds(0)) const override
 
virtual void setInterfaceInfo (InterfaceHandle handle, std::string_view info) override
 
virtual const std::string & getInterfaceInfo (InterfaceHandle handle) const override
 
virtual void setInterfaceTag (InterfaceHandle handle, std::string_view tag, std::string_view value) override
 
virtual const std::string & getInterfaceTag (InterfaceHandle handle, std::string_view tag) const override
 
virtual void setFederateTag (LocalFederateId fid, std::string_view tag, std::string_view value) override
 
virtual const std::string & getFederateTag (LocalFederateId fid, std::string_view tag) const override
 
- 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
 

Detailed Description

a dummy core that responds like a disconnected finished core

Constructor & Destructor Documentation

◆ EmptyCore()

helics::EmptyCore::EmptyCore ( )
noexcept

default constructor

Member Function Documentation

◆ addAlias()

void helics::EmptyCore::addAlias ( std::string_view  interfaceKey,
std::string_view  alias 
)
overridevirtual

add an interface alias This allows an interface to be referred to by multiple keys

Parameters
interfaceKeythe name of the interface to generate an alias for
aliasthe additional identification string

Implements helics::Core.

◆ addDependency()

void helics::EmptyCore::addDependency ( LocalFederateId  federateID,
std::string_view  federateName 
)
overridevirtual

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)

Parameters
federateIDthe identifier for the federate
federateNamethe name of the dependent federate

Implements helics::Core.

◆ addDestinationFilterToEndpoint()

void helics::EmptyCore::addDestinationFilterToEndpoint ( std::string_view  filter,
std::string_view  target 
)
overridevirtual

create a filter connection between a named filter and a named endpoint for destination processing

Parameters
filterthe name of the filter
targetthe name of the source target

Implements helics::Core.

◆ addDestinationTarget()

void helics::EmptyCore::addDestinationTarget ( InterfaceHandle  handle,
std::string_view  dest,
InterfaceType  hint 
)
overridevirtual

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

Parameters
handlean interface to add the target to
destthe target endpoint for the filter
hintthe interface type for the destination target

Implements helics::Core.

◆ addSourceFilterToEndpoint()

void helics::EmptyCore::addSourceFilterToEndpoint ( std::string_view  filter,
std::string_view  target 
)
overridevirtual

create a filter connection between a named filter and a named endpoint for messages coming from that endpoint

Parameters
filterthe name of the filter
targetthe name of the source target

Implements helics::Core.

◆ addSourceTarget()

void helics::EmptyCore::addSourceTarget ( InterfaceHandle  handle,
std::string_view  name,
InterfaceType  hint 
)
overridevirtual

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

Parameters
handlethe identifier of the interface
namethe name of the filter or its target
hintthe interface type for the source target

Implements helics::Core.

◆ closeHandle()

void helics::EmptyCore::closeHandle ( InterfaceHandle  handle)
overridevirtual

close a handle from further connections

Parameters
handlethe handle from the publication, input, endpoint or filter

Implements helics::Core.

◆ configure()

void helics::EmptyCore::configure ( std::string_view  configureString)
overridevirtual

Configure the core from a configuration string

Should be invoked a single time to initialize the co-simulation core.

Implements helics::Core.

◆ configureFromArgs()

void helics::EmptyCore::configureFromArgs ( int  argc,
char *  argv[] 
)
overridevirtual

Configure the core from command line arguments.

Should be invoked a single time to configure the co-simulation core for operation

Implements helics::Core.

◆ configureFromVector()

void helics::EmptyCore::configureFromVector ( std::vector< std::string >  args)
overridevirtual

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.

◆ connect()

bool helics::EmptyCore::connect ( )
overridevirtual

connect the core to a broker if needed

Returns
true if the connection was successful

Implements helics::Core.

◆ dataLink()

void helics::EmptyCore::dataLink ( std::string_view  source,
std::string_view  target 
)
overridevirtual

create a data connection between a named publication and a named input

Parameters
sourcethe name of the publication
targetthe name of the input

Implements helics::Core.

◆ disconnect()

void helics::EmptyCore::disconnect ( )
overridevirtual

disconnect the core from its broker

Implements helics::Core.

◆ enterExecutingMode()

iteration_time helics::EmptyCore::enterExecutingMode ( LocalFederateId  federateID,
IterationRequest  iterate = NO_ITERATION 
)
overridevirtual

Change the federate state to the Executing state.

May only be invoked in Initializing state.

Parameters
federateIDthe identifier of the federate
iteratethe requested iteration mode if nonconverged the federate requests an iterative update
Returns
an iteration_time result enumeration value indicating the current state of iterations and a time with the current simulation time (usually 0) unless the federate is joining dynamically

Implements helics::Core.

References helics::HALTED.

◆ enterInitializingMode()

bool helics::EmptyCore::enterInitializingMode ( LocalFederateId  federateID,
IterationRequest  iterate 
)
overridevirtual

Federates may be in five Modes.

  1. Startup Configuration of the federate. State begins when registerFederate() is invoked and ends when enterInitializingMode() is invoked.
  2. Initializing Configure of the simulation state prior to the start of time stepping. State begins when enterInitializingMode() is invoked and ends when enterExecutingMode(true) is invoked.
  3. Executing State begins when enterExecutingMode() is invoked and ends when finalize() is invoked.
  4. Finalized state after finalize is invoked.
  5. Error state invoked after an error is called. Change the federate state to the Initializing state.
Parameters
federateIDthe identifier of the federate
iteratethe 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

Returns
will return true if the call resulted in Initializing mode being reached

Implements helics::Core.

◆ finalize()

void helics::EmptyCore::finalize ( LocalFederateId  federateID)
overridevirtual

Federate has completed.

Should be invoked a single time to complete the simulation.

Implements helics::Core.

◆ getAddress()

const std::string & helics::EmptyCore::getAddress ( ) const
overridevirtual

get the connection network or connection address for the core

Implements helics::Core.

◆ getAllValues()

const std::vector< std::shared_ptr< const SmallBuffer > > & helics::EmptyCore::getAllValues ( InterfaceHandle  handle)
overridevirtual

Return all the available data for the specified handle or the latest input

Implements helics::Core.

◆ getCommand()

std::pair< std::string, std::string > helics::EmptyCore::getCommand ( LocalFederateId  federateID)
overridevirtual

get a command for a specific federate

Implements helics::Core.

◆ getCurrentTime()

Time helics::EmptyCore::getCurrentTime ( LocalFederateId  federateID) const
overridevirtual

get the most recent granted Time

Parameters
federateIDthe identifier of the federate to get the time
Returns
the most recent granted time or the startup time

Implements helics::Core.

◆ getDataSink()

InterfaceHandle helics::EmptyCore::getDataSink ( LocalFederateId  federateID,
std::string_view  name 
) const
finaloverridevirtual

get an interface handle to a data sink

Parameters
federateIDthe identifier for the federate
namethe name of the data sink
Returns
a handle to identify the sink

Implements helics::Core.

◆ getDestinationTargets()

const std::string & helics::EmptyCore::getDestinationTargets ( InterfaceHandle  handle) const
overridevirtual

get the destinations for an interface

Parameters
handlean interface get the destination targets for

Implements helics::Core.

◆ getEndpoint()

InterfaceHandle helics::EmptyCore::getEndpoint ( LocalFederateId  federateID,
std::string_view  name 
) const
overridevirtual

get an endpoint Handle from its name

Parameters
federateIDthe identifier for the federate
namethe name of the endpoint
Returns
a handle to identify the endpoint

Implements helics::Core.

◆ getErrorCode()

int helics::EmptyCore::getErrorCode ( ) const
overridevirtual

get the last error code from a core

Implements helics::Core.

◆ getErrorMessage()

std::string helics::EmptyCore::getErrorMessage ( ) const
overridevirtual

get the last error message

Implements helics::Core.

◆ getExtractionType()

const std::string & helics::EmptyCore::getExtractionType ( InterfaceHandle  handle) const
overridevirtual

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

Parameters
handlethe interface handle to get the injection type for
Returns
a const ref to std::string

Implements helics::Core.

◆ getExtractionUnits()

const std::string & helics::EmptyCore::getExtractionUnits ( InterfaceHandle  handle) const
overridevirtual
Returns
the unit string for the specified handle.

Implements helics::Core.

◆ getFederateId()

LocalFederateId helics::EmptyCore::getFederateId ( std::string_view  name) const
overridevirtual

Returns the federate Id.

Implements helics::Core.

◆ getFederateName()

const std::string & helics::EmptyCore::getFederateName ( LocalFederateId  federateID) const
overridevirtual

Returns the federate name.

Implements helics::Core.

◆ getFederateTag()

const std::string & helics::EmptyCore::getFederateTag ( LocalFederateId  fid,
std::string_view  tag 
) const
overridevirtual

getter for the federate tags

Parameters
fidthe identifier for the federate to get the tag data for
tagthe name of the tag to retrieve
Returns
a reference to a const std::string with the tag value.

Implements helics::Core.

◆ getFederationSize()

int32_t helics::EmptyCore::getFederationSize ( )
overridevirtual

Returns the global number of federates that are registered only return accurately after the initialization state has been entered

Implements helics::Core.

◆ getFilter()

InterfaceHandle helics::EmptyCore::getFilter ( std::string_view  name) const
overridevirtual

get a filter Handle from its name or target(this may not be unique so it will only find the first one)

Parameters
namethe name of the filter or its target
Returns
a handle to identify the filter

Implements helics::Core.

◆ getFlagOption()

bool helics::EmptyCore::getFlagOption ( LocalFederateId  federateID,
int32_t  flag 
) const
overridevirtual

Set a flag in a a federate

Parameters
federateIDthe identifier for the federate
flagan index code for the flag to set
Returns
the value of the flag

Implements helics::Core.

◆ getHandleName()

const std::string & helics::EmptyCore::getHandleName ( InterfaceHandle  handle) const
overridevirtual

Returns the name or identifier for a specified handle

Implements helics::Core.

◆ getHandleOption()

int32_t helics::EmptyCore::getHandleOption ( InterfaceHandle  handle,
int32_t  option 
) const
overridevirtual

get a handle option

Parameters
handlethe handle from the publication, input, endpoint or filter
optionthe option to set see /ref defs::options

Implements helics::Core.

◆ getIdentifier()

const std::string & helics::EmptyCore::getIdentifier ( ) const
overridevirtual

get the local identifier for the core

Implements helics::Core.

Referenced by query().

◆ getInjectionType()

const std::string & helics::EmptyCore::getInjectionType ( InterfaceHandle  handle) const
overridevirtual

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

Parameters
handlethe interface handle to get the injection type for
Returns
a const ref to std::string

Implements helics::Core.

◆ getInjectionUnits()

const std::string & helics::EmptyCore::getInjectionUnits ( InterfaceHandle  handle) const
overridevirtual

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

Parameters
handlethe interface handle to get the injection type for
Returns
a const ref to std::string

Implements helics::Core.

◆ getInput()

InterfaceHandle helics::EmptyCore::getInput ( LocalFederateId  federateID,
std::string_view  key 
) const
overridevirtual

get a subscription Handle from its key

Parameters
federateIDthe identifier for the federate
keythe tag of the named input
Returns
a handle to identify the input

Implements helics::Core.

◆ getIntegerProperty()

int16_t helics::EmptyCore::getIntegerProperty ( LocalFederateId  federateID,
int32_t  property 
) const
overridevirtual

get an integer property on a federate

Parameters
federateIDthe federate to set a time based property on
propertythe property to set see /ref defs::properties
Returns
the current value of the property

Implements helics::Core.

◆ getInterfaceInfo()

const std::string & helics::EmptyCore::getInterfaceInfo ( InterfaceHandle  handle) const
overridevirtual

get the local information field of the interface

Implements helics::Core.

◆ getInterfaceTag()

const std::string & helics::EmptyCore::getInterfaceTag ( InterfaceHandle  handle,
std::string_view  tag 
) const
overridevirtual

getter for the interface tags

Parameters
handlethe identifier for the interface to set the info data on
tagthe name of the tag to retrieve

Implements helics::Core.

◆ getPublication()

InterfaceHandle helics::EmptyCore::getPublication ( LocalFederateId  federateID,
std::string_view  key 
) const
overridevirtual

get a publication Handle from its key

Parameters
federateIDthe identifier for the federate
keythe name of the publication
Returns
a handle to identify the publication

Implements helics::Core.

◆ getSourceTargets()

const std::string & helics::EmptyCore::getSourceTargets ( InterfaceHandle  handle) const
overridevirtual

get the sources of data for an interface

Parameters
handlethe identifier of the interface

Implements helics::Core.

◆ getTimeProperty()

Time helics::EmptyCore::getTimeProperty ( LocalFederateId  federateID,
int32_t  property 
) const
overridevirtual

get a timebased property on a federate

Parameters
federateIDthe federate to set a time based property on
propertythe property to set see /ref defs::properties
Returns
the current value of the requested property

Implements helics::Core.

◆ getTranslator()

InterfaceHandle helics::EmptyCore::getTranslator ( std::string_view  name) const
overridevirtual

get a translator handle from its name or target (this may not be unique so it will only find the first one)

Parameters
namethe name of the translator or its target
Returns
a handle to identify the translator

Implements helics::Core.

◆ getValue()

const std::shared_ptr< const SmallBuffer > & helics::EmptyCore::getValue ( InterfaceHandle  handle,
uint32_t *  inputIndex 
)
overridevirtual

Return the data for the specified handle or the latest input

Parameters
handlethe input handle from which to get the data
[out]inputIndexreturn the index of input (always 1 for inputs with only a single source)

Implements helics::Core.

◆ getValueUpdates()

const std::vector< InterfaceHandle > & helics::EmptyCore::getValueUpdates ( LocalFederateId  federateID)
overridevirtual

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

Parameters
federateIDthe identification code of the federate to get which interfaces have been updated
Returns
a reference to the location of an array of handles that have been updated

Implements helics::Core.

◆ isConfigured()

bool helics::EmptyCore::isConfigured ( ) const
overridevirtual

Returns true if the core has been configured.

Implements helics::Core.

◆ isConnected()

bool helics::EmptyCore::isConnected ( ) const
overridevirtual

check if the core is connected properly

Implements helics::Core.

◆ isOpenToNewFederates()

bool helics::EmptyCore::isOpenToNewFederates ( ) const
overridevirtual

check if the core is ready to accept new federates

Implements helics::Core.

◆ linkEndpoints()

void helics::EmptyCore::linkEndpoints ( std::string_view  source,
std::string_view  dest 
)
overridevirtual

Register communicating source/destination endpoint targets.

Parameters
sourcethe endpoint that is sending data
destthe endpoint receiving the data

Implements helics::Core.

◆ logMessage()

void helics::EmptyCore::logMessage ( LocalFederateId  federateID,
int  logLevel,
std::string_view  messageToLog 
)
overridevirtual

send a log message to the Core for logging

Parameters
federateIDthe federate that is sending the log message
logLevelan integer for the log level /ref helics_log_levels
messageToLogthe string to send to a logger

Implements helics::Core.

References HELICS_LOG_LEVEL_WARNING.

◆ makeConnections()

void helics::EmptyCore::makeConnections ( const std::string &  file)
overridevirtual

load a file containing connection information

Parameters
filea JSON or TOML file containing connection information

Implements helics::Core.

◆ processCommunications()

void helics::EmptyCore::processCommunications ( LocalFederateId  fedId,
std::chrono::milliseconds  msToWait 
)
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

Parameters
fedIdthe ID of the federate to process communications for
msToWaitthe amount of time to wait before the function returns from processing communications

Implements helics::Core.

◆ query()

std::string helics::EmptyCore::query ( std::string_view  target,
std::string_view  queryStr,
HelicsSequencingModes  mode 
)
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

Parameters
targetthe specific target of the query
queryStrthe actual query
modethe sequencing mode for the query, fast or ordered
Returns
a string containing the response to the query. Query is a blocking call and will not return until the query is answered so use with caution

Implements helics::Core.

References helics::generateJsonErrorResponse(), and getIdentifier().

◆ receive()

std::unique_ptr< Message > helics::EmptyCore::receive ( InterfaceHandle  destination)
overridevirtual

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.

◆ receiveAny()

std::unique_ptr< Message > helics::EmptyCore::receiveAny ( LocalFederateId  federateID,
InterfaceHandle endpoint_id 
)
overridevirtual

Receives a message for any destination.

this is a non-blocking call and will return a nullptr if no messages are available

Parameters
federateIDthe identifier for the federate
[out]endpoint_idthe endpoint handle related to the message gets stored here

Implements helics::Core.

◆ receiveCount()

uint64_t helics::EmptyCore::receiveCount ( InterfaceHandle  destination)
overridevirtual

Returns the number of pending receives for the specified destination endpoint.

Implements helics::Core.

◆ receiveCountAny()

uint64_t helics::EmptyCore::receiveCountAny ( LocalFederateId  federateID)
overridevirtual

Returns number of messages for all destinations.

Implements helics::Core.

◆ registerCloningFilter()

InterfaceHandle helics::EmptyCore::registerCloningFilter ( std::string_view  filterName,
std::string_view  type_in,
std::string_view  type_out 
)
overridevirtual

Register a cloning filter, a cloning filter operates on a copy of the message vs the actual message

Parameters
filterNamethe name of the filter (may be left blank and one will be automatically assigned)
type_inthe input type of the filter
type_outthe output type of the filter (may be left blank if the filter doesn't change type)
Returns
the handle for the new filter

Implements helics::Core.

◆ registerDataSink()

InterfaceHandle helics::EmptyCore::registerDataSink ( LocalFederateId  federateID,
std::string_view  name 
)
finaloverridevirtual

Register a data sink which can only receive data from specific targets

Parameters
federateIDthe federate to associate the endpoint with
namethe name of the sink
Returns
a handle to identify the sink

Implements helics::Core.

◆ registerEndpoint()

InterfaceHandle helics::EmptyCore::registerEndpoint ( LocalFederateId  federateID,
std::string_view  name,
std::string_view  type 
)
overridevirtual

Message interface. Designed for point-to-point communication patterns. Register an endpoint.

Parameters
federateIDthe federate to associate the endpoint with
namethe name of the endpoint
typethe type of data the endpoint should accept or generate(can be left empty)

Implements helics::Core.

◆ registerFederate()

LocalFederateId helics::EmptyCore::registerFederate ( std::string_view  name,
const CoreFederateInfo info 
)
overridevirtual

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

Implements helics::Core.

◆ registerFilter()

InterfaceHandle helics::EmptyCore::registerFilter ( std::string_view  filterName,
std::string_view  type_in,
std::string_view  type_out 
)
overridevirtual

Register filter.

May only be invoked in the Initialization state.

Parameters
filterNamethe name of the filter (may be left blank and one will be automatically assigned)
type_inthe input type of the filter
type_outthe 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
Returns
the handle for the new filter

Implements helics::Core.

◆ registerInput()

InterfaceHandle helics::EmptyCore::registerInput ( LocalFederateId  federateID,
std::string_view  key,
std::string_view  type,
std::string_view  units 
)
overridevirtual

Register a control input for the specified federate.

May only be invoked in the initialize state.

Parameters
federateIDthe identifier for the federate to register an input interface on
keythe name of the control input
typea string describing the type of the federate
unitsa string naming the units of the federate

Implements helics::Core.

◆ registerPublication()

InterfaceHandle helics::EmptyCore::registerPublication ( LocalFederateId  federateID,
std::string_view  key,
std::string_view  type,
std::string_view  units 
)
overridevirtual

Value interface. Register a publication.

May only be invoked in the initialize state.

Parameters
federateIDthe identifier for the federate
keythe tag for the publication
typethe type of data the publication produces
unitsthe units associated with the publication
Returns
a handle to identify the publication

Implements helics::Core.

◆ registerTargetedEndpoint()

InterfaceHandle helics::EmptyCore::registerTargetedEndpoint ( LocalFederateId  federateID,
std::string_view  name,
std::string_view  type 
)
overridevirtual

Register an endpoint which can only send or receive to specific targets

Parameters
federateIDthe federate to associate the endpoint with
namethe name of the endpoint
typethe type of data the endpoint should accept or generate(can be left empty)

Implements helics::Core.

◆ registerTranslator()

InterfaceHandle helics::EmptyCore::registerTranslator ( std::string_view  translatorName,
std::string_view  endpointType,
std::string_view  units 
)
overridevirtual

Register translator.

Parameters
translatorNamethe name of the translator (may be left blank and one will be automatically assigned)
unitsthe specified units for the value side of the translator
endpointTypea user specified name of the type data on the endpoint
Returns
the handle for the new translator

Implements helics::Core.

◆ removeTarget()

void helics::EmptyCore::removeTarget ( InterfaceHandle  handle,
std::string_view  targetToRemove 
)
overridevirtual

remove a target from a handles operation

Parameters
handlethe handle from the publication, input, endpoint or filter
targetToRemovethe name of the target to remove

Implements helics::Core.

◆ requestTimeIterative()

iteration_time helics::EmptyCore::requestTimeIterative ( LocalFederateId  federateID,
Time  next,
IterationRequest  iterate 
)
overridevirtual

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.

Parameters
federateIDthe identifier for the federate to process
nextthe requested time
iteratethe requested iteration mode /ref iteration_request
Returns
an /ref iteration_time object with two field grantedTime and a enumeration indicating the state of the iteration

Implements helics::Core.

◆ send()

void helics::EmptyCore::send ( InterfaceHandle  sourceHandle,
const void *  data,
uint64_t  length 
)
overridevirtual

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.

◆ sendAt()

void helics::EmptyCore::sendAt ( InterfaceHandle  sourceHandle,
const void *  data,
uint64_t  length,
Time  time 
)
overridevirtual

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.

Parameters
sourceHandlethe source of the event
datathe raw data for the event
lengththe record length of the event
timethe time the event is scheduled for

Implements helics::Core.

◆ sendCommand()

void helics::EmptyCore::sendCommand ( std::string_view  target,
std::string_view  commandStr,
std::string_view  source,
HelicsSequencingModes  mode 
)
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

Parameters
targetthe specific target of the command
commandStrthe actual command
sourcethe designated source of the command, for return values or indication
modethe sequencing mode for the command, fast or ordered

Implements helics::Core.

◆ sendMessage()

void helics::EmptyCore::sendMessage ( InterfaceHandle  sourceHandle,
std::unique_ptr< Message message 
)
overridevirtual

Send for filters.

Continues sending the message to the next filter or to final destination.

Implements helics::Core.

◆ sendTo()

void helics::EmptyCore::sendTo ( InterfaceHandle  sourceHandle,
const void *  data,
uint64_t  length,
std::string_view  destination 
)
overridevirtual

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.

◆ sendToAt()

void helics::EmptyCore::sendToAt ( InterfaceHandle  sourceHandle,
const void *  data,
uint64_t  length,
std::string_view  destination,
Time  time 
)
overridevirtual

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.

Parameters
sourceHandlethe source of the event
datathe raw data for the event
lengththe record length of the event
destinationthe target of the event
timethe time the event is scheduled for

Implements helics::Core.

◆ setCoreReadyToInit()

void helics::EmptyCore::setCoreReadyToInit ( )
overridevirtual

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.

◆ setFederateOperator()

void helics::EmptyCore::setFederateOperator ( LocalFederateId  fed,
std::shared_ptr< FederateOperator callback 
)
overridevirtual

set the callback Federate operators

Parameters
fedthe federate to set the callback for
callbackpointer to the operator class executing the federate

Implements helics::Core.

◆ setFederateTag()

void helics::EmptyCore::setFederateTag ( LocalFederateId  fid,
std::string_view  tag,
std::string_view  value 
)
overridevirtual

setter for federate tags which are key-value pairs

Parameters
fidthe identifier for the federate to set the tag data on
taga string containing the name of the tag
valuea string containing the value for the tag

Implements helics::Core.

◆ setFilterOperator()

void helics::EmptyCore::setFilterOperator ( InterfaceHandle  filter,
std::shared_ptr< FilterOperator callback 
)
overridevirtual

set the filter callback operator

Parameters
filterthe handle of the filter
callbackpointer to the operator class executing the filter

Implements helics::Core.

◆ setFlagOption()

void helics::EmptyCore::setFlagOption ( LocalFederateId  federateID,
int32_t  flag,
bool  flagValue = true 
)
overridevirtual

Set a flag in a a federate

Parameters
federateIDthe identifier for the federate
flagan index code for the flag to set
flagValuethe value to set the flag to

Implements helics::Core.

◆ setGlobal()

void helics::EmptyCore::setGlobal ( std::string_view  valueName,
std::string_view  value 
)
overridevirtual

set a federation global value

this overwrites any previous value for this name

Parameters
valueNamethe name of the global to set
valuethe value of the global

Implements helics::Core.

◆ setHandleOption()

void helics::EmptyCore::setHandleOption ( InterfaceHandle  handle,
int32_t  option,
int32_t  option_value 
)
overridevirtual

set a handle option

Parameters
handlethe handle from the publication, input, endpoint or filter
optionthe option to set
option_valuethe value to set the option (mostly 0 or 1)

Implements helics::Core.

◆ setIntegerProperty()

void helics::EmptyCore::setIntegerProperty ( LocalFederateId  federateID,
int32_t  property,
int16_t  propValue 
)
overridevirtual

set an integer property on a federate

Parameters
federateIDthe federate to set a time based property on
propertythe property to set see /ref defs::properties
propValuethe requested value of the property

Implements helics::Core.

◆ setInterfaceInfo()

void helics::EmptyCore::setInterfaceInfo ( helics::InterfaceHandle  handle,
std::string_view  info 
)
overridevirtual

set the local information field of the interface

Implements helics::Core.

◆ setInterfaceTag()

void helics::EmptyCore::setInterfaceTag ( InterfaceHandle  handle,
std::string_view  tag,
std::string_view  value 
)
overridevirtual

setter for interface tags which are key-value pairs

Parameters
handlethe identifier for the interface to set the tag data on
taga string containing the name of the tag
valuea string containing the value for the tag

Implements helics::Core.

◆ setLogFile()

void helics::EmptyCore::setLogFile ( std::string_view  lfile)
overridevirtual

set the core logging file

Implements helics::Core.

◆ setLoggingCallback()

void helics::EmptyCore::setLoggingCallback ( LocalFederateId  federateID,
std::function< void(int, std::string_view, std::string_view)>  logFunction 
)
overridevirtual

define a logging function to use for logging message and notices from the federation and individual federate

Parameters
federateIDthe identifier for the individual federate or 0 for the Core Logger
logFunctionthe 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.

◆ setLoggingLevel()

void helics::EmptyCore::setLoggingLevel ( int  logLevel)
overridevirtual

set the core logging level

Implements helics::Core.

◆ setQueryCallback()

void helics::EmptyCore::setQueryCallback ( LocalFederateId  federateID,
std::function< std::string(std::string_view)>  queryFunction,
int  order 
)
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.

Parameters
federateIDthe identifier for the federate
queryFunctiona 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
orderindicator 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.

◆ setTimeProperty()

void helics::EmptyCore::setTimeProperty ( LocalFederateId  federateID,
int32_t  property,
Time  timeValue 
)
overridevirtual

set a timebased property on a federate

Parameters
federateIDthe federate to set a time based property on
propertythe property to set see /ref defs::properties
timeValuethe requested value of the property

Implements helics::Core.

◆ setTranslatorOperator()

void helics::EmptyCore::setTranslatorOperator ( InterfaceHandle  translator,
std::shared_ptr< TranslatorOperator callback 
)
overridevirtual

set the translator callback operators

Parameters
translatorthe handle of the translator
callbackpointer to the operator class executing the translator

Implements helics::Core.

◆ setValue()

void helics::EmptyCore::setValue ( InterfaceHandle  handle,
const char *  data,
uint64_t  len 
)
overridevirtual

Publish specified data to the specified key.

Parameters
handlethe handle from the publication, input, endpoint or filter
datathe raw data to send
lenthe size of the data

Implements helics::Core.

◆ timeRequest()

Time helics::EmptyCore::timeRequest ( LocalFederateId  federateID,
Time  next 
)
overridevirtual

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.

Parameters
federateIDthe identification of the federate requesting the time
nextthe next time that is requested from the federate

Implements helics::Core.

◆ waitCommand()

std::pair< std::string, std::string > helics::EmptyCore::waitCommand ( LocalFederateId  federateID)
overridevirtual

get a command for a specific federate. block until a command is received

Implements helics::Core.

◆ waitForDisconnect()

bool helics::EmptyCore::waitForDisconnect ( std::chrono::milliseconds  msToWait = std::chrono::milliseconds(0)) const
overridevirtual

waits in the current thread until the core is disconnected

Returns
true if the disconnect was successful

Implements helics::Core.


The documentation for this class was generated from the following files: