A test version of the message collector for use in unit tests. More...
#include "test.h"
Public Member Functions | |
message_collector (dpp::cluster *cl, uint64_t duration) | |
virtual void | cancel () |
Immediately cancels the collector. More... | |
virtual void | completed (const std::vector< C > &list)=0 |
You must implement this function to receive the completed list of captured objects. More... | |
virtual void | completed (const std::vector< dpp::message > &list) |
Return the completed collection. More... | |
virtual const dpp::message * | filter (const dpp::message_create_t &element) |
Select and filter the items which are to appear in the list This is called every time a new event is fired, to filter the event and determine which of the items is sent to the list. More... | |
virtual const C * | filter (const T &element)=0 |
Filter the list of elements. More... | |
Protected Attributes | |
class cluster * | owner |
Owning cluster. More... | |
A test version of the message collector for use in unit tests.
|
inline |
|
inlinevirtualinherited |
Immediately cancels the collector.
Use this if you have met the conditions for which you are collecting objects early, e.g. you were watching for a message containing 'yes' or 'no' and have received it before the time is up.
|
pure virtualinherited |
You must implement this function to receive the completed list of captured objects.
list | The list of captured objects in captured order |
|
inlinevirtual |
Return the completed collection.
list | items collected during the timeframe specified |
Implements dpp::message_collector.
References MSGCOLLECT, and set_test().
|
inlinevirtualinherited |
Select and filter the items which are to appear in the list This is called every time a new event is fired, to filter the event and determine which of the items is sent to the list.
Returning nullptr excludes the item from the list.
element | element to filter |
|
pure virtualinherited |
Filter the list of elements.
Every time an event is fired on the collector, this method wil be called to determine if we should add an object to the list or not. This function can then process the element
value, extract the parts which are to be saved to a list (e.g. a dpp::message out of a dpp::message_create_t) and return it as the return value. Returning a value of nullptr causes no object to be stored.
Here is an example of how to filter messages which have specific text in them. This should be used with the specialised type dpp::message_collector
element | The event data to filter |
|
protectedinherited |
Owning cluster.