| helics 3.6.1

Functions
MessageFilters.h File Reference

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

`#include "helicsCore.h"`

Go to the source code of this file.

## Functions
HelicsFilter | helicsFederateRegisterFilter (HelicsFederate fed, HelicsFilterTypes type, const char *name, HelicsError *err)
HelicsFilter | helicsFederateRegisterGlobalFilter (HelicsFederate fed, HelicsFilterTypes type, const char *name, HelicsError *err)
HelicsFilter | helicsFederateRegisterCloningFilter (HelicsFederate fed, const char *name, HelicsError *err)
HelicsFilter | helicsFederateRegisterGlobalCloningFilter (HelicsFederate fed, const char *name, HelicsError *err)
HelicsFilter | helicsCoreRegisterFilter (HelicsCore core, HelicsFilterTypes type, const char *name, HelicsError *err)
HelicsFilter | helicsCoreRegisterCloningFilter (HelicsCore core, const char *name, HelicsError *err)
int | helicsFederateGetFilterCount (HelicsFederate fed)
HelicsFilter | helicsFederateGetFilter (HelicsFederate fed, const char *name, HelicsError *err)
HelicsFilter | helicsFederateGetFilterByIndex (HelicsFederate fed, int index, HelicsError *err)
HelicsBool | helicsFilterIsValid (HelicsFilter filt)
const char * | helicsFilterGetName (HelicsFilter filt)
void | helicsFilterSet (HelicsFilter filt, const char *prop, double val, HelicsError *err)
void | helicsFilterSetString (HelicsFilter filt, const char *prop, const char *val, HelicsError *err)
double | helicsFilterGetPropertyDouble (HelicsFilter filt, const char *prop)
const char * | helicsFilterGetPropertyString (HelicsFilter filt, const char *prop)
void | helicsFilterAddDestinationTarget (HelicsFilter filt, const char *dst, HelicsError *err)
void | helicsFilterAddSourceTarget (HelicsFilter filt, const char *source, HelicsError *err)
void | helicsFilterAddDeliveryEndpoint (HelicsFilter filt, const char *deliveryEndpoint, HelicsError *err)
void | helicsFilterRemoveTarget (HelicsFilter filt, const char *target, HelicsError *err)
void | helicsFilterRemoveDeliveryEndpoint (HelicsFilter filt, const char *deliveryEndpoint, HelicsError *err)
const char * | helicsFilterGetInfo (HelicsFilter filt)
void | helicsFilterSetInfo (HelicsFilter filt, const char *info, HelicsError *err)
const char * | helicsFilterGetTag (HelicsFilter filt, const char *tagname)
void | helicsFilterSetTag (HelicsFilter filt, const char *tagname, const char *tagvalue, HelicsError *err)
void | helicsFilterSetOption (HelicsFilter filt, int option, int value, HelicsError *err)
int | helicsFilterGetOption (HelicsFilter filt, int option)

## Detailed Description

Functions related to message filters for the C api.

## Function Documentation

## ◆ helicsCoreRegisterCloningFilter()

