| helics 3.6.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())
VectorSubscription2d & | operator= (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

  X | the 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

  valueFed | the ValueFederate to use
  key | the identifier for the publication to subscribe to
  startIndex_x | the index to start with in the x dimension
  count_x | the number of values in the x direction
  startIndex_y | the index to start with in the x dimension
  count_y | the number of values in the x direction
  defValue | the default value
  units | the 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 | ) |
| inline noexcept

move assignment

References helics::ValueFederate::setInputNotificationCallback().

## ◆ operator[]()

template<class X >

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

get the value in the given variable

Parameters

  index | the 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

  callback | a 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:

- Subscriptions.hpp