helics
3.5.3
|
#include <Publications.hpp>
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 |
define a publication object in the C++98 interface
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
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.
helics::Publication::Publication | ( | ValueFederate * | valueFed, |
std::string_view | key, | ||
std::string_view | type, | ||
std::string_view | units = std::string_view{} |
||
) |
constructor for a publication
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().
|
inline |
base constructor for a publication
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 |
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
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 |
|
inline |
base constructor for a publication
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 |
|
inline |
constructor to build a publication object
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 |
|
inline |
constructor to build a publication object
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 |
|
inline |
constructor to build a publication object
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 |
|
inline |
constructor to build a publication object
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 |
|
inline |
add an input object to send the information
|
inline |
add an input object to target
|
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
|
inlineoverridevirtual |
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.
|
inline |
get the type for the publication
|
inline |
get the units of the publication
|
inline |
publish stringLike values
|
inline |
publish stringLike values
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
val | the value to publish |
References helics::changeDetected(), changeDetectionEnabled, fed, helics::ValueFederate::publishBytes(), pubType, and helics::typeConvert().
Referenced by publish(), and helics::publish().
void helics::Publication::publish | ( | double | val, |
const std::string & | units | ||
) |
secondary publish function to allow unit conversion before publication
val | the value to publish |
units | the units association with the publication |
References publish().
|
inline |
publish integral values
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().
|
inlinenoexcept |
set the level by which a value must have changed to actually publish the value