The writer class is used to write samples for a data element.
More...
#include <DataStorm/DataStorm.h>
|
| Writer (Writer &&writer) noexcept |
| Transfers the given writer to this writer. More...
|
|
Writer & | operator= (Writer &&writer) noexcept |
| Move assignement operator. More...
|
|
| ~Writer () |
| Destruct the writer. More...
|
|
bool | hasReaders () const noexcept |
| Indicates whether or not readers are online. More...
|
|
void | waitForReaders (unsigned int count=1) const |
| Wait for given number of readers to be online. More...
|
|
void | waitForNoReaders () const |
| Wait for readers to be offline. More...
|
|
std::vector< std::string > | getConnectedReaders () const noexcept |
| Get the connected readers. More...
|
|
std::vector< Key > | getConnectedKeys () const noexcept |
| Get the keys for which readers are connected to this writer. More...
|
|
Sample< Key, Value, UpdateTag > | getLast () |
| Get the last written sample. More...
|
|
std::vector< Sample< Key, Value, UpdateTag > > | getAll () noexcept |
| Get all the written sample kept in the writer history. More...
|
|
void | onConnectedKeys (std::function< void(std::vector< Key >)> init, std::function< void(CallbackReason, Key)> update) noexcept |
| Calls the given functions to provide the initial set of connected keys and when a key is added or removed from the set of connected keys. More...
|
|
void | onConnectedReaders (std::function< void(std::vector< std::string >)> init, std::function< void(CallbackReason, std::string)> update) noexcept |
| Calls the given functions to provide the initial set of connected readers and when a new reader connects or disconnects. More...
|
|
template<typename Key, typename Value, typename UpdateTag>
class DataStorm::Writer< Key, Value, UpdateTag >
The writer class is used to write samples for a data element.
◆ KeyType
template<typename Key , typename Value , typename UpdateTag >
◆ ValueType
template<typename Key , typename Value , typename UpdateTag >
◆ Writer()
template<typename Key , typename Value , typename UpdateTag >
Transfers the given writer to this writer.
- Parameters
-
◆ ~Writer()
template<typename Key , typename Value , typename UpdateTag >
Destruct the writer.
The destruction of the writer disconnects the writer from the readers.
◆ getAll()
template<typename Key , typename Value , typename UpdateTag >
Get all the written sample kept in the writer history.
- Returns
- The sample history.
◆ getConnectedKeys()
template<typename Key , typename Value , typename UpdateTag >
std::vector< Key > DataStorm::Writer< Key, Value, UpdateTag >::getConnectedKeys |
( |
| ) |
const |
|
noexcept |
Get the keys for which readers are connected to this writer.
- Returns
- The keys for which we have writers connected.
◆ getConnectedReaders()
template<typename Key , typename Value , typename UpdateTag >
std::vector< std::string > DataStorm::Writer< Key, Value, UpdateTag >::getConnectedReaders |
( |
| ) |
const |
|
noexcept |
Get the connected readers.
- Returns
- The names of the connected readers.
◆ getLast()
template<typename Key , typename Value , typename UpdateTag >
Get the last written sample.
If there's no sample, the std::logic_error exception is raised.
- Returns
- The last written sample.
◆ hasReaders()
template<typename Key , typename Value , typename UpdateTag >
Indicates whether or not readers are online.
- Returns
- True if readers are connected, false otherwise.
◆ onConnectedKeys()
template<typename Key , typename Value , typename UpdateTag >
void DataStorm::Writer< Key, Value, UpdateTag >::onConnectedKeys |
( |
std::function< void(std::vector< Key >)> |
init, |
|
|
std::function< void(CallbackReason, Key)> |
update |
|
) |
| |
|
noexcept |
Calls the given functions to provide the initial set of connected keys and when a key is added or removed from the set of connected keys.
If callback functions are already set, they will be replaced.
The connected keys represent the set of keys for which writers are connected to this reader.
The init callback is always called after this method returns to provide the initial set of connected keys. The update callback is called when new keys are added or removed from the set of connected keys.
- Parameters
-
init | The function to call with the initial set of connected keys. |
update | The function to call when a key is added or removed from the set. |
◆ onConnectedReaders()
template<typename Key , typename Value , typename UpdateTag >
void DataStorm::Writer< Key, Value, UpdateTag >::onConnectedReaders |
( |
std::function< void(std::vector< std::string >)> |
init, |
|
|
std::function< void(CallbackReason, std::string)> |
update |
|
) |
| |
|
noexcept |
Calls the given functions to provide the initial set of connected readers and when a new reader connects or disconnects.
If callback functions are already set, they will be replaced.
The init callback is always called after this method returns to provide the initial set of connected readers. The update callback is called when new readers connect or disconnect.
- Parameters
-
init | The function to call with the initial set of connected readers. |
update | The function to call when a new reader connects or disconnects. |
◆ operator=()
template<typename Key , typename Value , typename UpdateTag >
Move assignement operator.
- Parameters
-
◆ waitForNoReaders()
template<typename Key , typename Value , typename UpdateTag >
◆ waitForReaders()
template<typename Key , typename Value , typename UpdateTag >
void DataStorm::Writer< Key, Value, UpdateTag >::waitForReaders |
( |
unsigned int |
count = 1 | ) |
const |
Wait for given number of readers to be online.
The node shutdown will cause this method to raise NodeShutdownException.
- Parameters
-
count | The number of readers to wait. |
The documentation for this class was generated from the following file: