libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
tcspc::capture_output_access Class Reference

Description

Access for tcspc::capture_output() processors.

Note
It is recommended to wrap this object in tcspc::capture_output_checker, which provides a similar interface but simplifies calling check() and pop().

Public Member Functions

template<typename Event, typename EventList>
auto check (feed_as feeder_value_category, emitted_as value_category, Event const &expected_event) -> bool
 Check that the next recorded output event matches with the given one.
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.
void check_ready_for_input (std::string const &input) const
 Check if ready for input; normally used internally by tcspc::feed_input().
template<typename Event, typename EventList>
auto pop (feed_as feeder_value_category, emitted_as value_category) -> Event
 Retrieve the next recorded output event.
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()

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

Check that the next recorded output event matches with the given one.

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
EventListthe event set accepted by the tcspc::capture_output() processor
Parameters
feeder_value_categoryvalue category of events fed to the processor under test
value_categoryexpected value category of emitted event being checked
expected_eventthe expected event
Returns
true if the check was successful

◆ check_flushed()

auto tcspc::capture_output_access::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()

auto tcspc::capture_output_access::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()

template<typename Event, typename EventList>
auto tcspc::capture_output_access::pop ( feed_as feeder_value_category,
emitted_as value_category ) -> Event
inline

Retrieve the next recorded output event.

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
EventListthe event set accepted by the tcspc::capture_output() processor
Parameters
feeder_value_categoryvalue category of events fed to the processor under test
value_categoryexpected value category of emitted event being popped
Returns
the event

◆ throw_end_processing_on_next()

void tcspc::capture_output_access::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()

void tcspc::capture_output_access::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: