Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches

◆ setSampleFilter()

template<typename Key, typename Value, typename UpdateTag>
template<typename Criteria>
void DataStorm::Topic< Key, Value, UpdateTag >::setSampleFilter ( std::string name,
std::function< std::function< bool(const SampleType &)>(const Criteria &)> factory )
noexcept

Sets 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. Register all sample filter factories before creating any reader or writer for this topic: the set of factories is not synchronized, so modifying it once the topic is in use races with the Ice threads that use the topic. A sample filter interacts with partial updates: a writer sends only the samples a reader's filter matches, so the reader can receive a partial update for a key whose full value it never received. The reader has nothing to resolve such updates against and discards them until it receives a full value for the key. And when the filter rejects some samples for a key but a later partial update matches, the reader applies that update to the last value it received for the key — not to the value the writer computed the update against — so the reader's value can silently diverge from the writer's.

Parameters
nameThe name of the sample filter.
factoryThe filter factory function.

Definition at line 1727 of file DataStorm.h.