| helics 3.6.1

Public Member Functions | Friends | List of all members
helicscpp::ValueFederate Class Reference

`#include <ValueFederate.hpp>`

Inheritance diagram for helicscpp::ValueFederate:

## Public Member Functions
| ValueFederate (const std::string &fedName, FederateInfo &fedInfo)
| ValueFederate (const std::string &configString)
| ValueFederate (const ValueFederate &vfed)
ValueFederate & | operator= (const ValueFederate &fedObj)
| ValueFederate () HELICS_NOTHROW
Publication | registerPublication (const std::string &name, const std::string &type, const std::string &units="")
Publication | registerPublication (const std::string &name, HelicsDataTypes type, const std::string &units="")
Publication | registerGlobalPublication (const std::string &name, const std::string &type, const std::string &units="")
Publication | registerGlobalPublication (const std::string &key, HelicsDataTypes type, const std::string &units="")
Publication | registerIndexedPublication (const std::string &key, int index1, HelicsDataTypes type, const std::string &units="")
Publication | registerIndexedPublication (const std::string &key, int index1, int index2, HelicsDataTypes type, const std::string &units=std::string())
Publication | registerPublicationIndexed (const std::string &key, int index1, HelicsDataTypes type, const std::string &units="")
Publication | registerPublicationIndexed (const std::string &key, int index1, int index2, HelicsDataTypes type, const std::string &units=std::string())
void | registerFromPublicationJSON (const std::string &json)
Publication | getPublication (const std::string &name)
Publication | getPublication (int index)
Input | registerSubscription (const std::string &name, const std::string &units=std::string())
Input | registerIndexedSubscription (const std::string &name, int index1, const std::string &units="")
Input | registerIndexedSubscription (const std::string &name, int index1, int index2, const std::string &units="")
Input | registerSubscriptionIndexed (const std::string &name, int index1, const std::string &units="")
Input | registerSubscriptionIndexed (const std::string &name, int index1, int index2, const std::string &units="")
Input | registerInput (const std::string &name, const std::string &type, const std::string &units="")
Input | registerInput (const std::string &name, HelicsDataTypes type, const std::string &units="")
Input | registerGlobalInput (const std::string &name, const std::string &type, const std::string &units="")
Input | registerGlobalInput (const std::string &key, HelicsDataTypes type, const std::string &units="")
Input | registerIndexedInput (const std::string &key, int index1, HelicsDataTypes type, const std::string &units="")
Input | registerIndexedInput (const std::string &key, int index1, int index2, HelicsDataTypes type, const std::string &units=std::string())
Input | getInput (const std::string &name)
Input | getInputByTarget (const std::string &target)
Input | getInput (int index)
int | getInputCount () const
int | getPublicationCount () const
std::vector< HelicsInput > | queryUpdates ()
void | clearUpdates ()
void | publishJSON (const std::string &json)
Public Member Functions inherited from helicscpp::Federate
| Federate () HELICS_NOTHROW
| Default constructor.
| Federate (const Federate &fedObj)
| Copy constructor.
Federate & | operator= (const Federate &fedObj)
| Copy assignment operator.
virtual | ~Federate ()
| operator HelicsFederate () const
HelicsFederate | baseObject () const
void | setFlagOption (int flag, bool flagValue=true)
void | setProperty (int tProperty, HelicsTime timeValue)
void | setProperty (int intProperty, int value)
bool | getFlagOption (int flag) const
HelicsTime | getTimeProperty (int tProperty) const
int | getIntegerProperty (int intProperty) const
void | setSeparator (char sep)
void | registerInterfaces (const std::string &configString)
HelicsFederateState | getCurrentMode () const
bool | isAsyncOperationCompleted () const
void | enterInitializingMode ()
void | enterInitializingModeAsync ()
void | enterInitializingModeComplete ()
void | enterInitializingModeIterative ()
void | enterInitializingModeIterativeAsync ()
void | enterInitializingModeIterativeComplete ()
HelicsIterationResult | enterExecutingMode (HelicsIterationRequest iterate=HELICS_ITERATION_REQUEST_NO_ITERATION)
void | enterExecutingModeAsync (HelicsIterationRequest iterate=HELICS_ITERATION_REQUEST_NO_ITERATION)
HelicsIterationResult | enterExecutingModeComplete ()
void | finalize ()
void | finalizeAsync ()
void | finalizeComplete ()
HelicsTime | getCurrentTime ()
HelicsTime | requestTime (HelicsTime time)
HelicsTime | requestNextStep ()
HelicsTime | requestTimeAdvance (HelicsTime timeDelta)
HelicsIterationTime | requestTimeIterative (HelicsTime time, HelicsIterationRequest iterate)
void | requestTimeAsync (HelicsTime time)
void | requestTimeIterativeAsync (HelicsTime time, HelicsIterationRequest iterate)
HelicsTime | requestTimeComplete ()
HelicsIterationTime | requestTimeIterativeComplete ()
void | processCommunication (HelicsTime period)
const char * | getName () const
void | protect ()
void | unProtect ()
std::string | query (const std::string &target, const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST) const
std::string | query (const std::string &queryStr, HelicsSequencingModes mode=HELICS_SEQUENCING_MODE_FAST) const
void | sendCommand (const std::string &target, const std::string &cmd)
const char * | getCommand ()
const char * | waitCommand ()
const char * | getCommandSource ()
void | setQueryCallback (void(*queryAnswer)(const char *query, int querySize, HelicsQueryBuffer, void *userdata), void *userdata)
void | setTimeRequestEntryCallback (void(*timeRequestEntry)(HelicsTime currentTime, HelicsTime requestTime, HelicsBool iterating, void *userdata), void *userdata)
void | setTimeUpdateCallback (void(*timeUpdate)(HelicsTime time, HelicsBool iterating, void *userdata), void *userdata)
void | setStateChangeCallback (void(*stateChange)(HelicsFederateState newState, HelicsFederateState oldState, void *userdata), void *userdata)
void | setTimeRequestReturnCallback (void(*timeRequestReturn)(HelicsTime newTime, HelicsBool iterating, void *userdata), void *userdata)
Filter | registerFilter (HelicsFilterTypes type, const std::string &filterName=std::string())
CloningFilter | registerCloningFilter (const std::string &deliveryEndpoint)
Filter | registerGlobalFilter (HelicsFilterTypes type, const std::string &filterName=std::string())
CloningFilter | registerGlobalCloningFilter (const std::string &deliveryEndpoint)
int | getFilterCount () const
Filter | getFilter (const std::string &filterName)
Filter | getFilter (int index)
void | setGlobal (const std::string &valueName, const std::string &value)
void | addAlias (const std::string &interfaceName, const std::string &alias)
void | setTag (const std::string &tag, const std::string &value)
const char * | getTag (const std::string &tag) const
void | addDependency (const std::string &fedName)
void | localError (int errorCode, const std::string &errorString)
void | globalError (int errorCode, const std::string &errorString)
void | logErrorMessage (const std::string &message)
void | logWarningMessage (const std::string &message)
void | logInfoMessage (const std::string &message)
void | logDebugMessage (const std::string &message)
void | logMessage (int level, const std::string &message)
HelicsCore | getCore ()
HelicsFederate | getObject () const

## Friends
class | helicscpp::FederateInfo

## Additional Inherited Members
Protected Attributes inherited from helicscpp::Federate
HelicsFederate | fed
| underlying HelicsFederate object
bool | exec_async_iterate
| indicator that the federate is in an async operation

## Detailed Description

Class defining a ValueFederate object which interacts with publication and Inputs

## Constructor & Destructor Documentation

## ◆ ValueFederate() [1/4]

helicscpp::ValueFederate::ValueFederate | ( | const std::string & | fedName,
|  | FederateInfo & | fedInfo
| ) |  |
| inline explicit

constructor taking a federate information structure and using the default core

Parameters

  fedName | the name of the federate, can be empty to use the name from fedInfo or an auto generated one
  fedInfo | a federate information structure

References helicscpp::Federate::fed, helicscpp::FederateInfo::getInfo(), HELICS_ERROR_REGISTRATION_FAILURE, and helicsCreateValueFederate().

## ◆ ValueFederate() [2/4]

helicscpp::ValueFederate::ValueFederate | ( | const std::string & | configString | ) |
| inline explicit

constructor taking a string with the required information

Parameters

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

References helicscpp::Federate::fed, HELICS_ERROR_REGISTRATION_FAILURE, and helicsCreateValueFederateFromConfig().

## ◆ ValueFederate() [3/4]

helicscpp::ValueFederate::ValueFederate | ( | const ValueFederate & | vfed | ) |
| inline

copy constructor

## ◆ ValueFederate() [4/4]

helicscpp::ValueFederate::ValueFederate | ( |  | ) |
| inline

Default constructor, not meant to be used

## Member Function Documentation

## ◆ clearUpdates()

void helicscpp::ValueFederate::clearUpdates | ( |  | ) |
| inline

clear all the update flags from all federate inputs

References helicscpp::Federate::fed, and helicsFederateClearUpdates().

## ◆ getInput() [1/2]

Input helicscpp::ValueFederate::getInput | ( | const std::string & | name | ) |
| inline

get an input by name

References helicscpp::Federate::fed, and helicsFederateGetInput().

## ◆ getInput() [2/2]

Input helicscpp::ValueFederate::getInput | ( | int | index | ) |
| inline

get an input by index

References helicscpp::Federate::fed, and helicsFederateGetInputByIndex().

## ◆ getInputByTarget()

Input helicscpp::ValueFederate::getInputByTarget | ( | const std::string & | target | ) |
| inline

get an input by target

References helicscpp::Federate::fed, and helicsFederateGetInputByTarget().

## ◆ getInputCount()

int helicscpp::ValueFederate::getInputCount | ( |  | ) | const
| inline

get the number of inputs in this federate

References helicscpp::Federate::fed, and helicsFederateGetInputCount().

## ◆ getPublication() [1/2]

Publication helicscpp::ValueFederate::getPublication | ( | const std::string & | name | ) |
| inline

get publication by name

References helicscpp::Federate::fed, and helicsFederateGetPublication().

## ◆ getPublication() [2/2]

Publication helicscpp::ValueFederate::getPublication | ( | int | index | ) |
| inline

get a publication by index

Parameters

  index | a 0 based index of the publication to retrieve

Returns
  a Publication object

References helicscpp::Federate::fed, and helicsFederateGetPublicationByIndex().

## ◆ getPublicationCount()

int helicscpp::ValueFederate::getPublicationCount | ( |  | ) | const
| inline

get the number of publications in this federate

References helicscpp::Federate::fed, and helicsFederateGetPublicationCount().

## ◆ operator=()

ValueFederate& helicscpp::ValueFederate::operator= | ( | const ValueFederate & | fedObj | ) |
| inline

copy assignment operator

References helicscpp::Federate::fed, HELICS_ERROR_REGISTRATION_FAILURE, and helicscpp::Federate::operator=().

## ◆ publishJSON()

void helicscpp::ValueFederate::publishJSON | ( | const std::string & | json | ) |
| inline

publish data contained in a JSON file

References helicscpp::Federate::fed, and helicsFederatePublishJSON().

## ◆ queryUpdates()

std::vector<HelicsInput> helicscpp::ValueFederate::queryUpdates | ( |  | ) |
| inline

Get a list of all inputs with updates since the last call

## ◆ registerFromPublicationJSON()

void helicscpp::ValueFederate::registerFromPublicationJSON | ( | const std::string & | json | ) |
| inline

register publications from a JSON output file or string

generates interface based on the data contained in a JSON file or string

References helicscpp::Federate::fed, and helicsFederateRegisterFromPublicationJSON().

## ◆ registerGlobalInput() [1/2]

