MADARA  3.4.1
madara::knowledge::CheckpointPlayer Class Reference

Plays back a checkpoint over time, based on recorded TOI. More...

#include <CheckpointPlayer.h>

Public Member Functions

 CheckpointPlayer (CheckpointPlayer &&)=delete
 
 CheckpointPlayer (const CheckpointPlayer &)=delete
 
 CheckpointPlayer (ThreadSafeContext &context, CheckpointReader reader, KnowledgeUpdateSettings update_settings={})
 Constructor from CheckpointReader. More...
 
 CheckpointPlayer (ThreadSafeContext &context, CheckpointSettings settings, KnowledgeUpdateSettings update_settings={})
 Constructor. More...
 
 ~CheckpointPlayer ()
 
CheckpointPlayeroperator= (CheckpointPlayer &&)=delete
 
CheckpointPlayeroperator= (const CheckpointPlayer &)=delete
 
bool play_until (uint64_t target_toi)
 Loads values from checkpoint until it reaches or exceeds toi given. More...
 
void start ()
 Start playback. More...
 
void stop ()
 Stop playback, killing the playback thread. More...
 

Private Member Functions

void init_reader ()
 

Static Private Member Functions

static void thread_main (CheckpointPlayer *self)
 

Private Attributes

ThreadSafeContextcontext_
 
std::atomic_flag keep_running_
 
std::unique_ptr< CheckpointReaderreader_
 
CheckpointSettings settings_
 
std::thread thread_
 
KnowledgeUpdateSettings update_settings_
 

Detailed Description

Plays back a checkpoint over time, based on recorded TOI.

Definition at line 117 of file CheckpointPlayer.h.

Constructor & Destructor Documentation

◆ CheckpointPlayer() [1/4]

madara::knowledge::CheckpointPlayer::CheckpointPlayer ( ThreadSafeContext context,
CheckpointSettings  settings,
KnowledgeUpdateSettings  update_settings = {} 
)
inline

Constructor.

Parameters
contextthe ThreadSafeContext that will be updated
settingsthe CheckpointSettings that will be used to load data
update_settingsthe settings that will be used when updating context

Definition at line 128 of file CheckpointPlayer.h.

◆ CheckpointPlayer() [2/4]

madara::knowledge::CheckpointPlayer::CheckpointPlayer ( ThreadSafeContext context,
CheckpointReader  reader,
KnowledgeUpdateSettings  update_settings = {} 
)
inline

Constructor from CheckpointReader.

Parameters
contextthe ThreadSafeContext that will be updated
readerthe CheckpointReader that will be used to load data
update_settingsthe settings that will be used when updating context

Definition at line 144 of file CheckpointPlayer.h.

◆ ~CheckpointPlayer()

madara::knowledge::CheckpointPlayer::~CheckpointPlayer ( )
inline

Definition at line 153 of file CheckpointPlayer.h.

◆ CheckpointPlayer() [3/4]

madara::knowledge::CheckpointPlayer::CheckpointPlayer ( const CheckpointPlayer )
delete

◆ CheckpointPlayer() [4/4]

madara::knowledge::CheckpointPlayer::CheckpointPlayer ( CheckpointPlayer &&  )
delete

Member Function Documentation

◆ init_reader()

void madara::knowledge::CheckpointPlayer::init_reader ( )
inlineprivate

Definition at line 203 of file CheckpointPlayer.h.

◆ operator=() [1/2]

CheckpointPlayer& madara::knowledge::CheckpointPlayer::operator= ( CheckpointPlayer &&  )
delete

◆ operator=() [2/2]

CheckpointPlayer& madara::knowledge::CheckpointPlayer::operator= ( const CheckpointPlayer )
delete

◆ play_until()

bool madara::knowledge::CheckpointPlayer::play_until ( uint64_t  target_toi)

Loads values from checkpoint until it reaches or exceeds toi given.

Do not call while playback is active. Call before calling start().

Returns
true if target_toi is reached before hitting end of checkpoint. false otherwise.

Definition at line 499 of file CheckpointPlayer.cpp.

◆ start()

void madara::knowledge::CheckpointPlayer::start ( )
inline

Start playback.

If settings.playback_simtime is set, and macro MADARA_FEATURE_SIMTIME is set, current simtime will be set to the TOI of the first record. Rate of playback is equal to the simtime rate, which can be modified during playback.

Definition at line 171 of file CheckpointPlayer.h.

◆ stop()

void madara::knowledge::CheckpointPlayer::stop ( )
inline

Stop playback, killing the playback thread.

Definition at line 181 of file CheckpointPlayer.h.

◆ thread_main()

void madara::knowledge::CheckpointPlayer::thread_main ( CheckpointPlayer self)
staticprivate

Definition at line 451 of file CheckpointPlayer.cpp.

Member Data Documentation

◆ context_

ThreadSafeContext* madara::knowledge::CheckpointPlayer::context_
private

Definition at line 211 of file CheckpointPlayer.h.

◆ keep_running_

std::atomic_flag madara::knowledge::CheckpointPlayer::keep_running_
private

Definition at line 215 of file CheckpointPlayer.h.

◆ reader_

std::unique_ptr<CheckpointReader> madara::knowledge::CheckpointPlayer::reader_
private

Definition at line 217 of file CheckpointPlayer.h.

◆ settings_

CheckpointSettings madara::knowledge::CheckpointPlayer::settings_
private

Definition at line 212 of file CheckpointPlayer.h.

◆ thread_

std::thread madara::knowledge::CheckpointPlayer::thread_
private

Definition at line 216 of file CheckpointPlayer.h.

◆ update_settings_

KnowledgeUpdateSettings madara::knowledge::CheckpointPlayer::update_settings_
private

Definition at line 213 of file CheckpointPlayer.h.


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