DataStorm  0.1
Data Distribution Service
Public Member Functions | List of all members
DataStorm::FilteredKeyReader< Key, Value, UpdateTag > Class Template Reference

The filtered reader to read data elements whose key match a given filter. More...

#include <DataStorm/DataStorm.h>

Inheritance diagram for DataStorm::FilteredKeyReader< Key, Value, UpdateTag >:
DataStorm::Reader< Key, Value, UpdateTag >

Public Member Functions

template<typename KeyFilterCriteria >
 FilteredKeyReader (const Topic< Key, Value, UpdateTag > &topic, const Filter< KeyFilterCriteria > &keyFilter, const std::string &name=std::string(), const ReaderConfig &config=ReaderConfig())
 Construct a new reader for the given key filter. More...
 
template<typename KeyFilterCriteria , typename SampleFilterCriteria >
 FilteredKeyReader (const Topic< Key, Value, UpdateTag > &topic, const Filter< KeyFilterCriteria > &keyFilter, const Filter< SampleFilterCriteria > &sampleFilter, const std::string &name=std::string(), const ReaderConfig &config=ReaderConfig())
 Construct a new reader for the given key filter and sample filter criterias. More...
 
 FilteredKeyReader (FilteredKeyReader &&reader) noexcept
 Transfers the given reader to this reader. More...
 
FilteredKeyReaderoperator= (FilteredKeyReader &&reader) noexcept
 Move assignement operator. More...
 
template<typename KFC >
 FilteredKeyReader (const Topic< Key, Value, UpdateTag > &topic, const Filter< KFC > &filter, const std::string &name, const ReaderConfig &config)
 
template<typename KFC , typename SFC >
 FilteredKeyReader (const Topic< Key, Value, UpdateTag > &topic, const Filter< KFC > &keyFilter, const Filter< SFC > &sampleFilter, const std::string &name, const ReaderConfig &config)
 
- Public Member Functions inherited from DataStorm::Reader< Key, Value, UpdateTag >
 Reader (Reader &&reader) noexcept
 Transfers the given reader to this reader. More...
 
 ~Reader ()
 Destruct the reader. More...
 
Readeroperator= (Reader &&reader) noexcept
 Move assignement operator. More...
 
bool hasWriters () const noexcept
 Indicates whether or not writers are online. More...
 
void waitForWriters (unsigned int count=1) const
 Wait for given number of writers to be online. More...
 
void waitForNoWriters () const
 Wait for readers to be offline. More...
 
std::vector< std::string > getConnectedWriters () const noexcept
 Get the connected writers. More...
 
std::vector< Key > getConnectedKeys () const noexcept
 Get the keys for which writers are connected to this reader. More...
 
std::vector< Sample< Key, Value, UpdateTag > > getAllUnread () noexcept
 Returns all the unread samples. More...
 
void waitForUnread (unsigned int count=1) const
 Wait for given number of unread samples to be available. More...
 
bool hasUnread () const noexcept
 Returns wether or not unread samples are available. More...
 
Sample< Key, Value, UpdateTag > getNextUnread ()
 Returns the next unread sample. 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 onConnectedWriters (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 writers and when a new writer connects or disconnects. More...
 
void onSamples (std::function< void(std::vector< Sample< Key, Value, UpdateTag >>)> init, std::function< void(Sample< Key, Value, UpdateTag >)> queue) noexcept
 Calls the given function to provide the initial set of unread samples and when new samples are queued. More...
 

Additional Inherited Members

- Public Types inherited from DataStorm::Reader< Key, Value, UpdateTag >
using KeyType = Key
 The key type. More...
 
using ValueType = Value
 The value type. More...
 

Detailed Description

template<typename Key, typename Value, typename UpdateTag = std::string>
class DataStorm::FilteredKeyReader< Key, Value, UpdateTag >

The filtered reader to read data elements whose key match a given filter.

Constructor & Destructor Documentation

◆ FilteredKeyReader() [1/5]

template<typename Key, typename Value, typename UpdateTag = std::string>
template<typename KeyFilterCriteria >
DataStorm::FilteredKeyReader< Key, Value, UpdateTag >::FilteredKeyReader ( const Topic< Key, Value, UpdateTag > &  topic,
const Filter< KeyFilterCriteria > &  keyFilter,
const std::string &  name = std::string(),
const ReaderConfig config = ReaderConfig() 
)

Construct a new reader for the given key filter.

The construction of the reader connects the reader to writers whose key matches the key filter criteria.

If the key filter is not registered with the topic or the filter invalid, std::invalid_argument is raised.

Parameters
topicThe topic.
keyFilterThe key filter.
nameThe optional reader name.
configThe reader configuration.

◆ FilteredKeyReader() [2/5]

template<typename Key, typename Value, typename UpdateTag = std::string>
template<typename KeyFilterCriteria , typename SampleFilterCriteria >
DataStorm::FilteredKeyReader< Key, Value, UpdateTag >::FilteredKeyReader ( const Topic< Key, Value, UpdateTag > &  topic,
const Filter< KeyFilterCriteria > &  keyFilter,
const Filter< SampleFilterCriteria > &  sampleFilter,
const std::string &  name = std::string(),
const ReaderConfig config = ReaderConfig() 
)

Construct a new reader for the given key filter and sample filter criterias.

The construction of the reader connects the reader to writers whose key matches the key filter criteria.

If the key filter is not registered with the topic or the filter invalid, std::invalid_argument is raised.

Parameters
topicThe topic.
keyFilterThe key filter.
sampleFilterThe sample filter.
nameThe optional reader name.
configThe reader configuration.

◆ FilteredKeyReader() [3/5]

template<typename Key , typename Value , typename UpdateTag >
DataStorm::FilteredKeyReader< Key, Value, UpdateTag >::FilteredKeyReader ( FilteredKeyReader< Key, Value, UpdateTag > &&  reader)
noexcept

Transfers the given reader to this reader.

Parameters
readerThe reader.

◆ FilteredKeyReader() [4/5]

template<typename Key, typename Value, typename UpdateTag = std::string>
template<typename KFC >
DataStorm::FilteredKeyReader< Key, Value, UpdateTag >::FilteredKeyReader ( const Topic< Key, Value, UpdateTag > &  topic,
const Filter< KFC > &  filter,
const std::string &  name,
const ReaderConfig config 
)

◆ FilteredKeyReader() [5/5]

template<typename Key, typename Value, typename UpdateTag = std::string>
template<typename KFC , typename SFC >
DataStorm::FilteredKeyReader< Key, Value, UpdateTag >::FilteredKeyReader ( const Topic< Key, Value, UpdateTag > &  topic,
const Filter< KFC > &  keyFilter,
const Filter< SFC > &  sampleFilter,
const std::string &  name,
const ReaderConfig config 
)

Member Function Documentation

◆ operator=()

template<typename Key , typename Value , typename UpdateTag >
FilteredKeyReader< Key, Value, UpdateTag > & DataStorm::FilteredKeyReader< Key, Value, UpdateTag >::operator= ( FilteredKeyReader< Key, Value, UpdateTag > &&  reader)
noexcept

Move assignement operator.

Parameters
readerThe reader.

The documentation for this class was generated from the following file: