|
libqi-api
release-2.5.3-2016-11-18
|
A tool to track signal emissions, specialized for testing. A signal spy can acknowledge every signal emission of a given signal, type-erased or not. Every emission is recorded, so that they can be compared to expectations, or to produce a history. More...
#include <signalspy.hpp>
Classes | |
| struct | Record |
| A record data, corresponding to one signal emission. More... | |
Public Member Functions | |
| template<typename... Args> | |
| SignalSpy (SignalF< void(Args...)> &signal) | |
| Constructor taking a signal instance. More... | |
| SignalSpy (qi::AnyObject &object, const std::string &signalOrPropertyName) | |
| Constructor taking a type-erased signal. More... | |
| SignalSpy (const SignalSpy &)=delete | |
| SignalSpy & | operator= (const SignalSpy &)=delete |
| ~SignalSpy () | |
| std::vector< Record > | allRecords () const |
| Retrieve all the records in one shot. More... | |
| Record | record (size_t index) const |
| Direct access to a record, by order of arrival. More... | |
| Record | lastRecord () const |
| Direct access to last record. More... | |
| size_t | recordCount () const |
| The number of records. More... | |
| unsigned int | getCounter () const |
| qi::FutureSync< bool > | waitUntil (unsigned int nofRecords, const qi::Duration &timeout) const |
| Waits for the given number of records to be reached, before the given timeout. More... | |
Public Member Functions inherited from qi::Actor | |
| Actor ()=default | |
| Actor (const Actor &)=delete | |
| Actor (qi::ExecutionContext &ec) | |
| virtual | ~Actor ()=default |
| qi::Strand * | strand () const |
| template<class... Args> | |
| auto | stranded (Args &&...args) const -> decltype(_strand.schedulerFor(std::forward< Args >(args)...)) |
| template<class... Args> | |
| auto | async (Args &&...args) const -> decltype(_strand.async(std::forward< Args >(args)...)) |
| template<class... Args> | |
| auto | asyncDelay (Args &&...args) const -> decltype(_strand.asyncDelay(std::forward< Args >(args)...)) |
| template<class... Args> | |
| auto | asyncAt (Args &&...args) const -> decltype(_strand.asyncAt(std::forward< Args >(args)...)) |
| void | joinTasks () |
A tool to track signal emissions, specialized for testing. A signal spy can acknowledge every signal emission of a given signal, type-erased or not. Every emission is recorded, so that they can be compared to expectations, or to produce a history.
It could also be used in production code for the timeout mechanism implemented in waitUntil.
Definition at line 21 of file signalspy.hpp.
|
inline |
Constructor taking a signal instance.
Definition at line 26 of file signalspy.hpp.
|
inline |
Constructor taking a type-erased signal.
Definition at line 36 of file signalspy.hpp.
|
delete |
|
inline |
Definition at line 52 of file signalspy.hpp.
|
inline |
Retrieve all the records in one shot.
Definition at line 72 of file signalspy.hpp.
|
inline |
Definition at line 114 of file signalspy.hpp.
|
inline |
Direct access to last record.
Definition at line 93 of file signalspy.hpp.
|
inline |
Direct access to a record, by order of arrival.
Definition at line 80 of file signalspy.hpp.
|
inline |
The number of records.
Definition at line 102 of file signalspy.hpp.
|
inline |
Waits for the given number of records to be reached, before the given timeout.
Definition at line 120 of file signalspy.hpp.