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

#include <Subscriptions.hpp>

Public Member Functions

template<class FedPtr >
 VectorSubscription2d (FedPtr valueFed, std::string_view key, int startIndex_x, int count_x, int startIndex_y, int count_y, const X &defValue, std::string_view units=std::string_view())
 
VectorSubscription2doperator= (VectorSubscription2d &&vs) noexcept
 
const std::vector< X > & getVals () const
 
const X & operator[] (int index) const
 
const X & at (int index_x, int index_y) const
 
void setInputNotificationCallback (std::function< void(int, Time)> callback)
 

Detailed Description

template<class X>
class helics::VectorSubscription2d< X >

class to handle a Vector Subscription

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

Constructor & Destructor Documentation

◆ VectorSubscription2d()

template<class X >
template<class FedPtr >
helics::VectorSubscription2d< X >::VectorSubscription2d ( FedPtr  valueFed,
std::string_view  key,
int  startIndex_x,
int  count_x,
int  startIndex_y,
int  count_y,
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
startIndex_xthe index to start with in the x dimension
count_xthe number of values in the x direction
startIndex_ythe index to start with in the x dimension
count_ythe number of values in the x direction
defValuethe default value
unitsthe units associated with the Subscription

References helics::ValueFederate::registerIndexedSubscription(), and helics::ValueFederate::setInputNotificationCallback().

Member Function Documentation

◆ at()

template<class X >
const X& helics::VectorSubscription2d< X >::at ( int  index_x,
int  index_y 
) const
inline

get the value in the given variable at a particular 2d index

◆ getVals()

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

get the most recent value

Returns
the value

◆ operator=()

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

◆ operator[]()

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

get the value in the given variable

Parameters
indexthe location to retrieve the value for

◆ setInputNotificationCallback()

template<class X >
void helics::VectorSubscription2d< 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: