helics  3.5.2
Functions
Translators.h File Reference

Functions related to message translators for the C api. More...

#include "helicsCore.h"

Go to the source code of this file.

Functions

HelicsTranslator helicsFederateRegisterTranslator (HelicsFederate fed, HelicsTranslatorTypes type, const char *name, HelicsError *err)
 
HelicsTranslator helicsFederateRegisterGlobalTranslator (HelicsFederate fed, HelicsTranslatorTypes type, const char *name, HelicsError *err)
 
HelicsTranslator helicsCoreRegisterTranslator (HelicsCore core, HelicsTranslatorTypes type, const char *name, HelicsError *err)
 
int helicsFederateGetTranslatorCount (HelicsFederate fed)
 
HelicsTranslator helicsFederateGetTranslator (HelicsFederate fed, const char *name, HelicsError *err)
 
HelicsTranslator helicsFederateGetTranslatorByIndex (HelicsFederate fed, int index, HelicsError *err)
 
HelicsBool helicsTranslatorIsValid (HelicsTranslator trans)
 
const char * helicsTranslatorGetName (HelicsTranslator trans)
 
void helicsTranslatorSet (HelicsTranslator trans, const char *prop, double val, HelicsError *err)
 
void helicsTranslatorSetString (HelicsTranslator trans, const char *prop, const char *val, HelicsError *err)
 
void helicsTranslatorAddInputTarget (HelicsTranslator trans, const char *input, HelicsError *err)
 
void helicsTranslatorAddPublicationTarget (HelicsTranslator trans, const char *pub, HelicsError *err)
 
void helicsTranslatorAddSourceEndpoint (HelicsTranslator trans, const char *ept, HelicsError *err)
 
void helicsTranslatorAddDestinationEndpoint (HelicsTranslator trans, const char *ept, HelicsError *err)
 
void helicsTranslatorRemoveTarget (HelicsTranslator trans, const char *target, HelicsError *err)
 
const char * helicsTranslatorGetInfo (HelicsTranslator trans)
 
void helicsTranslatorSetInfo (HelicsTranslator trans, const char *info, HelicsError *err)
 
const char * helicsTranslatorGetTag (HelicsTranslator trans, const char *tagname)
 
void helicsTranslatorSetTag (HelicsTranslator trans, const char *tagname, const char *tagvalue, HelicsError *err)
 
void helicsTranslatorSetOption (HelicsTranslator trans, int option, int value, HelicsError *err)
 
int helicsTranslatorGetOption (HelicsTranslator trans, int option)
 

Detailed Description

Functions related to message translators for the C api.

Function Documentation

◆ helicsCoreRegisterTranslator()

HelicsTranslator helicsCoreRegisterTranslator ( HelicsCore  core,
HelicsTranslatorTypes  type,
const char *  name,
HelicsError err 
)

Create a Translator on the specified core.

Translators can be created through a federate or a core. Linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise have equivalent behavior.

Parameters
coreThe core to register through.
typeThe type of translator to create /ref HelicsTranslatorTypes.
nameThe name of the translator (can be NULL).
[in,out]errA pointer to an error object for catching errors.
Returns
A HelicsTranslator object.

References HELICS_TRANSLATOR_TYPE_CUSTOM.

◆ helicsFederateGetTranslator()

HelicsTranslator helicsFederateGetTranslator ( HelicsFederate  fed,
const char *  name,
HelicsError err 
)

Get a translator by its name, typically already created via registerInterfaces file or something of that nature.

Parameters
fedThe federate object to use to get the translator.
nameThe name of the translator.
[in,out]errThe error object to complete if there is an error.
Returns
A HelicsTranslator object. If no translator with the specified name exists, the object will not be valid and err will contain an error code.

References HelicsError::error_code, HELICS_ERROR_INVALID_ARGUMENT, and HelicsError::message.

◆ helicsFederateGetTranslatorByIndex()

HelicsTranslator helicsFederateGetTranslatorByIndex ( HelicsFederate  fed,
int  index,
HelicsError err 
)

Get a translator by its index, typically already created via registerInterfaces file or something of that nature.

Parameters
fedThe federate object in which to create a publication.
indexThe index of the translator to get.
[in,out]errA pointer to an error object for catching errors.
Returns
A HelicsTranslator, which will be NULL if an invalid index is given.

References HelicsError::error_code, HELICS_ERROR_INVALID_ARGUMENT, and HelicsError::message.

◆ helicsFederateGetTranslatorCount()

int helicsFederateGetTranslatorCount ( HelicsFederate  fed)

Get the number of translators registered through a federate.

Parameters
fedThe federate object to use to get the translator.
Returns
A count of the number of translators registered through a federate.

◆ helicsFederateRegisterGlobalTranslator()

HelicsTranslator helicsFederateRegisterGlobalTranslator ( HelicsFederate  fed,
HelicsTranslatorTypes  type,
const char *  name,
HelicsError err 
)

