![]() |
helics
2.8.1
|
#include <Federate.hpp>
Public Types | |
enum | modes : char { modes::startup = 0, modes::initializing = 1, modes::executing = 2, modes::finalize, modes::error = 4, modes::pending_init = 5, modes::pending_exec = 6, modes::pending_time = 7, modes::pending_iterative_time, modes::pending_finalize = 9, modes::finished = 10 } |
Public Member Functions | |
Federate (const std::string &fedname, const FederateInfo &fi) | |
Federate (const std::string &fedname, const std::shared_ptr< Core > &core, const FederateInfo &fi=FederateInfo{}) | |
Federate (const std::string &fedname, CoreApp &core, const FederateInfo &fi=FederateInfo{}) | |
Federate (const std::string &configString) | |
Federate (const std::string &fedname, const std::string &configString) | |
Federate () noexcept | |
Federate (Federate &&fed) noexcept | |
Federate (const Federate &fed)=delete | |
virtual | ~Federate () |
Federate & | operator= (Federate &&fed) noexcept |
Federate & | operator= (const Federate &fed)=delete |
void | enterInitializingMode () |
void | enterInitializingModeAsync () |
bool | isAsyncOperationCompleted () const |
void | enterInitializingModeComplete () |
iteration_result | enterExecutingMode (iteration_request iterate=iteration_request::no_iterations) |
void | enterExecutingModeAsync (iteration_request iterate=iteration_request::no_iterations) |
iteration_result | enterExecutingModeComplete () |
void | finalize () |
void | finalizeAsync () |
void | finalizeComplete () |
virtual void | disconnect () |
void | error (int errorcode) |
void | error (int errorcode, const std::string &message) |
void | localError (int errorcode, const std::string &message) |
void | globalError (int errorcode, const std::string &message) |
void | localError (int errorcode) |
void | globalError (int errorcode) |
void | setSeparator (char separator) |
Time | requestTime (Time nextInternalTimeStep) |
Time | requestNextStep () |
Time | requestTimeAdvance (Time timeDelta) |
iteration_time | requestTimeIterative (Time nextInternalTimeStep, iteration_request iterate) |
void | requestTimeAsync (Time nextInternalTimeStep) |
void | requestTimeIterativeAsync (Time nextInternalTimeStep, iteration_request iterate) |
Time | requestTimeComplete () |
iteration_time | requestTimeIterativeComplete () |
void | setProperty (int32_t option, double timeValue) |
void | setProperty (int32_t option, Time timeValue) |
virtual void | setFlagOption (int flag, bool flagValue=true) |
void | setProperty (int32_t option, int32_t optionValue) |
Time | getTimeProperty (int32_t option) const |
virtual bool | getFlagOption (int flag) const |
int | getIntegerProperty (int32_t option) const |
void | setLoggingCallback (const std::function< void(int, const std::string &, const std::string &)> &logFunction) |
std::string | query (const std::string &target, const std::string &queryStr, helics_sequencing_mode mode=helics_sequencing_mode_fast) |
std::string | query (const std::string &queryStr, helics_sequencing_mode mode=helics_sequencing_mode_fast) |
query_id_t | queryAsync (const std::string &target, const std::string &queryStr, helics_sequencing_mode mode=helics_sequencing_mode_fast) |
query_id_t | queryAsync (const std::string &queryStr, helics_sequencing_mode mode=helics_sequencing_mode_fast) |
std::string | queryComplete (query_id_t queryIndex) |
bool | isQueryCompleted (query_id_t queryIndex) const |
void | setQueryCallback (const std::function< std::string(const std::string &)> &queryFunction) |
void | setGlobal (const std::string &valueName, const std::string &value) |
void | addDependency (const std::string &fedName) |
Filter & | registerGlobalFilter (const std::string &filterName, const std::string &inputType=std::string(), const std::string &outputType=std::string()) |
CloningFilter & | registerGlobalCloningFilter (const std::string &filterName, const std::string &inputType=std::string(), const std::string &outputType=std::string()) |
Filter & | registerFilter (const std::string &filterName, const std::string &inputType=std::string(), const std::string &outputType=std::string()) |
CloningFilter & | registerCloningFilter (const std::string &filterName, const std::string &inputType=std::string(), const std::string &outputType=std::string()) |
Filter & | registerFilter () |
CloningFilter & | registerCloningFilter () |
void | addSourceTarget (const Filter &filt, const std::string &targetEndpoint) |
void | addDestinationTarget (const Filter &filt, const std::string &targetEndpoint) |
const std::string & | getInterfaceName (interface_handle handle) const |
const Filter & | getFilter (const std::string &filterName) const |
const Filter & | getFilter (int index) const |
Filter & | getFilter (const std::string &filterName) |
Filter & | getFilter (int index) |
void | setFilterOperator (const Filter &filt, std::shared_ptr< FilterOperator > op) |
register a operator for the specified filter More... | |
int | getFilterCount () const |
virtual void | registerInterfaces (const std::string &configString) |
void | registerFilterInterfaces (const std::string &configString) |
void | closeInterface (interface_handle handle) |
auto | getID () const noexcept |
modes | getCurrentMode () const |
Time | getCurrentTime () const |
const std::string & | getName () const |
const std::shared_ptr< Core > & | getCorePointer () |
int | filterCount () const |
void | setInfo (interface_handle handle, const std::string &info) |
const std::string & | getInfo (interface_handle handle) |
void | setInterfaceOption (interface_handle handle, int32_t option, int32_t option_value=1) |
int32_t | getInterfaceOption (interface_handle handle, int32_t option) |
const std::string & | getInjectionType (interface_handle handle) const |
const std::string & | getExtractionType (interface_handle handle) const |
const std::string & | getInjectionUnits (interface_handle handle) const |
const std::string & | getExtractionUnits (interface_handle handle) const |
const std::string & | getInterfaceUnits (interface_handle handle) const |
void | logMessage (int level, const std::string &message) const |
void | logErrorMessage (const std::string &message) const |
void | logWarningMessage (const std::string &message) const |
void | logInfoMessage (const std::string &message) const |
void | logDebugMessage (const std::string &message) const |
void | completeOperation () |
Protected Member Functions | |
virtual void | updateTime (Time newTime, Time oldTime) |
virtual void | startupToInitializeStateTransition () |
virtual void | initializeToExecuteStateTransition (iteration_result iterate) |
virtual std::string | localQuery (const std::string &queryStr) const |
Protected Attributes | |
std::atomic< modes > | currentMode {modes::startup} |
the current state of the simulation | |
char | nameSegmentSeparator = '/' |
the separator between automatically prependend names | |
bool | strictConfigChecking {true} |
bool | useJsonSerialization {false} |
std::shared_ptr< Core > | coreObject |
reference to the core simulation API | |
Time | currentTime = Time::minVal() |
the current simulation time | |
base class for a federate in the application API
|
strong |
the allowable operation modes of the federate
helics::Federate::Federate | ( | const std::string & | fedname, |
const FederateInfo & | fi | ||
) |
constructor taking a federate information structure
fedname | the name of the federate can be empty to use a name from the federateInfo |
fi | a federate information structure |
make sure the core is connected
References helics::CoreFactory::cleanUpCores(), helics::FederateInfo::coreName, coreObject, helics::FederateInfo::coreType, currentTime, helics::FederateInfo::defName, helics::CoreFactory::findJoinableCoreOfType(), helics::CoreFactory::FindOrCreate(), helics::FederateInfo::forceNewCore, helics::generateFullCoreInitString(), helics_flag_strict_config_checking, logWarningMessage(), nameSegmentSeparator, helics::FederateInfo::separator, strictConfigChecking, helics::FederateInfo::useJsonSerialization, and useJsonSerialization.
helics::Federate::Federate | ( | const std::string & | fedname, |
const std::shared_ptr< Core > & | core, | ||
const FederateInfo & | fi = FederateInfo{} |
||
) |
constructor taking a core and a federate information structure
fedname | the name of the federate can be empty to use a name from the federateInfo |
core | a shared pointer to a core object, the pointer will be copied |
fi | a federate information structure |
make sure the core is connected
References helics::FederateInfo::coreName, coreObject, helics::FederateInfo::coreType, currentTime, helics::FederateInfo::defName, helics::CoreFactory::findJoinableCoreOfType(), helics::CoreFactory::FindOrCreate(), helics::generateFullCoreInitString(), helics_flag_strict_config_checking, nameSegmentSeparator, helics::FederateInfo::separator, and strictConfigChecking.
helics::Federate::Federate | ( | const std::string & | fedname, |
CoreApp & | core, | ||
const FederateInfo & | fi = FederateInfo{} |
||
) |
|
explicit |
constructor taking a file with the required information
configString | can be either a JSON file or a string containing JSON code or a TOML file |
helics::Federate::Federate | ( | const std::string & | fedname, |
const std::string & | configString | ||
) |
constructor taking a file with the required information and the name of the federate
fedname | the name of the federate |
configString | can be either a JSON file or a string containing JSON code or a TOML file with extension (.toml, .TOML) |
References registerFilterInterfaces().
|
noexcept |
default constructor
|
delete |
deleted copy constructor
|
virtual |
virtual destructor function
References coreObject, and finalize().
void helics::Federate::addDependency | ( | const std::string & | fedName | ) |
add a dependency for this federate
adds an additional internal time dependency for the federate
fedName | the name of the federate to add a dependency on |
References coreObject.
void helics::Federate::addDestinationTarget | ( | const Filter & | filt, |
const std::string & | targetEndpoint | ||
) |
add a destination target to a filter
filt | a filter object |
targetEndpoint | the name of the endpoint to filter the data going to |
References coreObject, and helics::Filter::getHandle().
void helics::Federate::addSourceTarget | ( | const Filter & | filt, |
const std::string & | targetEndpoint | ||
) |
add a source target to a filter
filt | the filter object to add a source endpoint to |
targetEndpoint | the name of the endpoint to filter the data from |
References coreObject, and helics::Filter::getHandle().
void helics::Federate::closeInterface | ( | interface_handle | handle | ) |
disconnect an interface from its targets and remove it from consideration
References coreObject.
void helics::Federate::completeOperation | ( | ) |
call to complete async operation with no output
References currentMode, enterExecutingModeComplete(), enterInitializingModeComplete(), finalizeComplete(), pending_exec, pending_finalize, pending_init, pending_iterative_time, pending_time, requestTimeComplete(), and requestTimeIterativeComplete().
Referenced by globalError(), and localError().
|
virtual |
disconnect a simulation from the core (will also call finalize before disconnecting if necessary)
Reimplemented in helics::ValueFederate, helics::MessageFederate, and helics::CombinationFederate.
References coreObject, and finalize().
Referenced by helics::MessageFederate::disconnect(), and helics::ValueFederate::disconnect().
iteration_result helics::Federate::enterExecutingMode | ( | iteration_request | iterate = iteration_request::no_iterations | ) |
enter the normal execution mode
call will block until all federates have entered this mode
iterate | an optional flag indicating the desired iteration mode |
References coreObject, currentMode, currentTime, enterExecutingModeComplete(), enterInitializingMode(), error, helics::error, executing, finished, helics::halted, helics::initializationTime, initializeToExecuteStateTransition(), initializing, helics::iterating, helics::next_step, pending_exec, pending_init, pending_iterative_time, pending_time, requestTimeComplete(), requestTimeIterativeComplete(), startup, and helics::timeZero.
Referenced by enterExecutingModeComplete().
void helics::Federate::enterExecutingModeAsync | ( | iteration_request | iterate = iteration_request::no_iterations | ) |
enter the normal execution mode
call will return immediately but enterExecutingModeComplete should be called to complete the operation
iterate | an optional flag indicating the desired iteration mode |
References coreObject, currentMode, currentTime, enterInitializingModeComplete(), executing, initializing, pending_exec, pending_init, pending_iterative_time, pending_time, startup, and startupToInitializeStateTransition().
iteration_result helics::Federate::enterExecutingModeComplete | ( | ) |
complete the async call for entering Execution state
call will not block but will return quickly. The enterInitializingModeComplete must be called before doing other operations
References currentMode, currentTime, enterExecutingMode(), error, helics::error, executing, finished, helics::halted, helics::initializationTime, initializeToExecuteStateTransition(), initializing, helics::iterating, helics::next_step, pending_exec, and helics::timeZero.
Referenced by completeOperation(), enterExecutingMode(), and finalizeAsync().
void helics::Federate::enterInitializingMode | ( | ) |
enter the initialization mode after all interfaces have been defined
the call will block until all federates have entered initialization mode
References coreObject, currentMode, currentTime, enterInitializingModeComplete(), error, initializing, pending_init, startup, and startupToInitializeStateTransition().
Referenced by enterExecutingMode(), and enterInitializingModeComplete().
void helics::Federate::enterInitializingModeAsync | ( | ) |
enter the initialization mode after all interfaces have been defined
the call will not block but a call to enterInitializingModeComplete should be made to complete the call sequence
References coreObject, currentMode, initializing, pending_init, and startup.
void helics::Federate::enterInitializingModeComplete | ( | ) |
second part of the async process for entering initializationState call after a call to enterInitializingModeAsync if call any other time it will throw an InvalidFunctionCall exception
References coreObject, currentMode, currentTime, enterInitializingMode(), error, initializing, pending_init, startup, and startupToInitializeStateTransition().
Referenced by completeOperation(), enterExecutingModeAsync(), enterInitializingMode(), and finalizeAsync().
void helics::Federate::error | ( | int | errorcode | ) |
specify the simulator had an unrecoverable error
errorcode | an integral code for the error |
References localError().
void helics::Federate::error | ( | int | errorcode, |
const std::string & | message | ||
) |
specify the simulator had an error with error code and message
errorcode | an integral code for the error |
message | a string describing the error to display in a log |
References localError().
int helics::Federate::filterCount | ( | ) | const |
get a count of the number of filter objects stored in the federate
void helics::Federate::finalize | ( | ) |
terminate the simulation
call is will block until the finalize has been acknowledged, no commands that interact with the core may be called after this function function
References coreObject, currentMode, error, executing, finalize, finalizeComplete(), finished, initializing, pending_exec, pending_finalize, pending_init, pending_iterative_time, pending_time, and startup.
Referenced by disconnect(), finalizeComplete(), and ~Federate().
void helics::Federate::finalizeAsync | ( | ) |
terminate the simulation in a non-blocking call
finalizeComplete must be called after this call to complete the finalize procedure
References coreObject, currentMode, enterExecutingModeComplete(), enterInitializingModeComplete(), error, finalize, pending_exec, pending_finalize, pending_init, pending_iterative_time, pending_time, requestTimeComplete(), and requestTimeIterativeComplete().
void helics::Federate::finalizeComplete | ( | ) |
complete the asynchronous terminate pair
References currentMode, finalize, and pending_finalize.
Referenced by completeOperation(), and finalize().
|
inline |
get a shared pointer to the core object used by the federate
Referenced by helics::CloningFilter::CloningFilter(), helics::Filter::Filter(), and helics::make_cloning_filter().
|
inline |
get the current state of the federate
|
inline |
get the current Time
the most recent granted time of the federate
const std::string & helics::Federate::getExtractionType | ( | interface_handle | handle | ) | const |
get the extraction type for an interface, this is the type for data coming out of 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 |
References coreObject.
const std::string & helics::Federate::getExtractionUnits | ( | interface_handle | handle | ) | const |
get the extraction type for an interface, this is the units associated with data coming out of an interface
for publications this is the specified units, for inputs this is the specified type
handle | the interface handle to get the injection type for |
References coreObject.
Filter & helics::Federate::getFilter | ( | const std::string & | filterName | ) |
get a filter from its name
filterName | the name of the filter |
References getName(), helics::Filter::isValid(), and nameSegmentSeparator.
const Filter & helics::Federate::getFilter | ( | const std::string & | filterName | ) | const |
get a filter from its name
filterName | the name of the filter |
References getName(), helics::Filter::isValid(), and nameSegmentSeparator.
Filter & helics::Federate::getFilter | ( | int | index | ) |
get a filter from its index
index | the index of a filter |
const Filter & helics::Federate::getFilter | ( | int | index | ) | const |
get a filter from its index
index | the index of a filter |
int helics::Federate::getFilterCount | ( | ) | const |
get the number of filters registered through this federate
|
virtual |
get the value of a flag option
flag | an index into the flag /ref flag-definitions.h |
References coreObject, helics_flag_use_json_serialization, and useJsonSerialization.
|
inlinenoexcept |
get the underlying federateID for the core
Referenced by helics::MessageFederate::MessageFederate(), and helics::ValueFederate::ValueFederate().
std::string const & helics::Federate::getInfo | ( | interface_handle | handle | ) |
get the data currently stored for a particular interface handle
handle | the handle to get the information for |
References coreObject.
const std::string & helics::Federate::getInjectionType | ( | interface_handle | handle | ) | const |
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 |
References coreObject.
const std::string & helics::Federate::getInjectionUnits | ( | interface_handle | handle | ) | const |
get the injection units for an interface, this is the units associated with data coming into an interface
for inputs this is the input type, for publications this is the units used to transmit data, and for inputs this is the units of the transmitting publication
handle | the interface handle to get the injection units for |
References coreObject.
int32_t helics::Federate::getIntegerProperty | ( | int32_t | option | ) | const |
get an integer option for the federate
option | the option to inquire see /ref defs |
References coreObject.
const std::string & helics::Federate::getInterfaceName | ( | interface_handle | handle | ) | const |
get the name/key associated with an interface
handle | the interface handle to query |
References coreObject.
int32_t helics::Federate::getInterfaceOption | ( | interface_handle | handle, |
int32_t | option | ||
) |
get the current value for an interface option
handle | the handle of an interface to modify |
option | the option field to modify |
get the current value for an interface option
References coreObject.
Referenced by helics::Input::getOption().
|
inline |
get the units associated with an interface
this function will is identical to getExtractionUnits
handle | the interface handle to get the extraction units for |
|
inline |
get the federate name
Referenced by helics::MessageFederate::getEndpoint(), getFilter(), helics::ValueFederate::getInput(), helics::ValueFederate::getPublication(), query(), registerCloningFilter(), helics::MessageFederate::registerEndpoint(), registerFilter(), helics::ValueFederate::registerInput(), and helics::ValueFederate::registerPublication().
Time helics::Federate::getTimeProperty | ( | int32_t | option | ) | const |
get the value of a time option for the federate
option | the option to get |
References coreObject.
void helics::Federate::globalError | ( | int | errorcode | ) |
specify the simulator had a global error with error code
errorcode | an integral code for the error |
References globalError().
void helics::Federate::globalError | ( | int | errorcode, |
const std::string & | message | ||
) |
specify the simulator had a global error with error code and message
global errors propagate through the entire federation and will halt operations
errorcode | an integral code for the error |
message | a string describing the error to display in the log |
References completeOperation(), coreObject, currentMode, and error.
Referenced by globalError().
|
protectedvirtual |
function to deal with any operations that need to occur on the transition from startup to initialize
Reimplemented in helics::ValueFederate, helics::MessageFederate, and helics::CombinationFederate.
Referenced by enterExecutingMode(), and enterExecutingModeComplete().
bool helics::Federate::isAsyncOperationCompleted | ( | ) | const |
called after one of the async calls and will indicate true if an async operation has completed
only call from the same thread as the one that called the initial async call and will return false if called when no aysnc operation is in flight
References currentMode, pending_exec, pending_finalize, pending_init, pending_iterative_time, and pending_time.
bool helics::Federate::isQueryCompleted | ( | query_id_t | queryIndex | ) | const |
check if an asynchronous query call has been completed
void helics::Federate::localError | ( | int | errorcode | ) |
specify the simulator had a local error with error code
errorcode | an integral code for the error |
References localError().
void helics::Federate::localError | ( | int | errorcode, |
const std::string & | message | ||
) |
specify the simulator had a local error with error code and message
errorcode | an integral code for the error |
message | a string describing the error to display in a log |
References completeOperation(), coreObject, currentMode, and error.
Referenced by error(), and localError().
|
protectedvirtual |
function to generate results for a local Query
should return an empty string if the query is not recognized
Reimplemented in helics::ValueFederate, helics::MessageFederate, and helics::CombinationFederate.
Referenced by query().
|
inline |
log a debug message to the federate Logger
message | the message to log |
References helics_log_level_data.
|
inline |
log an error message to the federate Logger
message | the message to log |
References helics_log_level_error.
|
inline |
log an info message to the federate Logger
message | the message to log |
References helics_log_level_summary.
void helics::Federate::logMessage | ( | int | level, |
const std::string & | message | ||
) | const |
log a message to the federate Logger
level | the logging level of the message |
message | the message to log |
References coreObject, and helics_log_level_warning.
|
inline |
log a warning message to the federate Logger
message | the message to log |
References helics_log_level_warning.
Referenced by Federate().
default move assignment
References fed.
Referenced by helics::MessageFederate::operator=(), and helics::ValueFederate::operator=().
std::string helics::Federate::query | ( | const std::string & | queryStr, |
helics_sequencing_mode | mode = helics_sequencing_mode_fast |
||
) |
make a query of the core
this call is blocking until the value is returned which make take some time depending on the size of the federation and the specific string being queried
queryStr | a string with the query see other documentation for specific properties to query, can be defined by the federate if the local federate does not recognize the query it sends it on to the federation |
mode | fast (asynchronous; default) means the query goes on priority channels, ordered (synchronous) is slower but has more ordering guarantees |
References coreObject, currentTime, getName(), and localQuery().
std::string helics::Federate::query | ( | const std::string & | target, |
const std::string & | queryStr, | ||
helics_sequencing_mode | mode = helics_sequencing_mode_fast |
||
) |
make a query of the core
this call is blocking until the value is returned which make take some time depending on the size of the federation and the specific string being queried
target | the target of the query can be "federation", "federate", "broker", "core", or a specific name of a federate, core, or broker |
queryStr | a string with the query see other documentation for specific properties to query, can be defined by the federate |
mode | fast (asynchronous; default) means the query goes on priority channels, ordered (synchronous) is slower but has more ordering guarantees |
References coreObject, and getName().
Referenced by queryAsync().
query_id_t helics::Federate::queryAsync | ( | const std::string & | queryStr, |
helics_sequencing_mode | mode = helics_sequencing_mode_fast |
||
) |
make a query of the core in an async fashion
this call is blocking until the value is returned which make take some time depending on the size of the federation and the specific string being queried
queryStr | a string with the query see other documentation for specific properties to query, can be defined by the federate |
References query().
query_id_t helics::Federate::queryAsync | ( | const std::string & | target, |
const std::string & | queryStr, | ||
helics_sequencing_mode | mode = helics_sequencing_mode_fast |
||
) |
make a query of the core in an async fashion
this call is blocking until the value is returned which make take some time depending on the size of the federation and the specific string being queried
target | the target of the query can be "federation", "federate", "broker", "core", or a specific name of a federate, core, or broker |
queryStr | a string with the query see other documentation for specific properties to query, can be defined by the federate |
mode | fast (asynchronous; default) means the query goes on priority channels, ordered(synchronous) is slower but has more ordering guarantees |
References coreObject.
std::string helics::Federate::queryComplete | ( | query_id_t | queryIndex | ) |
get the results of an async query
the call will block until the results are returned inquiry of queryCompleted() to check if the results have been returned or not yet
queryIndex | the int value returned from the queryAsync call |
References helics::identifier_id_t< BaseType, ID, invalidValue >::value().
|
inline |
define a nameless cloning filter interface on a source
CloningFilter & helics::Federate::registerCloningFilter | ( | const std::string & | filterName, |
const std::string & | inputType = std::string() , |
||
const std::string & | outputType = std::string() |
||
) |
define a cloning filter interface on a source
a source filter will be sent any packets that come from a particular source if multiple filters are defined on the same source, they will be placed in some order defined by the core
filterName | the name of the filter |
inputType | the inputType which the filter can handle |
outputType | the outputType of the filter which the filter produces |
References getName(), and nameSegmentSeparator.
Referenced by helics::make_cloning_filter().
|
inline |
define a nameless filter interface
Filter & helics::Federate::registerFilter | ( | const std::string & | filterName, |
const std::string & | inputType = std::string() , |
||
const std::string & | outputType = std::string() |
||
) |
define a filter interface
a filter will modify messages coming from or going to target endpoints
filterName | the name of the filter |
inputType | the inputType which the filter can handle |
outputType | the outputType of the filter which the filter produces |
References getName(), and nameSegmentSeparator.
void helics::Federate::registerFilterInterfaces | ( | const std::string & | configString | ) |
register filter interfaces defined in file or string
call is only valid in startup mode
configString | the location of the file or config String to load to generate the interfaces |
Referenced by Federate(), helics::CombinationFederate::registerInterfaces(), helics::MessageFederate::registerInterfaces(), and registerInterfaces().
CloningFilter & helics::Federate::registerGlobalCloningFilter | ( | const std::string & | filterName, |
const std::string & | inputType = std::string() , |
||
const std::string & | outputType = std::string() |
||
) |
define a cloning filter interface on a source
a cloning filter will modify copy of messages coming from or going to target endpoints
filterName | the name of the filter |
inputType | the inputType which the filter can handle |
outputType | the outputType of the filter which the filter produces |
Filter & helics::Federate::registerGlobalFilter | ( | const std::string & | filterName, |
const std::string & | inputType = std::string() , |
||
const std::string & | outputType = std::string() |
||
) |
define a named global filter interface
filterName | the name of the globally visible filter |
inputType | the inputType which the filter can handle |
outputType | the outputType of the filter which the filter produces |
|
virtual |
register a set of interfaces defined in a file
call is only valid in startup mode
configString | the location of the file or config String to load to generate the interfaces |
Reimplemented in helics::ValueFederate, helics::MessageFederate, and helics::CombinationFederate.
References registerFilterInterfaces().
Referenced by helics::ValueFederate::registerInterfaces().
|
inline |
request a time advancement to the next allowed time
References helics::timeZero.
request a time advancement
nextInternalTimeStep | the next requested time step |
References coreObject, currentMode, currentTime, error, executing, finalize, finished, and updateTime().
request a time advancement by a certain amount
timeDelta | the amount of time to advance |
void helics::Federate::requestTimeAsync | ( | Time | nextInternalTimeStep | ) |
request a time advancement and return immediately for asynchronous function.
/ref requestTimeComplete should be called to finish the operation and get the result
nextInternalTimeStep | the next requested time step |
References coreObject, currentMode, executing, and pending_time.
Time helics::Federate::requestTimeComplete | ( | ) |
request a time advancement
References currentMode, currentTime, executing, pending_time, and updateTime().
Referenced by completeOperation(), enterExecutingMode(), and finalizeAsync().
iteration_time helics::Federate::requestTimeIterative | ( | Time | nextInternalTimeStep, |
iteration_request | iterate | ||
) |
request a time advancement
nextInternalTimeStep | the next requested time step |
iterate | a requested iteration mode |
References coreObject, currentMode, currentTime, error, helics::error, executing, finalize, finished, helics::halted, helics::iterating, helics::next_step, and updateTime().
void helics::Federate::requestTimeIterativeAsync | ( | Time | nextInternalTimeStep, |
iteration_request | iterate | ||
) |
request a time advancement with iterative call and return for asynchronous function.
/ref requestTimeIterativeComplete should be called to finish the operation and get the result
nextInternalTimeStep | the next requested time step |
iterate | a requested iteration level (none, require, optional) |
References coreObject, currentMode, executing, and pending_iterative_time.
iteration_time helics::Federate::requestTimeIterativeComplete | ( | ) |
finalize the time advancement request
finalize the time advancement request
References currentMode, currentTime, error, helics::error, executing, finished, helics::halted, helics::iterating, helics::next_step, pending_iterative_time, and updateTime().
Referenced by completeOperation(), enterExecutingMode(), and finalizeAsync().
void helics::Federate::setFilterOperator | ( | const Filter & | filt, |
std::shared_ptr< FilterOperator > | op | ||
) |
register a operator for the specified filter
The FilterOperator gets called when there is a message to filter, There is no order or state to this messages can come in any order.
filt | the filter object to set the operation on |
op | a shared_ptr to a FilterOperator |
References coreObject, and helics::Filter::getHandle().
|
virtual |
set a flag for the federate
flag | an index into the flag /ref flag-definitions.h |
flagValue | the value of the flag defaults to true |
Reimplemented in helics::CombinationFederate, and helics::ValueFederate.
References coreObject.
Referenced by helics::ValueFederate::setFlagOption().
void helics::Federate::setGlobal | ( | const std::string & | valueName, |
const std::string & | value | ||
) |
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 |
References coreObject.
void helics::Federate::setInfo | ( | interface_handle | handle, |
const std::string & | info | ||
) |
set the information field for an interface
handle | the interface handle for any interface, the interface handle can be created from any interface object automatically |
info | the information to store |
References coreObject.
void helics::Federate::setInterfaceOption | ( | interface_handle | handle, |
int32_t | option, | ||
int32_t | option_value = 1 |
||
) |
set an interface option
handle | the handle of an interface to modify |
option | the option field to modify |
option_value | the value to set (defaults to 1 or true), most options are boolean but some allow for other values |
References coreObject.
Referenced by helics::Input::setOption().
void helics::Federate::setLoggingCallback | ( | const std::function< void(int, const std::string &, const std::string &)> & | logFunction | ) |
define a logging function to use for logging message and notices from the federation and individual federate
logFunction | the callback function for doing something with a log message it takes 3 inputs an integer for logLevel /ref helics_log_level A string indicating the source of the message and another string with the actual message |
References coreObject.
void helics::Federate::setProperty | ( | int32_t | option, |
double | timeValue | ||
) |
set a time option for the federate
option | the option to set |
timeValue | the value to be set |
References coreObject.
void helics::Federate::setProperty | ( | int32_t | option, |
int32_t | optionValue | ||
) |
set an integer option for the federate
option | an index of the option to set |
optionValue | an integer option value for an integer based property |
References coreObject.
void helics::Federate::setProperty | ( | int32_t | option, |
Time | timeValue | ||
) |
set a time option for the federate
option | the option to set |
timeValue | the value to be set |
References coreObject.
void helics::Federate::setQueryCallback | ( | const std::function< std::string(const std::string &)> & | queryFunction | ) |
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.
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 internally that is directed at that particular federate |
References coreObject.
|
inline |
specify a separator to use for naming separation between the federate name and the interface name setSeparator('.') will result in future registrations of local endpoints such as fedName.endpoint setSeparator('/') will result in fedName/endpoint the default is '/' any character can be used though many will not make that much sense. This call is not thread safe and should be called before any local interfaces are created otherwise it may not be possible to retrieve them without using the full name. recommended possibilities are ('.','/', ':','-','_')
|
protectedvirtual |
function to deal with any operations that need to occur on the transition from startup to initialize
Reimplemented in helics::ValueFederate, helics::MessageFederate, and helics::CombinationFederate.
Referenced by enterExecutingModeAsync(), enterInitializingMode(), and enterInitializingModeComplete().
function to deal with any operations that need to occur on a time update
Reimplemented in helics::ValueFederate, helics::MessageFederate, and helics::CombinationFederate.
Referenced by requestTime(), requestTimeComplete(), requestTimeIterative(), and requestTimeIterativeComplete().
|
protected |
set to false to allow some invalid configurations to be ignored instead of error
Referenced by Federate().
|
protected |
set to true to force all outgoing data to json serialization
Referenced by Federate(), getFlagOption(), helics::ValueFederate::setFlagOption(), and helics::ValueFederate::ValueFederate().