libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
tcspc::capture_output_checker< EventList > Class Template Reference

Description

template<typename EventList>
class tcspc::capture_output_checker< EventList >

Event-set-specific wrapper for tcspc::capture_output_access.

This class has almost the same interface as tcspc::capture_output_access but is parameterized on EventList so does not require specifying the event set when calling check() or pop().

Public Member Functions

 capture_output_checker (feed_as feeder_value_category, capture_output_access access)
 Construct from a tcspc::capture_output_access, with the feeder's value category.
 capture_output_checker (feed_as feeder_value_category, std::shared_ptr< context > context, std::string const &name)
 Construct from a context, tracker name of tcspc::capture_output processor, and feeder's value category.
template<typename Event>
auto check (emitted_as value_category, Event const &expected_event) -> bool
 Check that the next recorded output event matches with the given event and value category.
template<typename Event>
auto check (Event const &expected_event) -> bool
 Check that the next recorded output event matches with the given event, disregarding value category.
auto check_flushed () -> bool
 Check that no recorded output events remain and the output has been flushed.
auto check_not_flushed () -> bool
 Check that no recorded output events remain but the output has not been flushed.
template<typename Event>
auto pop () -> Event
 Retrieve the next recorded output event, disregarding value category.
template<typename Event>
auto pop (emitted_as value_category) -> Event
 Retrieve the next recorded output event, checking its value category.
void throw_end_processing_on_flush ()
 Arrange to throw tcspc::end_of_processing on receiving a flush.
void throw_end_processing_on_next (std::size_t count=0)
 Arrange to throw tcspc::end_of_processing on receiving the given number of events.
void throw_error_on_flush ()
 Arrange to throw tcspc::test_error on receiving a flush.
void throw_error_on_next (std::size_t count=0)
 Arrange to throw tcspc::test_error on receiving the given number of events.

Member Function Documentation

◆ check() [1/2]

template<typename EventList>
template<typename Event>
auto tcspc::capture_output_checker< EventList >::check ( emitted_as value_category,
Event const & expected_event ) -> bool
inline

Check that the next recorded output event matches with the given event and value category.

This function never returns false; a std::logic_error is thrown if the check is unsuccessful. It returns true for convenient use with testing framework macros such as CHECK() or REQUIRE() (which typically help locate where an exception was thrown).

Template Parameters
Eventthe expected event type
Parameters
value_categorythe expected value category of the emitted event; tcspc::emitted_as::same_as_fed is only allowed if the feeder value category was set upon construction
expected_eventthe expected event
Returns
true if the check was successful

◆ check() [2/2]

template<typename EventList>
template<typename Event>
auto tcspc::capture_output_checker< EventList >::check ( Event const & expected_event) -> bool
inline

Check that the next recorded output event matches with the given event, disregarding value category.

Equivalent to check(tcspc::emitted_as::any_allowed, expected_event).

◆ check_flushed()

template<typename EventList>
auto tcspc::capture_output_checker< EventList >::check_flushed ( ) -> bool
inline

Check that no recorded output events remain and the output has been flushed.

This function never returns false; a std::logic_error is thrown if the check is unsuccessful. It returns true for convenient use with testing framework macros such as CHECK() or REQUIRE() (which typically help locate where an exception was thrown).

Returns
true if the check was successful.

◆ check_not_flushed()

template<typename EventList>
auto tcspc::capture_output_checker< EventList >::check_not_flushed ( ) -> bool
inline

Check that no recorded output events remain but the output has not been flushed.

This function never returns false; a std::logic_error is thrown if the check is unsuccessful. It returns true for convenient use with testing framework macros such as CHECK() or REQUIRE() (which typically help locate where an exception was thrown).

Returns
true if the check was successful.

◆ pop() [1/2]

template<typename EventList>
template<typename Event>
auto tcspc::capture_output_checker< EventList >::pop ( ) -> Event
inline

Retrieve the next recorded output event, disregarding value category.

Equivalent to pop(tcspc::emitted_as::any_allowed).

◆ pop() [2/2]

template<typename EventList>
template<typename Event>
auto tcspc::capture_output_checker< EventList >::pop ( emitted_as value_category) -> Event
inline

Retrieve the next recorded output event, checking its value category.

This can be used when check() is not convenient (for example, because the exactly matching event is not known).

Template Parameters
Eventthe expected event type
Returns
the event

◆ throw_end_processing_on_next()

template<typename EventList>
void tcspc::capture_output_checker< EventList >::throw_end_processing_on_next ( std::size_t count = 0)
inline

Arrange to throw tcspc::end_of_processing on receiving the given number of events.

Parameters
countnumber of events to handle normally before throwing

◆ throw_error_on_next()

template<typename EventList>
void tcspc::capture_output_checker< EventList >::throw_error_on_next ( std::size_t count = 0)
inline

Arrange to throw tcspc::test_error on receiving the given number of events.

Parameters
countnumber of events to handle normally before throwing

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