Create a global translator through a federate.

Translators can be created through a federate or a core. Linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise have equivalent behavior.

Parameters
fedThe federate to register through.
typeThe type of translator to create /ref HelicsTranslatorTypes.
nameThe name of the translator (can be NULL).
[in,out]errA pointer to an error object for catching errors.
Returns
A HelicsTranslator object.

References HELICS_TRANSLATOR_TYPE_CUSTOM.

◆ helicsFederateRegisterTranslator()

HelicsTranslator helicsFederateRegisterTranslator ( HelicsFederate  fed,
HelicsTranslatorTypes  type,
const char *  name,
HelicsError err 
)

Create a Translator on the specified federate.

Translators can be created through a federate or a core. Linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise have equivalent behavior.

Parameters
fedThe federate to register through.
typeThe type of translator to create /ref HelicsTranslatorTypes.
nameThe name of the translator (can be NULL).
[in,out]errA pointer to an error object for catching errors.
Returns
A HelicsTranslator object.

References HELICS_TRANSLATOR_TYPE_CUSTOM.

◆ helicsTranslatorAddDestinationEndpoint()

void helicsTranslatorAddDestinationEndpoint ( HelicsTranslator  trans,
const char *  ept,
HelicsError err 
)

Add a destination target endpoint to a translator.

The translator will "translate" all message sent to it. This method adds an endpoint which will receive data published to the translator.

Parameters
transThe given translator.
eptThe name of the endpoint the translator sends data to.
[in,out]errA pointer to an error object for catching errors.

Referenced by helicscpp::Translator::addDestinationEndpoint().

◆ helicsTranslatorAddInputTarget()

void helicsTranslatorAddInputTarget ( HelicsTranslator  trans,
const char *  input,
HelicsError err 
)

Add an input to send a translator output.

All messages sent to a translator endpoint get translated and published to the translators target inputs. This method adds an input to a translators which will receive translated messages.

Parameters
transThe given translator to add a destination target to.
inputThe name of the input which will be receiving translated messages
[in,out]errA pointer to an error object for catching errors.

Referenced by helicscpp::Translator::addDestinationInput().

◆ helicsTranslatorAddPublicationTarget()

void helicsTranslatorAddPublicationTarget ( HelicsTranslator  trans,
const char *  pub,
HelicsError err 
)

Add a source publication target to a translator.

When a publication publishes data the translator will receive it and convert it to a message sent to a translators destination endpoints. This method adds a publication which publishes data the translator receives and sends to its destination endpoints.

Parameters
transThe given translator.
pubThe name of the publication to subscribe.
[in,out]errA pointer to an error object for catching errors.

Referenced by helicscpp::Translator::addSourcePublication().

◆ helicsTranslatorAddSourceEndpoint()

void helicsTranslatorAddSourceEndpoint ( HelicsTranslator  trans,
const char *  ept,
HelicsError err 
)

Add a source endpoint target to a translator.

The translator will "translate" all message sent to it. This method adds an endpoint which can send the translator data.

Parameters
transThe given translator.
eptThe name of the endpoint which will send the endpoint data
[in,out]errA pointer to an error object for catching errors.

Referenced by helicscpp::Translator::addSourceEndpoint().

◆ helicsTranslatorGetName()

const char* helicsTranslatorGetName ( HelicsTranslator  trans)

Get the name of the translator and store in the given string.

Parameters
transThe given translator.
Returns
A string with the name of the translator.

get the name of the translator

References helics::Interface::getName().

Referenced by helicscpp::Translator::getName().

◆ helicsTranslatorIsValid()

HelicsBool helicsTranslatorIsValid ( HelicsTranslator  trans)

Check if a translator is valid.

Parameters
transThe translator object to check.
Returns
HELICS_TRUE if the Translator object represents a valid translator.

References HELICS_FALSE, HELICS_TRUE, and helics::Interface::isValid().

Referenced by helicscpp::Translator::isValid().

◆ helicsTranslatorSet()

void helicsTranslatorSet ( HelicsTranslator  trans,
const char *  prop,
double  val,
HelicsError err 
)

Set a property on a translator.

Parameters
transThe translator to modify.
propA string containing the property to set.
valA numerical value for the property.
[in,out]errA pointer to an error object for catching errors.

References helics::Translator::set().

Referenced by helicscpp::Translator::set().

◆ helicsTranslatorSetString()

void helicsTranslatorSetString ( HelicsTranslator  trans,
const char *  prop,
const char *  val,
HelicsError err 
)

Set a string property on a translator.

Parameters
transThe translator to modify.
propA string containing the property to set.
valA string containing the new value.
[in,out]errA pointer to an error object for catching errors.

References helics::Translator::setString().

Referenced by helicscpp::Translator::setString().