Input helicscpp::ValueFederate::registerGlobalInput | ( | const std::string & | key,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register an input

call is only valid in startup mode

Parameters

  key | the name of the input
  type | an enumeration value describing the type of the input
  units | a string defining the units of the input [optional]

Returns
  an input object for use as an identifier

References helicscpp::Federate::fed, and helicsFederateRegisterGlobalInput().

## ◆ registerGlobalInput() [2/2]

Input helicscpp::ValueFederate::registerGlobalInput | ( | const std::string & | name,
|  | const std::string & | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register an input

call is only valid in startup mode

Parameters

  name | the name of the input
  type | a string defining the type of the input
  units | a string defining the units of the input [optional]

Returns
  an input object for use as an identifier

References helicscpp::Federate::fed, and helicsFederateRegisterGlobalTypeInput().

Referenced by registerIndexedInput().

## ◆ registerGlobalPublication() [1/2]

Publication helicscpp::ValueFederate::registerGlobalPublication | ( | const std::string & | key,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a publication

call is only valid in startup mode

Parameters

  key | the name of the publication
  type | an enumeration value describing the type of the publication
  units | a string defining the units of the publication [optional]

Returns
  a publication object for use as an identifier

References helicscpp::Federate::fed, and helicsFederateRegisterGlobalPublication().

## ◆ registerGlobalPublication() [2/2]

Publication helicscpp::ValueFederate::registerGlobalPublication | ( | const std::string & | name,
|  | const std::string & | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a publication

call is only valid in startup mode

Parameters

  name | the name of the publication
  type | a string defining the type of the publication
  units | a string defining the units of the publication [optional]

Returns
  a publication object for use as an identifier

References helicscpp::Federate::fed, and helicsFederateRegisterGlobalTypePublication().

Referenced by registerIndexedPublication().

## ◆ registerIndexedInput() [1/2]

Input helicscpp::ValueFederate::registerIndexedInput | ( | const std::string & | key,
|  | int | index1,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register an input as part of an indexed structure

call is only valid in startup mode by default prepends the name with the federate name the name is registered as a global structure with the index appended

Parameters

  key | the name of the input to register
  index1 | an index associated with the input
  type | an enumeration value describing the type of the input
  units | the optional units of the input

Returns
  an identifier for use with this input

References registerGlobalInput().

## ◆ registerIndexedInput() [2/2]

Input helicscpp::ValueFederate::registerIndexedInput | ( | const std::string & | key,
|  | int | index1,
|  | int | index2,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `std::string()`
| ) |  |
| inline

register an input as part of a 2 dimensional indexed structure

call is only valid in startup mode by default prepends the name with the federate name the name is registered as a global structure with the indices appended

Parameters

  key | the base name of the input
  index1 | an index associated with the input
  index2 | a second index
  type | an enumeration value describing the type of the input
  units | the optional units of the input

Returns
  an identifier for use with this input

References registerGlobalInput().

## ◆ registerIndexedPublication() [1/2]

Publication helicscpp::ValueFederate::registerIndexedPublication | ( | const std::string & | key,
|  | int | index1,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a publication as part of an indexed structure

call is only valid in startup mode by default prepends the name with the federate name the name is registered as a global structure with the index appended

Parameters

  key | the name of the publication to register
  index1 | an index associated with the publication
  type | an enumeration value describing the type of the publication
  units | the optional units of the publication

Returns
  an identifier for use with this publication

References registerGlobalPublication().

Referenced by registerPublicationIndexed().

## ◆ registerIndexedPublication() [2/2]

Publication helicscpp::ValueFederate::registerIndexedPublication | ( | const std::string & | key,
|  | int | index1,
|  | int | index2,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `std::string()`
| ) |  |
| inline

register a publication as part of a 2 dimensional indexed structure

call is only valid in startup mode by default prepends the name with the federate name the name is registered as a global structure with the indices appended

Parameters

  key | the base name of the publication
  index1 | an index associated with the publication
  index2 | a second index
  type | an enumeration value describing the type of the publication
  units | the optional units of the publication

Returns
  an identifier for use with this publication

References registerGlobalPublication().

## ◆ registerIndexedSubscription() [1/2]

Input helicscpp::ValueFederate::registerIndexedSubscription | ( | const std::string & | name,
|  | int | index1,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a !D indexed subscription

Parameters

  name | the base name of the publication to subscribe to
  index1 | the first index of the value to subscribe to
  units | a string containing the requested units of the subscription output

Returns
  an input object getting the requested value

References registerSubscription().

Referenced by registerSubscriptionIndexed().

## ◆ registerIndexedSubscription() [2/2]

Input helicscpp::ValueFederate::registerIndexedSubscription | ( | const std::string & | name,
|  | int | index1,
|  | int | index2,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a 2D indexed subscription

Parameters

  name | the base name of the publication to subscribe to
  index1 | the first index of the value to subscribe to
  index2 | the second index of the value to subscribe to
  units | a string containing the requested units of the subscription output

Returns
  an input object getting the requested value

References registerSubscription().

## ◆ registerInput() [1/2]

Input helicscpp::ValueFederate::registerInput | ( | const std::string & | name,
|  | const std::string & | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register an input

call is only valid in startup mode

Parameters

  name | the name of the input
  type | a string defining the type of the input
  units | a string defining the units of the input [optional]

Returns
  an input id object for use as an identifier

References helicscpp::Federate::fed, and helicsFederateRegisterTypeInput().

## ◆ registerInput() [2/2]

Input helicscpp::ValueFederate::registerInput | ( | const std::string & | name,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register an input

call is only valid in startup mode by default prepends the name with the federate name

Parameters

  name | the name of the input
  type | the type of input to register
  units | the optional units of the input

Returns
  an identifier for use with this input

References helicscpp::Federate::fed, and helicsFederateRegisterPublication().

## ◆ registerPublication() [1/2]

Publication helicscpp::ValueFederate::registerPublication | ( | const std::string & | name,
|  | const std::string & | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

Methods to register publications register a publication

call is only valid in startup mode

Parameters

  name | the name of the publication
  type | a string defining the type of the publication
  units | a string defining the units of the publication [optional]

Returns
  a publication id object for use as an identifier

References helicscpp::Federate::fed, and helicsFederateRegisterTypePublication().

## ◆ registerPublication() [2/2]

Publication helicscpp::ValueFederate::registerPublication | ( | const std::string & | name,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a publication

call is only valid in startup mode by default prepends the name with the federate name

Parameters

  name | the name of the publication
  type | the type of publication to register
  units | the optional units of the publication

Returns
  an identifier for use with this publication

References helicscpp::Federate::fed, and helicsFederateRegisterPublication().

## ◆ registerPublicationIndexed() [1/2]

Publication helicscpp::ValueFederate::registerPublicationIndexed | ( | const std::string & | key,
|  | int | index1,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a publication as part of an indexed structure

call is only valid in startup mode by default prepends the name with the federate name the name is registered as a global structure with the index appended

Parameters

  key | the name of the publication to register
  index1 | an index associated with the publication
  type | an enumeration value describing the type of the publication
  units | the optional units of the publication

Returns
  an identifier for use with this publication

References registerIndexedPublication().

## ◆ registerPublicationIndexed() [2/2]

Publication helicscpp::ValueFederate::registerPublicationIndexed | ( | const std::string & | key,
|  | int | index1,
|  | int | index2,
|  | HelicsDataTypes | type,
|  | const std::string & | units = `std::string()`
| ) |  |
| inline

register a publication as part of a 2 dimensional indexed structure

call is only valid in startup mode by default prepends the name with the federate name the name is registered as a global structure with the indices appended

Parameters

  key | the base name of the publication
  index1 | an index associated with the publication
  index2 | a second index
  type | an enumeration value describing the type of the publication
  units | the optional units of the publication

Returns
  an identifier for use with this publication

References registerIndexedPublication().

## ◆ registerSubscription()

Input helicscpp::ValueFederate::registerSubscription | ( | const std::string & | name,
|  | const std::string & | units = `std::string()`
| ) |  |
| inline

Methods to register subscriptions

References helicscpp::Federate::fed, and helicsFederateRegisterSubscription().

Referenced by registerIndexedSubscription().

## ◆ registerSubscriptionIndexed() [1/2]

Input helicscpp::ValueFederate::registerSubscriptionIndexed | ( | const std::string & | name,
|  | int | index1,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a !D indexed subscription

Parameters

  name | the base name of the publication to subscribe to
  index1 | the first index of the value to subscribe to
  units | a string containing the requested units of the subscription output

Returns
  an input object getting the requested value

References registerIndexedSubscription().

## ◆ registerSubscriptionIndexed() [2/2]

Input helicscpp::ValueFederate::registerSubscriptionIndexed | ( | const std::string & | name,
|  | int | index1,
|  | int | index2,
|  | const std::string & | units = `""`
| ) |  |
| inline

register a 2D indexed subscription

Parameters

  name | the base name of the publication to subscribe to
  index1 | the first index of the value to subscribe to
  index2 | the second index of the value to subscribe to
  units | a string containing the requested units of the subscription output

Returns
  an input object getting the requested value

References registerIndexedSubscription().

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

- cpp98/ValueFederate.hpp