| helics 3.6.1

Public Member Functions | Protected Attributes | Friends | List of all members
helics::Publication Class Reference

`#include <Publications.hpp>`

Inheritance diagram for helics::Publication:

## Public Member Functions
| Publication (ValueFederate *valueFed, InterfaceHandle id, std::string_view key, std::string_view type, std::string_view units)
| Publication (ValueFederate *valueFed, std::string_view key, std::string_view type, std::string_view units=std::string_view{})
template<class FedPtr >
| Publication (FedPtr valueFed, std::string_view key, std::string_view type=std::string_view(), std::string_view units=std::string_view())
| Publication (InterfaceVisibility locality, ValueFederate *valueFed, std::string_view key, std::string_view type, std::string_view units=std::string_view())
template<class FedPtr >
| Publication (InterfaceVisibility locality, FedPtr &valueFed, std::string_view key, std::string_view type, std::string_view units=std::string_view())
| Publication (ValueFederate *valueFed, std::string_view key, DataType type, std::string_view units=std::string_view())
template<class FedPtr >
| Publication (FedPtr &valueFed, std::string_view key, DataType type, std::string_view units=std::string_view())
| Publication (InterfaceVisibility locality, ValueFederate *valueFed, std::string_view key, DataType type, std::string_view units=std::string_view())
template<class FedPtr >
| Publication (InterfaceVisibility locality, FedPtr &valueFed, std::string_view key, DataType type, std::string_view units=std::string_view())
const std::string & | getType () const
const std::string & | getUnits () const
void | addTarget (std::string_view target)
void | addInputTarget (std::string_view target)
void | publish (double val)
void | publish (const std::vector< std::string > &val)
void | publish (const std::vector< double > &val)
void | publish (const double *vals, int size)
void | publish (const std::vector< std::complex< double >> &val)
void | publishComplex (const double *vals, int size)
void | publish (std::complex< double > val)
void | publish (bool val)
void | publish (Time val)
void | publish (char val)
void | publish (const NamedPoint &np)
void | publish (std::string_view field, double val)
void | publish (double val, const std::string &units)
void | publish (double val, const units::precise_unit &units)
template<class X >
std::enable_if_t<(std::is_constructible_v< std::string_view, X >), void > | publish (const X &val)
template<class X >
std::enable_if_t<(std::is_same_v< defV, remove_cv_ref< X >>), void > | publish (const X &val)
template<class X >
std::enable_if_t<(std::is_integral_v< X > &&!std::is_same_v< remove_cv_ref< X >, char >), void > | publish (X val)
void | setMinimumChange (double deltaV) noexcept
void | enableChangeDetection (bool enabled=true) noexcept
virtual const std::string & | getDisplayName () const override
Public Member Functions inherited from helics::Interface
| Interface (Federate *federate, InterfaceHandle hid, std::string_view actName)
| Interface (Core *core, InterfaceHandle hid, std::string_view actName)
InterfaceHandle | getHandle () const
| operator InterfaceHandle () const
bool | isValid () const
bool | operator< (const Interface &inp) const
bool | operator> (const Interface &inp) const
bool | operator== (const Interface &inp) const
bool | operator!= (const Interface &inp) const
const std::string & | getLocalName () const
const std::string & | getName () const
const std::string & | getTarget () const
void | addSourceTarget (std::string_view newTarget, InterfaceType hint=InterfaceType::UNKNOWN)
void | addDestinationTarget (std::string_view newTarget, InterfaceType hint=InterfaceType::UNKNOWN)
void | removeTarget (std::string_view targetToRemove)
void | addAlias (std::string_view alias)
const std::string & | getInfo () const
void | setInfo (std::string_view info)
void | setTag (std::string_view tag, std::string_view value)
const std::string & | getTag (std::string_view tag) const
virtual void | setOption (int32_t option, int32_t value=1)
virtual int32_t | getOption (int32_t option) const
const std::string & | getInjectionType () const
const std::string & | getExtractionType () const
const std::string & | getInjectionUnits () const
const std::string & | getExtractionUnits () const
const std::string & | getSourceTargets () const
const std::string & | getDestinationTargets () const
std::size_t | getSourceTargetCount () const
std::size_t | getDestinationTargetCount () const
void | close ()
void | disconnectFromCore ()

## Protected Attributes
ValueFederate * | fed {nullptr}
| the federate construct to interact with
DataType | pubType {DataType::HELICS_ANY}
| the type of publication
bool | changeDetectionEnabled {false}
| the change detection is enabled
bool | disableAssign {false}
| disable assignment for the object
Protected Attributes inherited from helics::Interface
Core * | mCore {nullptr}
| pointer to the core object
InterfaceHandle | handle {}
| the id as generated by the Federate
std::string | mName
| the name or key of the interface

## Friends
class | ValueFederateManager

## Detailed Description

define a publication object in the C++98 interface

## Constructor & Destructor Documentation

## ◆ Publication() [1/9]

helics::Publication::Publication | ( | ValueFederate * | valueFed,
|  | InterfaceHandle | id,
|  | std::string_view | key,
|  | std::string_view | type,
|  | std::string_view | units
| ) |  |

constructor for a publication used by the valueFederateManager

Parameters

  valueFed | a pointer the link valueFederate
  id | the InterfaceHandle from the core
  key | the identifier for the publication
  type | the type of the publication
  units | an optional string defining the units

References helics::getTypeFromString(), and pubType.

## ◆ Publication() [2/9]

helics::Publication::Publication | ( | ValueFederate * | valueFed,
|  | std::string_view | key,
|  | std::string_view | type,
|  | std::string_view | units = `std::string_view{}`
| ) |  |

constructor for a publication

Parameters

  valueFed | a pointer the link valueFederate
  key | the identifier for the publication
  type | the type of the publication
  units | an optional string defining the units

References helics::ValueFederate::getPublication(), and helics::ValueFederate::registerPublication().

## ◆ Publication() [3/9]

template<class FedPtr >

helics::Publication::Publication | ( | FedPtr | valueFed,
|  | std::string_view | key,
|  | std::string_view | type = `std::string_view()`,
|  | std::string_view | units = `std::string_view()`
| ) |  |
| inline

base constructor for a publication

