| helics 3.6.1

Public Member Functions | Protected Member Functions | List of all members
helics::CombinationFederate Class Reference

`#include <CombinationFederate.hpp>`

Inheritance diagram for helics::CombinationFederate:

## Public Member Functions
| CombinationFederate ()
| CombinationFederate (std::string_view fedName, const FederateInfo &fedInfo)
| CombinationFederate (std::string_view fedName, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo=FederateInfo{})
| CombinationFederate (std::string_view fedName, CoreApp &core, const FederateInfo &fedInfo=FederateInfo{})
| CombinationFederate (std::string_view fedName, const std::string &configString)
| CombinationFederate (const std::string &configString)
| CombinationFederate (CombinationFederate &&fed) noexcept
virtual | ~CombinationFederate ()
CombinationFederate & | operator= (CombinationFederate &&fed) noexcept
| CombinationFederate (const CombinationFederate &fed)=delete
CombinationFederate & | operator= (const CombinationFederate &fed)=delete
virtual void | setFlagOption (int flagIndex, bool flagValue=true) override
virtual void | disconnect () override
virtual void | registerInterfaces (const std::string &configString) override
Public Member Functions inherited from helics::ValueFederate
| ValueFederate (std::string_view fedName, const FederateInfo &fedInfo)
| ValueFederate (std::string_view fedName, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo=FederateInfo{})
| ValueFederate (std::string_view fedName, CoreApp &core, const FederateInfo &fedInfo=FederateInfo{})
| ValueFederate (const std::string &configString)
| ValueFederate (std::string_view fedName, const std::string &configString)
| ValueFederate ()
| ValueFederate (bool res)
| ValueFederate (const char *configString)
| ValueFederate (const ValueFederate &fed)=delete
| ValueFederate (ValueFederate &&fed) noexcept
virtual | ~ValueFederate ()
ValueFederate & | operator= (ValueFederate &&fed) noexcept
ValueFederate & | operator= (const ValueFederate &fed)=delete
Publication & | registerPublication (std::string_view name, std::string_view type, std::string_view units=std::string_view{})
template<typename X >
Publication & | registerPublication (std::string_view name, std::string_view units=std::string_view{})
Publication & | registerGlobalPublication (std::string_view name, std::string_view type, std::string_view units=std::string_view{})
template<typename X >
Publication & | registerGlobalPublication (std::string_view name, std::string_view units=std::string_view{})
template<typename X >
Publication & | registerIndexedPublication (std::string_view name, int index1, std::string_view units=std::string_view{})
template<typename X >
Publication & | registerIndexedPublication (std::string_view name, int index1, int index2, std::string_view units=std::string_view{})
Input & | registerInput (std::string_view name, std::string_view type, std::string_view units=std::string_view{})
Input & | registerGlobalInput (std::string_view name, std::string_view type, std::string_view units=std::string_view{})
template<typename X >
Input & | registerInput (std::string_view name, std::string_view units=std::string_view{})
template<typename X >
Input & | registerGlobalInput (std::string_view name, std::string_view units=std::string_view{})
template<typename X >
Input & | registerIndexedInput (std::string_view name, int index1, std::string_view units=std::string_view())
template<typename X >
Input & | registerIndexedInput (std::string_view name, int index1, int index2, std::string_view units=std::string_view())
Input & | registerSubscription (std::string_view target, std::string_view units=std::string_view{})
Input & | registerIndexedSubscription (std::string_view target, int index1, std::string_view units=std::string_view{})
Input & | registerIndexedSubscription (std::string_view target, int index1, int index2, std::string_view units=std::string_view{})
void | addAlias (const Input &inp, std::string_view shortcutName)
void | addAlias (const Publication &pub, std::string_view shortcutName)
void | setDefaultValue (const Input &inp, data_view block)
void | registerValueInterfaces (const std::string &configString)
data_view | getBytes (const Input &inp)
bool | forceCoreUpdate (Input &inp)
void | publishBytes (const Publication &pub, data_view block)
void | publishBytes (const Publication &pub, const char *data, size_t data_size)
void | registerFromPublicationJSON (const std::string &jsonString)
void | publishJSON (const std::string &jsonString)
void | addTarget (const Publication &pub, std::string_view target)
void | addTarget (const Input &inp, std::string_view target)
void | removeTarget (const Publication &pub, std::string_view target)
void | removeTarget (const Input &inp, std::string_view target)
template<class iType >
void | addIndexedTarget (const iType &iObject, std::string_view target, int index1)
template<class iType >
void | addIndexedTarget (const iType &iObject, std::string_view target, int index1, int index2)
bool | isUpdated (const Input &inp) const
Time | getLastUpdateTime (const Input &inp) const
void | clearUpdates ()
void | clearUpdate (const Input &inp)
std::vector< int > | queryUpdates ()
const std::string & | getTarget (const Input &inp) const
const Input & | getInput (std::string_view name) const
Input & | getInput (std::string_view name)
const Input & | getInput (int index) const
Input & | getInput (int index)
const Input & | getInput (std::string_view name, int index1) const
const Input & | getInput (std::string_view name, int index1, int index2) const
const Input & | getSubscription (std::string_view target) const
Input & | getSubscription (std::string_view target)
const Input & | getInputByTarget (std::string_view target) const
Input & | getInputByTarget (std::string_view target)
Publication & | getPublication (std::string_view name)
const Publication & | getPublication (std::string_view name) const
Publication & | getPublication (int index)
const Publication & | getPublication (int index) const
const Publication & | getPublication (std::string_view name, int index1) const
const Publication & | getPublication (std::string_view name, int index1, int index2) const
void | setInputNotificationCallback (std::function< void(Input &, Time)> callback)
void | setInputNotificationCallback (Input &inp, std::function< void(Input &, Time)> callback)
int | getPublicationCount () const
int | getInputCount () const
void | addAlias (std::string_view interfaceName, std::string_view alias)
Public Member Functions inherited from helics::Federate
| Federate (std::string_view fedname, const FederateInfo &fedInfo)
| Federate (std::string_view fedname, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo=FederateInfo{})
| Federate (std::string_view fedname, CoreApp &core, const FederateInfo &fedInfo=FederateInfo{})
| Federate (const std::string &configString)
| Federate (std::string_view 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 ()
void | enterInitializingModeIterative ()
void | enterInitializingModeIterativeAsync ()
void | enterInitializingModeIterativeComplete ()
IterationResult | enterExecutingMode (IterationRequest iterate=IterationRequest::NO_ITERATIONS)
void | enterExecutingModeAsync (IterationRequest iterate=IterationRequest::NO_ITERATIONS)
IterationResult | enterExecutingModeComplete ()
void | finalize ()
void | finalizeAsync ()
void | finalizeComplete ()
void | processCommunication (std::chrono::milliseconds period=std::chrono::milliseconds(0))
void | localError (int errorcode, std::string_view message)
void | globalError (int errorcode, std::string_view 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, IterationRequest iterate)
void | requestTimeAsync (Time nextInternalTimeStep)
void | requestTimeIterativeAsync (Time nextInternalTimeStep, IterationRequest iterate)
Time | requestTimeComplete ()
iteration_time | requestTimeIterativeComplete ()
void | setTag (std::string_view tag, std::string_view value)
const std::string & | getTag (std::string_view tag) const
virtual void | setProperty (int32_t option, double timeValue)
virtual void | setProperty (int32_t option, Time timeValue)
virtual void | setProperty (int32_t option, int32_t optionValue)
virtual Time | getTimeProperty (int32_t option) const
virtual bool | getFlagOption (int flag) const
virtual int | getIntegerProperty (int32_t option) const
void | setLoggingCallback (const std::function< void(int, std::string_view, std::string_view)> &logFunction)
void | setInitializingEntryCallback (std::function< void(bool)> callback)
void | setExecutingEntryCallback (std::function< void()> callback)
void | setTimeRequestEntryCallback (std::function< void(Time, Time, bool)> callback)
void | setTimeUpdateCallback (std::function< void(Time, bool)> callback)
void | setModeUpdateCallback (std::function< void(Modes, Modes)> callback)
void | setTimeRequestReturnCallback (std::function< void(Time, bool)> callback)
void | setCosimulationTerminatedCallback (std::function< void()> callback)
void | setErrorHandlerCallback (std::function< void(int, std::string_view)> errorHandlerCallback)
std::string | query (std::string_view target, std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
std::string | query (std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
QueryId | queryAsync (std::string_view target, std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
QueryId | queryAsync (std::string_view queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST)
std::string | queryComplete (QueryId queryIndex)
bool | isQueryCompleted (QueryId queryIndex) const
void | setQueryCallback (const std::function< std::string(std::string_view)> &queryFunction)
void | setGlobal (std::string_view valueName, std::string_view value)
void | addAlias (std::string_view interfaceName, std::string_view alias)
void | sendCommand (std::string_view target, std::string_view commandStr, HelicsSequencingModes mode=HelicsSequencingModes::HELICS_SEQUENCING_MODE_FAST)
std::pair< std::string, std::string > | getCommand ()
std::pair< std::string, std::string > | waitCommand ()
void | addDependency (std::string_view fedName)
Filter & | registerGlobalFilter (std::string_view filterName, std::string_view inputType=std::string_view{}, std::string_view outputType=std::string_view{})
CloningFilter & | registerGlobalCloningFilter (std::string_view filterName, std::string_view inputType=std::string_view{}, std::string_view outputType=std::string_view{})
Filter & | registerFilter (std::string_view filterName, std::string_view inputType=std::string_view{}, std::string_view outputType=std::string_view{})
CloningFilter & | registerCloningFilter (std::string_view filterName, std::string_view inputType=std::string_view{}, std::string_view outputType=std::string_view{})
Filter & | registerFilter ()
Translator & | registerGlobalTranslator (std::int32_t translatorType, std::string_view translatorName, std::string_view endpointType=std::string_view{}, std::string_view units=std::string_view{})
Translator & | registerTranslator (std::int32_t translatorType, std::string_view translatorName, std::string_view endpointType=std::string_view{}, std::string_view units=std::string_view{})
Translator & | registerGlobalTranslator (std::string_view translatorName, std::string_view endpointType=std::string_view{}, std::string_view units=std::string_view{})
Translator & | registerTranslator (std::string_view translatorName, std::string_view endpointType=std::string_view{}, std::string_view units=std::string_view{})
Translator & | registerTranslator ()
CloningFilter & | registerCloningFilter ()
const Filter & | getFilter (std::string_view filterName) const
const Filter & | getFilter (int index) const
Filter & | getFilter (std::string_view filterName)
Filter & | getFilter (int index)
int | getFilterCount () const
const Translator & | getTranslator (std::string_view translatorName) const
const Translator & | getTranslator (int index) const
Translator & | getTranslator (std::string_view translatorName)
Translator & | getTranslator (int index)
int | getTranslatorCount () const
const std::string & | getConfigFile () const
void | registerConnectorInterfaces (const std::string &configString)
void | registerFilterInterfaces (const std::string &configString)
auto | getID () const noexcept
Modes | getCurrentMode () const noexcept
Time | getCurrentTime () const noexcept
const std::string & | getName () const
const std::shared_ptr< Core > & | getCorePointer ()
void | logMessage (int level, std::string_view message) const
void | logErrorMessage (std::string_view message) const
void | logWarningMessage (std::string_view message) const
void | logInfoMessage (std::string_view message) const
void | logDebugMessage (std::string_view message) const
void | completeOperation ()
Public Member Functions inherited from helics::MessageFederate
| MessageFederate (std::string_view fedName, const FederateInfo &fedInfo)
| MessageFederate (std::string_view fedName, const std::shared_ptr< Core > &core, const FederateInfo &fedInfo=FederateInfo{})
| MessageFederate (std::string_view fedName, CoreApp &core, const FederateInfo &fedInfo=FederateInfo{})
| MessageFederate (std::string_view name, const std::string &configString)
| MessageFederate (const std::string &configString)
| MessageFederate (const char *configString)
| MessageFederate (MessageFederate &&mFed) noexcept
| MessageFederate (const MessageFederate &mFed)=delete
| MessageFederate ()
| MessageFederate (bool res)
virtual | ~MessageFederate ()
MessageFederate & | operator= (MessageFederate &&mFed) noexcept
MessageFederate & | operator= (const MessageFederate &mFed)=delete
Endpoint & | registerEndpoint (std::string_view eptName=std::string_view(), std::string_view type=std::string_view())
Endpoint & | registerTargetedEndpoint (std::string_view eptName=std::string_view(), std::string_view type=std::string_view())
Endpoint & | registerGlobalEndpoint (std::string_view eptName, std::string_view type=std::string_view())
Endpoint & | registerGlobalTargetedEndpoint (std::string_view eptName, std::string_view type=std::string_view())
Endpoint & | registerIndexedEndpoint (std::string_view eptName, int index1, std::string_view type=std::string_view())
Endpoint & | registerDataSink (std::string_view sinkName=std::string_view())
void | registerMessageInterfaces (const std::string &configString)
void | subscribe (const Endpoint &ept, std::string_view key)
bool | hasMessage () const
bool | hasMessage (const Endpoint &ept) const
uint64_t | pendingMessageCount (const Endpoint &ept) const
uint64_t | pendingMessageCount () const
std::unique_ptr< Message > | getMessage (const Endpoint &ept)
std::unique_ptr< Message > | getMessage ()
Endpoint & | getEndpoint (std::string_view name) const
Endpoint & | getEndpoint (int index) const
Endpoint & | getDataSink (std::string_view name) const
void | setMessageNotificationCallback (const std::function< void(Endpoint &, Time)> &callback)
void | setMessageNotificationCallback (const Endpoint &ept, const std::function< void(Endpoint &, Time)> &callback)
int | getEndpointCount () const

## Protected Member Functions
virtual void | updateTime (Time newTime, Time oldTime) override
virtual void | startupToInitializeStateTransition () override
virtual void | initializeToExecuteStateTransition (iteration_time result) override
virtual std::string | localQuery (std::string_view queryStr) const override
Protected Member Functions inherited from helics::Federate
void | enteringInitializingMode (IterationResult iterating)
void | enteringExecutingMode (iteration_time res)
void | finalizeOperations ()
void | preTimeRequestOperations (Time nextStep, bool iterating)
void | postTimeRequestOperations (Time newTime, bool iterating)
virtual void | disconnectTransition ()
std::string | localNameGenerator (std::string_view addition) const
void | handleError (int errorCode, std::string_view errorString, bool noThrow)
void | setAsyncCheck (std::function< bool()> asyncCheck)

## Additional Inherited Members
Public Types inherited from helics::Federate
enum class | Modes : char { STARTUP = 0 , INITIALIZING = 1 , EXECUTING = 2 , FINALIZE = 3 , ERROR_STATE = 4 , PENDING_INIT = 5 , PENDING_EXEC = 6 , PENDING_TIME = 7 , PENDING_ITERATIVE_TIME = 8 , PENDING_FINALIZE = 9 , FINISHED = 10 , PENDING_ITERATIVE_INIT = 12 }
Static Public Member Functions inherited from helics::Federate
static void | setFilterOperator (Filter &filt, std::shared_ptr< FilterOperator > filtOp)
| register a operator for the specified filter More...
static void | setTranslatorOperator (Translator &trans, std::shared_ptr< TranslatorOperator > transOp)
| register an operator for the specified translator More...
Protected Attributes inherited from helics::Federate
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}
bool | observerMode {false}
bool | retriggerTimeRequest {false}
bool | singleThreadFederate {false}
bool | hasPotentialInterfaces {false}
std::shared_ptr< Core > | coreObject
| reference to the core simulation API
Time | mCurrentTime = Time::minVal()
| the current simulation time
Time | mStopTime = Time::maxVal()
| the stopping time for the federate
std::string | configFile
| any config file used

## Detailed Description

class defining a federate that can use both the value and message interfaces

## Constructor & Destructor Documentation

## ◆ CombinationFederate() [1/8]

helics::CombinationFederate::CombinationFederate | ( |  | ) |
| default

default constructor

## ◆ CombinationFederate() [2/8]

helics::CombinationFederate::CombinationFederate | ( | std::string_view | fedName,
|  | const FederateInfo & | fedInfo
| ) |  |
| explicit

constructor taking a federate information structure and using the default core

Parameters

  fedName | the name of the federate, may be left empty to use a default or one found in fedInfo
  fedInfo | a federate information structure

## ◆ CombinationFederate() [3/8]

helics::CombinationFederate::CombinationFederate | ( | std::string_view | fedName,
|  | const std::shared_ptr< Core > & | core,
|  | const FederateInfo & | fedInfo = `FederateInfo{}`
| ) |  |

constructor taking a federate information structure and using the given core

Parameters

  fedName | the name of the federate, may be left empty to use a default or one found in fedInfo
  core | a pointer to core object which the federate can join
  fedInfo | a federate information structure

## ◆ CombinationFederate() [4/8]

helics::CombinationFederate::CombinationFederate | ( | std::string_view | fedName,
|  | CoreApp & | core,
|  | const FederateInfo & | fedInfo = `FederateInfo{}`
| ) |  |

constructor taking a federate information structure and using the given CoreApp

Parameters

  fedName | the name of the federate, may be left empty to use a default or one found in fedInfo
  core | a CoreApp object representing the core to connect to
  fedInfo | a federate information structure

## ◆ CombinationFederate() [5/8]

helics::CombinationFederate::CombinationFederate | ( | std::string_view | fedName,
|  | const std::string & | configString
| ) |  |

constructor taking a federate name and a file with the required information

Parameters

  fedName | the name of the federate, can be empty to use the name from the configString
  configString | can be either a JSON file a TOML file (with extension TOML) or a string containing JSON code or a string with command line arguments

## ◆ CombinationFederate() [6/8]

helics::CombinationFederate::CombinationFederate | ( | const std::string & | configString | ) |
| explicit

constructor taking a file with the required information

Parameters

  configString | can be either a JSON file a TOML file (with extension TOML) or a string containing JSON code or a string with command line arguments

## ◆ CombinationFederate() [7/8]

helics::CombinationFederate::CombinationFederate | ( | CombinationFederate && | fed | ) |
| default noexcept

move construction

## ◆ ~CombinationFederate()

helics::CombinationFederate::~CombinationFederate | ( |  | ) |
| virtual default

destructor

## ◆ CombinationFederate() [8/8]

helics::CombinationFederate::CombinationFederate | ( | const CombinationFederate & | fed | ) |
| delete

delete the copy constructor

## Member Function Documentation

## ◆ disconnect()

void helics::CombinationFederate::disconnect | ( |  | ) |
| override virtual

disconnect a simulation from the core (will also call finalize before disconnecting if necessary)

Reimplemented from helics::MessageFederate.

References helics::MessageFederate::disconnect(), and helics::ValueFederate::disconnect().

## ◆ initializeToExecuteStateTransition()

void helics::CombinationFederate::initializeToExecuteStateTransition | ( | iteration_time | iterate | ) |
| override protected virtual

function to deal with any operations that need to occur on the transition from startup to initialize

Reimplemented from helics::MessageFederate.

References helics::MessageFederate::initializeToExecuteStateTransition(), and helics::ValueFederate::initializeToExecuteStateTransition().

## ◆ localQuery()

std::string helics::CombinationFederate::localQuery | ( | std::string_view | queryStr | ) | const
| override protected virtual

function to generate results for a local Query

should return an empty string if the query is not recognized

Reimplemented from helics::MessageFederate.

References helics::MessageFederate::localQuery(), and helics::ValueFederate::localQuery().

## ◆ operator=() [1/2]

CombinationFederate & helics::CombinationFederate::operator= | ( | CombinationFederate && | fed | ) |
| default noexcept

move assignment

## ◆ operator=() [2/2]

CombinationFederate& helics::CombinationFederate::operator= | ( | const CombinationFederate & | fed | ) |
| delete

copy assignment deleted

## ◆ registerInterfaces()

void helics::CombinationFederate::registerInterfaces | ( | const std::string & | configString | ) |
| override virtual

register a set of interfaces defined in a file

call is only valid in startup mode

Parameters

  configString | the location of the file or config String to load to generate the interfaces

Reimplemented from helics::MessageFederate.

References helics::Federate::registerFilterInterfaces(), helics::MessageFederate::registerMessageInterfaces(), and helics::ValueFederate::registerValueInterfaces().

## ◆ setFlagOption()

void helics::CombinationFederate::setFlagOption | ( | int | flag,
|  | bool | flagValue = `true`
| ) |  |
| override virtual

set a flag for the federate

Parameters

  flag | an index into the flag /ref flag-definitions.h
  flagValue | the value of the flag defaults to true

Reimplemented from helics::ValueFederate.

References helics::ValueFederate::setFlagOption().

## ◆ startupToInitializeStateTransition()

void helics::CombinationFederate::startupToInitializeStateTransition | ( |  | ) |
| override protected virtual

function to deal with any operations that need to occur on the transition from startup to initialize

Reimplemented from helics::MessageFederate.

References helics::MessageFederate::startupToInitializeStateTransition(), and helics::ValueFederate::startupToInitializeStateTransition().

## ◆ updateTime()

void helics::CombinationFederate::updateTime | ( | Time | newTime,
|  | Time | oldTime
| ) |  |
| override protected virtual

function to deal with any operations that need to occur on a time update

Reimplemented from helics::MessageFederate.

References helics::MessageFederate::updateTime(), and helics::ValueFederate::updateTime().

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

- application_api/CombinationFederate.hpp
- CombinationFederate.cpp