helics  2.8.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, interface_handle id, const std::string &key, const std::string &type, const std::string &units)
 
 Publication (ValueFederate *valueFed, const std::string &key, const std::string &type, const std::string &units=std::string())
 
template<class FedPtr >
 Publication (FedPtr valueFed, const std::string &key, const std::string &type=std::string(), const std::string &units=std::string())
 
 Publication (interface_visibility locality, ValueFederate *valueFed, const std::string &key, const std::string &type, const std::string &units=std::string())
 
template<class FedPtr >
 Publication (interface_visibility locality, FedPtr &valueFed, const std::string &key, const std::string &type, const std::string &units=std::string())
 
 Publication (ValueFederate *valueFed, const std::string &key, data_type type, const std::string &units=std::string())
 
template<class FedPtr >
 Publication (FedPtr &valueFed, const std::string &key, data_type type, const std::string &units=std::string())
 
 Publication (interface_visibility locality, ValueFederate *valueFed, const std::string &key, data_type type, const std::string &units=std::string())
 
template<class FedPtr >
 Publication (interface_visibility locality, FedPtr &valueFed, const std::string &key, data_type type, const std::string &units=std::string())
 
interface_handle getHandle () const
 
 operator interface_handle () const
 
bool isValid () const
 
bool operator== (const Publication &pub) const
 
bool operator!= (const Publication &pub) const
 
bool operator< (const Publication &pub) const
 
const std::string & getKey () const
 
const std::string & getName () const
 
const std::string & getType () const
 
const std::string & getUnits () const
 
const std::string & getInfo () const
 
void setInfo (const std::string &info)
 
void setOption (int32_t option, int32_t value=1)
 
int32_t getOption (int32_t option) const
 
void addTarget (const std::string &target)
 
void removeTarget (const std::string &targetToRemove)
 
void close ()
 
void publish (double val)
 
void publish (const char *val)
 
void publish (const std::string &val)
 
void publish (const std::vector< double > &val)
 
void publish (const std::vector< std::complex< double >> &val)
 
void publish (const double *vals, int size)
 
void publish (std::complex< double > val)
 
void publish (const defV &val)
 
void publish (bool val)
 
void publish (Time val)
 
void publish (char val)
 
void publish (const NamedPoint &np)
 
void publish (const std::string &name, double val)
 
void publish (const char *name, 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_integral< X >::value &&!std::is_same< remove_cv_ref< X >, char >::value), void > publish (X val)
 
template<class X >
std::enable_if_t<((typeCategory< X >::value==nonConvertibleType) &&(!std::is_convertible< X, std::string >::value) &&(!std::is_same< X, defV >::value) &&(!std::is_convertible< X, Time >::value)), void > publish (const X &val)
 
void setMinimumChange (double deltaV) noexcept
 
void enableChangeDetection (bool enabled=true) noexcept
 

Protected Attributes

ValueFederatefed {nullptr}
 the federate construct to interact with
 
interface_handle handle
 the internal id of the publication
 
data_type pubType {data_type::helics_any}
 the type of publication
 
bool changeDetectionEnabled {false}
 the change detection is enabled
 
bool disableAssign {false}
 disable assignment for the object
 

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,
interface_handle  id,
const std::string &  key,
const std::string &  type,
const std::string &  units 
)

constructor for a publication used by the valueFederateManager

Parameters
valueFeda pointer the link valueFederate
idthe interface_handle from the core
keythe identifier for the publication
typethe type of the publication
unitsan optional string defining the units

References helics::getTypeFromString(), and pubType.

◆ Publication() [2/9]

helics::Publication::Publication ( ValueFederate valueFed,
const std::string &  key,
const std::string &  type,
const std::string &  units = std::string() 
)

constructor for a publication

Parameters
valueFeda pointer the link valueFederate
keythe identifier for the publication
typethe type of the publication
unitsan optional string defining the units

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

◆ Publication() [3/9]

template<class FedPtr >
helics::Publication::Publication ( FedPtr  valueFed,
const std::string &  key,
const std::string &  type = std::string(),
const std::string &  units = std::string() 
)
inline

base constructor for a publication

