openMSX
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
openmsx::Schedulable Class Referenceabstract

Every class that wants to get scheduled at some point must inherit from this class. More...

#include <Schedulable.hh>

Inheritance diagram for openmsx::Schedulable:
Inheritance graph
[legend]

Public Member Functions

 Schedulable (const Schedulable &)=delete
 
 Schedulable (Schedulable &&)=delete
 
Schedulableoperator= (const Schedulable &)=delete
 
Schedulableoperator= (Schedulable &&)=delete
 
virtual void executeUntil (EmuTime::param time)=0
 When the previously registered syncPoint is reached, this method gets called.
 
virtual void schedulerDeleted ()
 Just before the the Scheduler is deleted, it calls this method of all the Schedulables that are still registered.
 
SchedulergetScheduler () const
 
EmuTime::param getCurrentTime () const
 Convenience method: This is the same as getScheduler().getCurrentTime().
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 

Static Public Member Functions

template<typename Archive >
static std::vector< SyncPointBWserializeBW (Archive &ar)
 
template<typename Archive >
static void restoreOld (Archive &ar, std::vector< Schedulable * > schedulables)
 

Protected Member Functions

 Schedulable (Scheduler &scheduler)
 
 ~Schedulable ()
 
void setSyncPoint (EmuTime::param timestamp)
 
bool removeSyncPoint ()
 
void removeSyncPoints ()
 
bool pendingSyncPoint () const
 
bool pendingSyncPoint (EmuTime &result) const
 

Detailed Description

Every class that wants to get scheduled at some point must inherit from this class.

Definition at line 33 of file Schedulable.hh.

Constructor & Destructor Documentation

◆ Schedulable() [1/3]

openmsx::Schedulable::Schedulable ( const Schedulable )
delete

◆ Schedulable() [2/3]

openmsx::Schedulable::Schedulable ( Schedulable &&  )
delete

◆ Schedulable() [3/3]

openmsx::Schedulable::Schedulable ( Scheduler scheduler)
explicitprotected

Definition at line 7 of file Schedulable.cc.

◆ ~Schedulable()

openmsx::Schedulable::~Schedulable ( )
protected

Definition at line 12 of file Schedulable.cc.

References removeSyncPoints().

Member Function Documentation

◆ executeUntil()

virtual void openmsx::Schedulable::executeUntil ( EmuTime::param  time)
pure virtual

When the previously registered syncPoint is reached, this method gets called.

◆ getCurrentTime()

EmuTime::param openmsx::Schedulable::getCurrentTime ( ) const

◆ getScheduler()

Scheduler & openmsx::Schedulable::getScheduler ( ) const
inline

Definition at line 60 of file Schedulable.hh.

◆ operator=() [1/2]

Schedulable & openmsx::Schedulable::operator= ( const Schedulable )
delete

◆ operator=() [2/2]

Schedulable & openmsx::Schedulable::operator= ( Schedulable &&  )
delete

◆ pendingSyncPoint() [1/2]

bool openmsx::Schedulable::pendingSyncPoint ( ) const
protected

Definition at line 38 of file Schedulable.cc.

◆ pendingSyncPoint() [2/2]

bool openmsx::Schedulable::pendingSyncPoint ( EmuTime &  result) const
protected

Definition at line 44 of file Schedulable.cc.

◆ removeSyncPoint()

bool openmsx::Schedulable::removeSyncPoint ( )
protected

◆ removeSyncPoints()

void openmsx::Schedulable::removeSyncPoints ( )
protected

Definition at line 33 of file Schedulable.cc.

Referenced by openmsx::EventDelay::flush(), serialize(), and ~Schedulable().

◆ restoreOld()

template<typename Archive >
static void openmsx::Schedulable::restoreOld ( Archive &  ar,
std::vector< Schedulable * >  schedulables 
)
inlinestatic

◆ schedulerDeleted()

void openmsx::Schedulable::schedulerDeleted ( )
virtual

Just before the the Scheduler is deleted, it calls this method of all the Schedulables that are still registered.

If you override this method you should unregister this Schedulable in the implementation. The default implementation just prints a diagnostic (and soon after the Scheduler will trigger an assert that there are still registered Schedulables. Normally there are easier ways to unregister a Schedulable. ATM this method is only used in AfterCommand (because it's not part of the MSX machine).

Definition at line 17 of file Schedulable.cc.

◆ serialize()

template<typename Archive >
void openmsx::Schedulable::serialize ( Archive &  ar,
unsigned  version 
)

Definition at line 55 of file Schedulable.cc.

References removeSyncPoints(), and setSyncPoint().

◆ serializeBW()

template<typename Archive >
static std::vector< SyncPointBW > openmsx::Schedulable::serializeBW ( Archive &  ar)
inlinestatic

Definition at line 70 of file Schedulable.hh.

Referenced by restoreOld(), and openmsx::WD2793::serialize().

◆ setSyncPoint()

void openmsx::Schedulable::setSyncPoint ( EmuTime::param  timestamp)
protected

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