HelicsFilter helicsCoreRegisterCloningFilter | ( | HelicsCore | core,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

Create a cloning Filter on the specified core.

Cloning filters copy a message and send it to multiple locations, source and destination can be added through other functions.

Parameters

  | core | The core to register through.
  | name | The name of the filter (can be NULL).
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter object.

References helics::make_cloning_filter().

Referenced by helicscpp::Core::registerCloningFilter().

## ◆ helicsCoreRegisterFilter()

HelicsFilter helicsCoreRegisterFilter | ( | HelicsCore | core,
|  | HelicsFilterTypes | type,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

Create a source Filter on the specified core.

Filters 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 equivalent behavior.

Parameters

  | core | The core to register through.
  | type | The type of filter to create /ref HelicsFilterTypes.
  | name | The name of the filter (can be NULL).
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter object.

References HELICS_FILTER_TYPE_CUSTOM, and helics::make_filter().

Referenced by helicscpp::Core::registerFilter().

## ◆ helicsFederateGetFilter()

HelicsFilter helicsFederateGetFilter | ( | HelicsFederate | fed,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

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

Parameters

  | fed | The federate object to use to get the filter.
  | name | The name of the filter.
  [in,out] | err | The error object to complete if there is an error.

Returns
  A HelicsFilter object, the object will not be valid and err will contain an error code if no filter with the specified name exists.

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

Referenced by helicscpp::Federate::getFilter().

## ◆ helicsFederateGetFilterByIndex()

HelicsFilter helicsFederateGetFilterByIndex | ( | HelicsFederate | fed,
|  | int | index,
|  | HelicsError * | err
| ) |  |

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

Parameters

  | fed | The federate object in which to create a publication.
  | index | The index of the publication to get.
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter, which will be NULL if an invalid index is given.

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

Referenced by helicscpp::Federate::getFilter().

## ◆ helicsFederateGetFilterCount()

int helicsFederateGetFilterCount | ( | HelicsFederate | fed | ) |

Get the number of filters registered through a federate.

Parameters

  fed | The federate object to use to get the filter.

Returns
  A count of the number of filters registered through a federate.

Referenced by helicscpp::Federate::getFilterCount().

## ◆ helicsFederateRegisterCloningFilter()

HelicsFilter helicsFederateRegisterCloningFilter | ( | HelicsFederate | fed,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

Create a cloning Filter on the specified federate.

Cloning filters copy a message and send it to multiple locations, source and destination can be added through other functions.

Parameters

  | fed | The federate to register through.
  | name | The name of the filter (can be NULL).
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter object.

References helics::make_cloning_filter().

Referenced by helicscpp::Federate::registerCloningFilter().

## ◆ helicsFederateRegisterFilter()

HelicsFilter helicsFederateRegisterFilter | ( | HelicsFederate | fed,
|  | HelicsFilterTypes | type,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

Create a source Filter on the specified federate.

Filters 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 equivalent behavior

Parameters

  | fed | The federate to register through.
  | type | The type of filter to create /ref HelicsFilterTypes.
  | name | The name of the filter (can be NULL).
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter object.

References HELICS_FILTER_TYPE_CUSTOM, and helics::make_filter().

Referenced by helicscpp::Federate::registerFilter().

## ◆ helicsFederateRegisterGlobalCloningFilter()

HelicsFilter helicsFederateRegisterGlobalCloningFilter | ( | HelicsFederate | fed,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

Create a global cloning Filter on the specified federate.

Cloning filters copy a message and send it to multiple locations, source and destination can be added through other functions.

Parameters

  | fed | The federate to register through.
  | name | The name of the filter (can be NULL).
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter object.

References helics::make_cloning_filter().

Referenced by helicscpp::Federate::registerGlobalCloningFilter().

## ◆ helicsFederateRegisterGlobalFilter()

HelicsFilter helicsFederateRegisterGlobalFilter | ( | HelicsFederate | fed,
|  | HelicsFilterTypes | type,
|  | const char * | name,
|  | HelicsError * | err
| ) |  |

Create a global source filter through a federate.

Filters 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 equivalent behavior.

Parameters

  | fed | The federate to register through.
  | type | The type of filter to create /ref HelicsFilterTypes.
  | name | The name of the filter (can be NULL).
  [in,out] | err | A pointer to an error object for catching errors.

Returns
  A HelicsFilter object.

References helics::make_filter().

Referenced by helicscpp::Federate::registerGlobalFilter().

## ◆ helicsFilterAddDestinationTarget()

void helicsFilterAddDestinationTarget | ( | HelicsFilter | filt,
|  | const char * | dst,
|  | HelicsError * | err
| ) |  |

Add a destination target to a filter.

All messages going to a destination are copied to the delivery address(es).

Parameters

  | filt | The given filter to add a destination target to.
  | dst | The name of the endpoint to add as a destination target.
  [in,out] | err | A pointer to an error object for catching errors.

References helics::Interface::addDestinationTarget().

Referenced by helicscpp::Filter::addDestinationTarget().

## ◆ helicsFilterAddSourceTarget()

void helicsFilterAddSourceTarget | ( | HelicsFilter | filt,
|  | const char * | source,
|  | HelicsError * | err
| ) |  |

Add a source target to a filter.

All messages coming from a source are copied to the delivery address(es).

Parameters

  | filt | The given filter.
  | source | The name of the endpoint to add as a source target.
  [in,out] | err | A pointer to an error object for catching errors.

References helics::Interface::addSourceTarget().

Referenced by helicscpp::Filter::addSourceTarget().

## ◆ helicsFilterGetName()

const char* helicsFilterGetName | ( | HelicsFilter | filt | ) |

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

Parameters

  filt | The given filter.

Returns
  A string with the name of the filter.

get the name of the filter

References helics::Interface::getName().

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

## ◆ helicsFilterGetPropertyDouble()

double helicsFilterGetPropertyDouble | ( | HelicsFilter | filt,
|  | const char * | prop
| ) |  |

Get a double property from a filter.

Parameters

  filt | The filter to retrieve a value from.
  prop | A string containing the property to get.

References helics::Filter::getProperty(), and HELICS_TIME_INVALID.

Referenced by helicscpp::Filter::getProperty().

## ◆ helicsFilterGetPropertyString()

const char* helicsFilterGetPropertyString | ( | HelicsFilter | filt,
|  | const char * | prop
| ) |  |

Get a string property on a filter. The string output memory is valid until a subsequent call to getPropertyString on the particular filter.

Parameters

  filt | The filter to retrieve a value from.
  prop | A string containing the property to get.

Referenced by helicscpp::Filter::getString().

## ◆ helicsFilterIsValid()

HelicsBool helicsFilterIsValid | ( | HelicsFilter | filt | ) |

Check if a filter is valid.

Parameters

  filt | The filter object to check.

Returns
  HELICS_TRUE if the Filter object represents a valid filter.

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

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

## ◆ helicsFilterSet()

void helicsFilterSet | ( | HelicsFilter | filt,
|  | const char * | prop,
|  | double | val,
|  | HelicsError * | err
| ) |  |

Set a property on a filter.

Parameters

  | filt | The filter to modify.
  | prop | A string containing the property to set.
  | val | A numerical value for the property.
  [in,out] | err | A pointer to an error object for catching errors.

References helics::Filter::set().

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

## ◆ helicsFilterSetString()

void helicsFilterSetString | ( | HelicsFilter | filt,
|  | const char * | prop,
|  | const char * | val,
|  | HelicsError * | err
| ) |  |

Set a string property on a filter.

Parameters

  | filt | The filter to modify.
  | prop | A string containing the property to set.
  | val | A string containing the new value.
  [in,out] | err | A pointer to an error object for catching errors.

References helics::Filter::setString().

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