helics  2.8.1
Public Member Functions | List of all members
helics::InputT< X > Class Template Reference

#include <Inputs.hpp>

+ Inheritance diagram for helics::InputT< X >:

Public Member Functions

 InputT (ValueFederate *valueFed, const std::string &name, const std::string &units=std::string())
 
template<class FedPtr >
 InputT (FedPtr &valueFed, const std::string &name, const std::string &units=std::string())
 
getValue ()
 
void getValue (X &out)
 
void setInputNotificationCallback (std::function< void(X, Time)> callback)
 
void setDefault (const X &val)
 
- Public Member Functions inherited from helics::Input
 Input ()=default
 
 Input (ValueFederate *valueFed, interface_handle id, const std::string &actName, const std::string &unitsOut=std::string{})
 
 Input (ValueFederate *valueFed, const std::string &key, const std::string &defaultType="def", const std::string &units=std::string{})
 
template<class FedPtr >
 Input (FedPtr &valueFed, const std::string &key, const std::string &defaultType="def", const std::string &units=std::string{})
 
 Input (interface_visibility locality, ValueFederate *valueFed, const std::string &key, const std::string &defaultType="def", const std::string &units=std::string{})
 
template<class FedPtr >
 Input (interface_visibility locality, FedPtr &valueFed, const std::string &name, const std::string &defaultType="def", const std::string &units=std::string{})
 
 Input (ValueFederate *valueFed, const std::string &name, data_type defType, const std::string &units=std::string{})
 
template<class FedPtr >
 Input (FedPtr &valueFed, const std::string &name, data_type defType, const std::string &units=std::string())
 
 Input (interface_visibility locality, ValueFederate *valueFed, const std::string &name, const std::string &units=std::string{})
 
template<class FedPtr >
 Input (interface_visibility locality, FedPtr &valueFed, const std::string &key, const std::string &units=std::string{})
 
 Input (interface_visibility locality, ValueFederate *valueFed, const std::string &name, data_type defType, const std::string &units=std::string{})
 
template<class FedPtr >
 Input (interface_visibility locality, FedPtr &valueFed, const std::string &name, data_type defType, const std::string &units=std::string{})
 
Time getLastUpdate () const
 
interface_handle getHandle () const
 
 operator interface_handle () const
 
bool isValid () const
 
bool operator< (const Input &inp) const
 
bool operator> (const Input &inp) const
 
void registerNotificationCallback (std::function< void(Time)> callback)
 
const std::string & getName () const
 
const std::string & getKey () const
 
const std::string & getDisplayName () const
 
const std::string & getPublicationType () const
 
const std::string & getType () const
 
const std::string & getUnits () const
 
const std::string & getInjectionUnits () const
 
const std::string & getTarget () const
 
void addTarget (const std::string &newTarget)
 
void removeTarget (const std::string &targetToRemove)
 
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
 
bool checkUpdate (bool assumeUpdate=false)
 
void clearUpdate ()
 
bool isUpdated ()
 
bool isUpdated () const
 
template<class X >
void setInputNotificationCallback (std::function< void(const X &, Time)> callback)
 
template<class X >
void setDefault (X &&val)
 
void setMinimumChange (double deltaV) noexcept
 
void enableChangeDetection (bool enabled=true) noexcept
 
int getValue (double *data, int maxsize)
 
int getValue (char *str, int maxsize)
 
template<class X >
void getValue (X &out)
 
template<class X >
auto getValue ()
 
template<class X >
const X & getValueRef ()
 
data_view getRawValue ()
 
size_t getRawSize ()
 
size_t getStringSize ()
 
size_t getVectorSize ()
 
void close ()
 
data_type getHelicsType () const
 
data_type getHelicsInjectionType () const
 
multi_input_handling_method getMultiInputMode () const
 
bool vectorDataProcess (const std::vector< std::shared_ptr< const data_block >> &dataV)
 

Additional Inherited Members

- Protected Attributes inherited from helics::Input
ValueFederatefed = nullptr
 reference to the value federate
 
interface_handle handle
 the id as generated by the Federate
 

Detailed Description

template<class X>
class helics::InputT< X >

class to handle an input and extract a specific type

Template Parameters
Xthe class of the value associated with a input

Constructor & Destructor Documentation

◆ InputT() [1/2]

template<class X >
helics::InputT< X >::InputT ( ValueFederate valueFed,
const std::string &  name,
const std::string &  units = std::string() 
)
inline

constructor to build an input with a defined object type

Parameters
valueFedthe ValueFederate to use
namethe name of the input
unitsthe units associated with a Federate

◆ InputT() [2/2]

template<class X >
template<class FedPtr >
helics::InputT< X >::InputT ( FedPtr &  valueFed,
const std::string &  name,
const std::string &  units = std::string() 
)
inline

constructor to build an input with a defined type

Parameters
valueFedthe ValueFederate to use
namethe name of the input
unitsthe units associated with a Federate

Member Function Documentation

◆ getValue() [1/2]

template<class X >
X helics::InputT< X >::getValue ( )
inline

get the most recent value

Returns
the value

◆ getValue() [2/2]

template<class X >
void helics::InputT< X >::getValue ( X &  out)
inline

store the value in the given variable

Parameters
[out]outthe location to store the value

◆ setDefault()

template<class X >
void helics::InputT< X >::setDefault ( const X &  val)
inline

set a default value

Parameters
valthe value to set as the default

References helics::Input::setDefault().

◆ setInputNotificationCallback()

template<class X >
void helics::InputT< X >::setInputNotificationCallback ( std::function< void(X, Time)>  callback)
inline

register a callback for the update

the callback is called in the just before the time request function returns

Parameters
callbacka function with signature void(X val, Time time) val is the new value and time is the time the value was updated

References helics::Input::fed, and helics::ValueFederate::setInputNotificationCallback().


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