Parameters
valueFeda pointer of some kind to a value federate (any dereferenceable type with * and -> operator that results in a valueFederate object
keythe identifier for the publication
typethe type of the publication
unitsan optional string defining the units

◆ Publication() [4/9]

helics::Publication::Publication ( interface_visibility  locality,
ValueFederate valueFed,
const std::string &  key,
const std::string &  type,
const std::string &  units = std::string() 
)

base constructor for a publication

Parameters
localityeither GLOBAL or LOCAL, LOCAL prepends the federate name to create a global identifier
valueFeda pointer to a value federate
keythe identifier for the publication
typethe type of the publication
unitsan optional string defining the units

◆ Publication() [5/9]

template<class FedPtr >
helics::Publication::Publication ( interface_visibility  locality,
FedPtr &  valueFed,
const std::string &  key,
const std::string &  type,
const std::string &  units = std::string() 
)
inline

base constructor for a publication

Parameters
localityeither GLOBAL or LOCAL, LOCAL prepends the federate name to create a global identifier
valueFeda pointer of some kind to a value federate (any dereferenceable type with * and -> operator that results in a valueFederate object
keythe identifier for the publication
typethe type of the publication
unitsan optional string defining the units

◆ Publication() [6/9]

helics::Publication::Publication ( ValueFederate valueFed,
const std::string &  key,
data_type  type,
const std::string &  units = std::string() 
)
inline

constructor to build a publication object

Parameters
valueFedthe ValueFederate to use
keythe identifier for the publication
typethe defined type of the publication
unitsthe units associated with a Federate

◆ Publication() [7/9]

template<class FedPtr >
helics::Publication::Publication ( FedPtr &  valueFed,
const std::string &  key,
data_type  type,
const std::string &  units = std::string() 
)
inline

constructor to build a publication object

Parameters
valueFedthe ValueFederate to use
keythe identifier for the publication
typethe defined type of the publication
unitsthe units associated with a Federate

◆ Publication() [8/9]

helics::Publication::Publication ( interface_visibility  locality,
ValueFederate valueFed,
const std::string &  key,
data_type  type,
const std::string &  units = std::string() 
)
inline

constructor to build a publication object

Parameters
localityset to global for a global publication or local for a local one
valueFedthe ValueFederate to use
keythe identifier for the publication
typethe defined type of the publication
unitsthe units associated with a Federate

◆ Publication() [9/9]

template<class FedPtr >
helics::Publication::Publication ( interface_visibility  locality,
FedPtr &  valueFed,
const std::string &  key,
data_type  type,
const std::string &  units = std::string() 
)
inline

constructor to build a publication object

Parameters
localityset to global for a global publication or local for a local one
valueFedthe ValueFederate to use
keythe identifier for the publication
typethe defined type of the publication
unitsthe units associated with a Federate

Member Function Documentation

◆ addTarget()

void helics::Publication::addTarget ( const std::string &  target)
inline

add a target to the publication

References fed.

◆ close()

void helics::Publication::close ( )
inline

close a input during an active simulation

it is not necessary to call this function unless you are continuing the simulation after the close

References fed.

◆ enableChangeDetection()

void helics::Publication::enableChangeDetection ( bool  enabled = true)
inlinenoexcept

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

◆ getHandle()

interface_handle helics::Publication::getHandle ( ) const
inline

get the publication id that can be used to make the function calls from a Value Federate

◆ getInfo()

const std::string& helics::Publication::getInfo ( ) const
inline

get the interface information field of the publication

References fed.

◆ getKey()

const std::string& helics::Publication::getKey ( ) const
inline

get the key for the publication

References fed.

◆ getName()

const std::string& helics::Publication::getName ( ) const
inline

get the key for the publication

◆ getOption()

int32_t helics::Publication::getOption ( int32_t  option) const
inline

get the current value of a flag for the handle

References fed.

◆ getType()

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

get the type for the publication

References fed.

◆ getUnits()

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

get the units of the publication

◆ isValid()

bool helics::Publication::isValid ( ) const
inline

check if the Publication links to a valid operation

Referenced by helics::ValueFederateManager::addAlias().

◆ operator interface_handle()

helics::Publication::operator interface_handle ( ) const
inline

implicit conversion operator for extracting the handle

◆ publish() [1/4]

template<class X >
std::enable_if_t<((typeCategory<X>::value == nonConvertibleType) && (!std::is_convertible<X, std::string>::value) && (!std::is_same<X, defV>::value) && (!std::is_convertible<X, Time>::value)), void> helics::Publication::publish ( const X &  val)
inline

publish anything not previously covered

◆ publish() [2/4]

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

◆ publish() [3/4]

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

secondary publish function to allow unit conversion before publication

Parameters
valthe value to publish
unitsthe units association with the publication

References publish().

◆ publish() [4/4]

template<class X >
std::enable_if_t<(std::is_integral<X>::value && !std::is_same<remove_cv_ref<X>, char>::value), void> helics::Publication::publish ( val)
inline

publish integral values

◆ removeTarget()

void helics::Publication::removeTarget ( const std::string &  targetToRemove)
inline

remove a named input from sending data

References fed.

◆ setInfo()

void helics::Publication::setInfo ( const std::string &  info)
inline

set the interface information field of the publication

References fed.

◆ setMinimumChange()

void helics::Publication::setMinimumChange ( double  deltaV)
inlinenoexcept

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

◆ setOption()

void helics::Publication::setOption ( int32_t  option,
int32_t  value = 1 
)
inline

set an option on the publication

Parameters
optionthe option to set
valuethe value to set the option

References fed.


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