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

#include <Subscriptions.hpp>

Public Member Functions

 VectorSubscription (ValueFederate *valueFed, std::string_view key, int startIndex, int count, const X &defValue, std::string_view units=std::string_view{})
 
template<class FedPtr >
 VectorSubscription (FedPtr valueFed, std::string_view key, int startIndex, int count, const X &defValue, std::string_view units=std::string_view{})
 
 VectorSubscription (VectorSubscription &&vs) noexcept
 
VectorSubscriptionoperator= (VectorSubscription &&vs) noexcept
 
const std::vector< X > & getVals () const
 
const X & operator[] (int index) const
 
void setInputNotificationCallback (std::function< void(int, Time)> callback)
 

Detailed Description

template<class X>
class helics::VectorSubscription< X >

class to handle a Vector Subscription

Template Parameters
Xthe class of the value associated with the vector subscription

Constructor & Destructor Documentation

◆ VectorSubscription() [1/3]

template<class X >
helics::VectorSubscription< X >::VectorSubscription ( ValueFederate valueFed,
std::string_view  key,
int  startIndex,
int  count,
const X &  defValue,
std::string_view  units = std::string_view{} 
)
inline

constructor to build a subscription object

Parameters
valueFedthe ValueFederate to use
keythe identifier for the publication to subscribe to
startIndexthe index to start with
countthe number of values to subscribe to
defValuethe default value
unitsthe units associated with the Subscription

◆ VectorSubscription() [2/3]

template<class X >
template<class FedPtr >
helics::VectorSubscription< X >::VectorSubscription ( FedPtr  valueFed,
std::string_view  key,
int  startIndex,
int  count,
const X &  defValue,
std::string_view  units = std::string_view{} 
)
inline

constructor to build a subscription object

Parameters
valueFedthe ValueFederate to use
keythe identifier for the publication to subscribe to
startIndexthe index to start with
countthe number of values to subscribe to
defValuethe default value
unitsthe units associated with the Subscription

◆ VectorSubscription() [3/3]

template<class X >
helics::VectorSubscription< X >::VectorSubscription ( VectorSubscription< X > &&  vs)
inlinenoexcept

Member Function Documentation

◆ getVals()

template<class X >
const std::vector<X>& helics::VectorSubscription< X >::getVals ( ) const
inline

get the most recent value

Returns
the value

◆ operator=()

template<class X >
VectorSubscription& helics::VectorSubscription< X >::operator= ( VectorSubscription< X > &&  vs)
inlinenoexcept

◆ operator[]()

template<class X >
const X& helics::VectorSubscription< X >::operator[] ( int  index) const
inline

get a value through its index

◆ setInputNotificationCallback()

template<class X >
void helics::VectorSubscription< X >::setInputNotificationCallback ( std::function< void(int, 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

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