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
 
Schedulableoperator= (const Schedulable &)=delete
 
virtual void executeUntil (EmuTime::param time)=0
 When the previously registered syncPoint is reached, this method gets called. More...
 
virtual void schedulerDeleted ()
 Just before the the Scheduler is deleted, it calls this method of all the Schedulables that are still registered. More...
 
SchedulergetScheduler () const
 
EmuTime::param getCurrentTime () const
 Convenience method: This is the same as getScheduler().getCurrentTime(). More...
 
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/2]

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

◆ Schedulable() [2/2]

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.

Implemented in openmsx::I8251::SyncTrans, and openmsx::I8251::SyncRecv.

Referenced by openmsx::Scheduler::getCurrentTime().

◆ getCurrentTime()

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

◆ getScheduler()

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

Definition at line 58 of file Schedulable.hh.

References openmsx::SyncPointBW::serialize().

◆ operator=()

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

◆ pendingSyncPoint() [1/2]

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

Definition at line 38 of file Schedulable.cc.

References openmsx::EmuTime::dummy().

Referenced by openmsx::WD2793::peekDataReg().

◆ 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

◆ 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 regsitered 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 68 of file Schedulable.hh.

Referenced by openmsx::WD2793::serialize().

◆ setSyncPoint()

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

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