| helics 3.6.1

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
VectorSubscription & | operator= (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

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

  valueFed | the ValueFederate to use
  key | the identifier for the publication to subscribe to
  startIndex | the index to start with
  count | the number of values to subscribe to
  defValue | the default value
  units | the 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

  valueFed | the ValueFederate to use
  key | the identifier for the publication to subscribe to
  startIndex | the index to start with
  count | the number of values to subscribe to
  defValue | the default value
  units | the units associated with the Subscription

## ◆ VectorSubscription() [3/3]

template<class X >

helics::VectorSubscription< X >::VectorSubscription | ( | VectorSubscription< X > && | vs | ) |
| inline noexcept

move constructor

References helics::ValueFederate::setInputNotificationCallback().

## 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 | ) |
| inline noexcept

move assignment

References helics::ValueFederate::setInputNotificationCallback().

## ◆ 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

  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