DataStorm
0.1
Data Distribution Service
|
#include <DataStorm/DataStorm.h>
Public Types | |
using | KeyType = Key |
The topic's key type. More... | |
using | ValueType = Value |
The topic's value type. More... | |
using | UpdateTagType = UpdateTag |
The topic's update tag type (defaults to std::string if not specified). More... | |
using | WriterType = Writer< Key, Value, UpdateTag > |
The topic's writer type. More... | |
using | ReaderType = Reader< Key, Value, UpdateTag > |
The topic's reader type. More... | |
using | SampleType = Sample< Key, Value, UpdateTag > |
The topic's sample type. More... | |
Public Member Functions | |
Topic (const Node &node, const std::string &name) noexcept | |
Construct a new Topic for the topic with the given name. More... | |
Topic (Topic &&topic) noexcept | |
Construct a new Topic by taking ownership of the given topic. More... | |
~Topic () | |
Destruct the Topic. More... | |
Topic & | operator= (Topic &&topic) noexcept |
Move assignement operator. More... | |
bool | hasWriters () const noexcept |
Indicates whether or not data writers are online. More... | |
void | waitForWriters (unsigned int count=1) const |
Wait for given number of data writers to be online. More... | |
void | waitForNoWriters () const |
Wait for data writers to be offline. More... | |
void | setWriterDefaultConfig (const WriterConfig &config) noexcept |
Set the default configuration used to construct readers. More... | |
bool | hasReaders () const noexcept |
Indicates whether or not data readers are online. More... | |
void | waitForReaders (unsigned int count=1) const |
Wait for given number of data readers to be online. More... | |
void | waitForNoReaders () const |
Wait for data readers to be offline. More... | |
void | setReaderDefaultConfig (const ReaderConfig &config) noexcept |
Set the default configuration used to construct readers. More... | |
template<typename UpdateValue > | |
void | setUpdater (const UpdateTag &tag, std::function< void(Value &, UpdateValue)> updater) noexcept |
Set an updater function for the given update tag. More... | |
template<typename Criteria > | |
void | setKeyFilter (const std::string &name, std::function< std::function< bool(const Key &)>(const Criteria &)> factory) noexcept |
Set a key filter factory. More... | |
template<typename Criteria > | |
void | setSampleFilter (const std::string &name, std::function< std::function< bool(const SampleType &)>(const Criteria &)> factory) noexcept |
Set a sample filter factory. More... | |
Friends | |
template<typename , typename , typename > | |
class | SingleKeyWriter |
template<typename , typename , typename > | |
class | MultiKeyWriter |
template<typename , typename , typename > | |
class | SingleKeyReader |
template<typename , typename , typename > | |
class | MultiKeyReader |
template<typename , typename , typename > | |
class | FilteredKeyReader |
The Topic class.
This class allows constructing reader and writer objects. It's also used to setup filter and updater functions.
using DataStorm::Topic< Key, Value, UpdateTag >::KeyType = Key |
The topic's key type.
using DataStorm::Topic< Key, Value, UpdateTag >::ReaderType = Reader<Key, Value, UpdateTag> |
The topic's reader type.
using DataStorm::Topic< Key, Value, UpdateTag >::SampleType = Sample<Key, Value, UpdateTag> |
The topic's sample type.
using DataStorm::Topic< Key, Value, UpdateTag >::UpdateTagType = UpdateTag |
The topic's update tag type (defaults to std::string if not specified).
using DataStorm::Topic< Key, Value, UpdateTag >::ValueType = Value |
The topic's value type.
using DataStorm::Topic< Key, Value, UpdateTag >::WriterType = Writer<Key, Value, UpdateTag> |
The topic's writer type.
|
noexcept |
Construct a new Topic for the topic with the given name.
node | The node. |
name | The name of the topic. |
|
noexcept |
Construct a new Topic by taking ownership of the given topic.
topic | The topic to transfer ownership from. |
DataStorm::Topic< Key, Value, UpdateTag >::~Topic | ( | ) |
Destruct the Topic.
This disconnects the topic from peers.
|
noexcept |
Indicates whether or not data readers are online.
|
noexcept |
Indicates whether or not data writers are online.
|
noexcept |
Move assignement operator.
topic | The topic. |
|
noexcept |
Set a key filter factory.
The given factory function must return a filter function that returns true if the key matches the filter criteria, false otherwise.
name | The name of the key filter. |
factory | The filter factory function. |
|
noexcept |
Set the default configuration used to construct readers.
config | The default reader configuration. |
|
noexcept |
Set a sample filter factory.
The given factory function must return a filter function that returns true if the sample matches the filter criteria, false otherwise.
name | The name of the sample filter. |
factory | The filter factory function. |
|
noexcept |
Set an updater function for the given update tag.
The function is called when a partial update is received or sent to compute the new value. The function is provided the latest value and the partial update. It should return the new value.
tag | The update tag. |
updater | The updater function. |
|
noexcept |
Set the default configuration used to construct readers.
config | The default writer configuration. |
void DataStorm::Topic< Key, Value, UpdateTag >::waitForNoReaders | ( | ) | const |
Wait for data readers to be offline.
The node shutdown will cause this method to raise NodeShutdownException.
void DataStorm::Topic< Key, Value, UpdateTag >::waitForNoWriters | ( | ) | const |
Wait for data writers to be offline.
The node shutdown will cause this method to raise NodeShutdownException.
void DataStorm::Topic< Key, Value, UpdateTag >::waitForReaders | ( | unsigned int | count = 1 | ) | const |
Wait for given number of data readers to be online.
The node shutdown will cause this method to raise NodeShutdownException.
count | The number of data readers to wait. |
void DataStorm::Topic< Key, Value, UpdateTag >::waitForWriters | ( | unsigned int | count = 1 | ) | const |
Wait for given number of data writers to be online.
The node shutdown will cause this method to raise NodeShutdownException.
count | The number of date writers to wait. |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |