libqi-api
2.8.7.4
|
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) | |
SignalSpy (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 |
FutureSync< bool > | waitUntil (size_t nofRecords, const Duration &timeout) const |
Waits for the given number of records to be reached, before the given timeout. More... | |
![]() | |
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 | strandedUnwrapped (Args &&...args) const -> decltype(_strand.unwrappedSchedulerFor(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 23 of file signalspy.hpp.
|
inline |
Constructor taking a signal instance. The signal instance must outlive the signal spy.
Definition at line 29 of file signalspy.hpp.
qi::SignalSpy::SignalSpy | ( | AnyObject & | object, |
const std::string & | signalOrPropertyName | ||
) |
Constructor taking a type-erased signal.
|
delete |
qi::SignalSpy::~SignalSpy | ( | ) |
std::vector<Record> qi::SignalSpy::allRecords | ( | ) | const |
Retrieve all the records in one shot.
unsigned int qi::SignalSpy::getCounter | ( | ) | const |
Record qi::SignalSpy::lastRecord | ( | ) | const |
Direct access to last record.
Record qi::SignalSpy::record | ( | size_t | index | ) | const |
Direct access to a record, by order of arrival.
size_t qi::SignalSpy::recordCount | ( | ) | const |
The number of records.
FutureSync<bool> qi::SignalSpy::waitUntil | ( | size_t | nofRecords, |
const Duration & | timeout | ||
) | const |
Waits for the given number of records to be reached, before the given timeout.