|
PdCom
4.2
Process data communication client
|
Subscription class. More...
#include <Variable.h>
Public Member Functions | |
| Subscription (Process *process, int id, const Variable *v, int decimation, const uint64_t *const *time, const char *const *data) | |
| Constructor. | |
| virtual void | cancel () const =0 |
| Cancel subscription. More... | |
| bool | poll () const |
| Poll a subscription. More... | |
| template<typename T > | |
| void | getValue (T *val, size_t index, size_t nelem) const |
| Retrieve subscriptions value in any data type. More... | |
| std::string | getStringValue (char delimiter=',') const |
| Get the entire value as a linear string. More... | |
| void | print (std::ostream &os, char delimiter) const |
| Write the value to std::ostream. More... | |
Public Attributes | |
| Process *const | process |
| pointer to process | |
| const int | id |
| id supplied during Process::subscribe() | |
| const Variable *const | variable |
| Actual variable. | |
| const int | decimation |
| Subscription decimation. | |
| const uint64_t *const *const | time_ns |
| Time of value in nanoseconds since epoch. More... | |
Subscription class.
The library passes on this class to Subscriber as a result of a successful variable subscribe().
This class is used to query various properties of the Subscription as well as a method to get the variable's value in any data type by calling getValue(), getStringValue() and print().
The value of a subscription is always accessible (doesn't SEGV), but it is not always sensible to call it outside of Subscriber::newValue() or Subscriber::newGroupValue().
To cancel a subscription, issue cancel() on it. cancel() is safe from within newValue() or newGroupValue().
Signals that are subscribed with an intermittent interval < 0 are only updated after issuing poll().
|
pure virtual |
Cancel subscription.
Calling cancel() is safe from within Subscriber::newValue() and Subscriber::newGroupValue().
| std::string PdCom::Variable::Subscription::getStringValue | ( | char | delimiter = ',' | ) | const |
Get the entire value as a linear string.
| delimiter | delimiter between vector elements |
| void PdCom::Variable::Subscription::getValue | ( | T * | val, |
| size_t | index, | ||
| size_t | nelem | ||
| ) | const |
Retrieve subscriptions value in any data type.
| val | value buffer to write to. Must be at least nelem long |
| index | starting index |
| nelem | number of elements to retrieve |
| bool PdCom::Variable::Subscription::poll | ( | ) | const |
Poll a subscription.
This is only available for signals when request interval < 0, otherwise an error value is returned.
The value is available during Subscriber::newValue().
| void PdCom::Variable::Subscription::print | ( | std::ostream & | os, |
| char | delimiter | ||
| ) | const |
Write the value to std::ostream.
This allows the user finer control of double variables.
| os | std::ostream output stream |
| delimiter | delimiter between vector elements |
| const uint64_t* const* const PdCom::Variable::Subscription::time_ns |
Time of value in nanoseconds since epoch.
Use double dereferencing to access the value, eg.
1.8.14