Class PlayerProgressBar

Class Documentation

class PlayerProgressBar

Public Types

enum class PlayerStatus : char

Values:

enumerator BURST
enumerator DELAYED
enumerator PAUSED
enumerator RUNNING
enumerator STOPPED

Public Functions

explicit PlayerProgressBar(std::ostream &output_stream, rcutils_time_point_value_t starting_time, rcutils_time_point_value_t ending_time, int32_t progress_bar_update_rate = 0, uint32_t progress_bar_separation_lines = 3)

PlayerProgressBar constructor

Parameters:
  • output_stream – Reference to output stream where progress bar and help information will be printed out. Could be std::cout, std::cerr or std::ostringstream for tests.

  • starting_time – Time stamp of the first message in the bag.

  • ending_time – Time stamp of the last message in the bag.

  • progress_bar_update_rate – The progress bar maximum update rate in times per second (Hz). If update rate equal 0 the progress bar will be disabled and will not output any information. If update rate less than 0 the progress bar will be updated for every update(..) and update_with_limited_rate(..) calls.

  • progress_bar_separation_lines – Number of separation lines to print in between the playback output and the progress bar.

virtual ~PlayerProgressBar()
void print_help_str() const

Prints help string about player progress bar. Expected to be printed once at the beginning.

void update_with_limited_rate(const PlayerStatus &status, const rcutils_time_point_value_t &timestamp)

Updates progress bar with the specified timestamp and player status, taking into account the update rate set by the user.

Note

The function should be used for regular progress bar updates, for example after the publishing the next message.

Warning

This function is not thread safe and shall not be called concurrently from multiple threads.

Parameters:
  • status – The player status to be updated on progress bar.

  • timestamp – Timestamp of the last published message.

void update(const PlayerStatus &status, const rcutils_time_point_value_t &timestamp = -1)

Updates progress bar with the specified player status, irrespective to the update rate set by the user.

Note

The function should be called for extraordinary progress bar updates, for example when player changed its internal status or a log message is printed, and we want to ‘redraw’ the progress bar.

Parameters:
  • status – The player status to be updated on progress bar.

  • timestamp – Timestamp of the last published message. If timestamp is less than 0 the last published timestamp will be taken from the inner progress bar cache.

PlayerStatus get_player_status()

Getter function for current player status.

Returns:

Current player status.