Parameters

  valueFed | a pointer of some kind to a value federate (any dereferenceable type with * and -> operator that results in a valueFederate object
  key | the identifier for the publication
  type | the type of the publication
  units | an optional string defining the units

## ◆ Publication() [4/9]

helics::Publication::Publication | ( | InterfaceVisibility | locality,
|  | ValueFederate * | valueFed,
|  | std::string_view | key,
|  | std::string_view | type,
|  | std::string_view | units = `std::string_view()`
| ) |  |

base constructor for a publication

Parameters

  locality | either GLOBAL or LOCAL, LOCAL prepends the federate name to create a global identifier
  valueFed | a pointer to a value federate
  key | the identifier for the publication
  type | the type of the publication
  units | an optional string defining the units

## ◆ Publication() [5/9]

template<class FedPtr >

helics::Publication::Publication | ( | InterfaceVisibility | locality,
|  | FedPtr & | valueFed,
|  | std::string_view | key,
|  | std::string_view | type,
|  | std::string_view | units = `std::string_view()`
| ) |  |
| inline

base constructor for a publication

Parameters

  locality | either GLOBAL or LOCAL, LOCAL prepends the federate name to create a global identifier
  valueFed | a pointer of some kind to a value federate (any dereferenceable type with * and -> operator that results in a valueFederate object
  key | the identifier for the publication
  type | the type of the publication
  units | an optional string defining the units

## ◆ Publication() [6/9]

helics::Publication::Publication | ( | ValueFederate * | valueFed,
|  | std::string_view | key,
|  | DataType | type,
|  | std::string_view | units = `std::string_view()`
| ) |  |
| inline

constructor to build a publication object

Parameters

  valueFed | the ValueFederate to use
  key | the identifier for the publication
  type | the defined type of the publication
  units | the units associated with a Federate

## ◆ Publication() [7/9]

template<class FedPtr >

helics::Publication::Publication | ( | FedPtr & | valueFed,
|  | std::string_view | key,
|  | DataType | type,
|  | std::string_view | units = `std::string_view()`
| ) |  |
| inline

constructor to build a publication object

Parameters

  valueFed | the ValueFederate to use
  key | the identifier for the publication
  type | the defined type of the publication
  units | the units associated with a Federate

## ◆ Publication() [8/9]

helics::Publication::Publication | ( | InterfaceVisibility | locality,
|  | ValueFederate * | valueFed,
|  | std::string_view | key,
|  | DataType | type,
|  | std::string_view | units = `std::string_view()`
| ) |  |
| inline

constructor to build a publication object

Parameters

  locality | set to global for a global publication or local for a local one
  valueFed | the ValueFederate to use
  key | the identifier for the publication
  type | the defined type of the publication
  units | the units associated with a Federate

## ◆ Publication() [9/9]

template<class FedPtr >

helics::Publication::Publication | ( | InterfaceVisibility | locality,
|  | FedPtr & | valueFed,
|  | std::string_view | key,
|  | DataType | type,
|  | std::string_view | units = `std::string_view()`
| ) |  |
| inline

constructor to build a publication object

Parameters

  locality | set to global for a global publication or local for a local one
  valueFed | the ValueFederate to use
  key | the identifier for the publication
  type | the defined type of the publication
  units | the units associated with a Federate

## Member Function Documentation

## ◆ addInputTarget()

void helics::Publication::addInputTarget | ( | std::string_view | target | ) |
| inline

add an input object to send the information

## ◆ addTarget()

void helics::Publication::addTarget | ( | std::string_view | target | ) |
| inline

add an input object to target

## ◆ enableChangeDetection()

void helics::Publication::enableChangeDetection | ( | bool | enabled = `true` | ) |
| inline noexcept

if set to false, the change detection mechanisms are not enabled if set to true the values will be published if there is sufficient change as specified in the call to setMinimumChange

## ◆ getDisplayName()

virtual const std::string& helics::Publication::getDisplayName | ( |  | ) | const
| inline override virtual

get the display name for an input

the name is the given local name or if empty the name of the target

Implements helics::Interface.

## ◆ getType()

const std::string& helics::Publication::getType | ( |  | ) | const
| inline

get the type for the publication

## ◆ getUnits()

const std::string& helics::Publication::getUnits | ( |  | ) | const
| inline

get the units of the publication

## ◆ publish() [1/5]

template<class X >

std::enable_if_t<(std::is_constructible_v<std::string_view, X>), void> helics::Publication::publish | ( | const X & | val | ) |
| inline

publish stringLike values

## ◆ publish() [2/5]

template<class X >

std::enable_if_t<(std::is_same_v<defV, remove_cv_ref<X>>), void> helics::Publication::publish | ( | const X & | val | ) |
| inline

publish stringLike values

## ◆ publish() [3/5]

void helics::Publication::publish | ( | double | val | ) |

close a input during an active simulation

it is not necessary to call this function unless you are continuing the simulation after the close send a value for publication

Parameters

  val | the value to publish

References helics::changeDetected(), changeDetectionEnabled, fed, helics::ValueFederate::publishBytes(), pubType, and helics::typeConvert().

Referenced by publish(), and helics::publish().

## ◆ publish() [4/5]

void helics::Publication::publish | ( | double | val,
|  | const std::string & | units
| ) |  |

secondary publish function to allow unit conversion before publication

Parameters

  val | the value to publish
  units | the units association with the publication

References publish().

## ◆ publish() [5/5]

template<class X >

std::enable_if_t<(std::is_integral_v<X> && !std::is_same_v<remove_cv_ref<X>, char>), void> helics::Publication::publish | ( | X | val | ) |
| inline

publish integral values

## ◆ publishComplex()

void helics::Publication::publishComplex | ( | const double * | vals,
|  | int | size
| ) |  |

interpret as a vector of alternating real and imag values

References helics::changeDetected(), changeDetectionEnabled, fed, helics::ValueFederate::publishBytes(), pubType, and helics::typeConvert().

## ◆ setMinimumChange()

void helics::Publication::setMinimumChange | ( | double | deltaV | ) |
| inline noexcept

set the level by which a value must have changed to actually publish the value

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

- Publications.hpp
- Publications.cpp