|
resonance 1.0.1
|
Time base a scheduler measures its due times against, and the base class of Sch::TickClock. More...
#include <timeclock.h>


Public Member Functions | |
| TimeClock (Scheduler *pWatchdog) | |
| void | SetOrigin (long long nNanoseconds) |
| Fix the origin of the time base. | |
| long long | Now () |
| Report the current time. | |
| void | Pause () |
| Stop the time base at its current reading. | |
| void | Resume () |
| Restart the time base from the reading Pause() stopped it at. | |
| void | Post (Sch::Command *pCommand, Sch::Time tick, CmdID &id, int bRecordable, int bDelta) |
| Queue a command, choosing between the absolute and the delta path. | |
| void | Withdraw (const CmdID &id) |
| Withdraw the first wrapper queued under a handle. | |
| void | PostIn (Sch::Command *pCommand, Sch::Time tick, CmdID &id, int bRecordable) |
| Queue a command a distance from now, under a handle the caller retains. | |
| void | PostIn (Sch::Command *pCommand, Sch::Time tick) |
| Queue a command a distance from now, discarding the handle. | |
Public Attributes | |
| long long | mNegatedOrigin |
| The origin, negated, in nanoseconds. | |
| long long | mPausedNs |
| The reading Now() reports while no origin is set, in nanoseconds. | |
| int | mHasOrigin |
| Non-zero while the time base runs against the scheduler. | |
| Scheduler * | mWatchdog |
| The scheduler whose current time the readings follow. | |
Time base a scheduler measures its due times against, and the base class of Sch::TickClock.
The class is not polymorphic and has no RTTI, and no literal in the retail images identifies it. Its name comes from the debugging symbols of the North American demo release. The demo's constructor and destructor have the same instructions as this class's. This 0x18-byte object is the base of Sch::TickClock, and the bodies at 0x004a7828, 0x004a7848, 0x004a7878, and 0x004a77c0 are single bodies shared between the two.
The origin is stored negated and may be set only once, so a second SetOrigin() is ignored. Every member is public, because Sch::TickClock reads each one directly and the image has no accessor.
| Sch::TimeClock::TimeClock | ( | Scheduler * | pWatchdog | ) |
| pWatchdog | The scheduler these readings belong to. |
| void Sch::TimeClock::SetOrigin | ( | long long | nNanoseconds | ) |
Fix the origin of the time base.
The first call wins. Every later call is ignored.
| nNanoseconds | The reading to treat as zero. |
| long long Sch::TimeClock::Now | ( | ) |
Report the current time.
Before an origin is set the reading is mPausedNs. Afterwards it is the scheduler's most recent due tick relative to the origin.
| void Sch::TimeClock::Pause | ( | ) |
Stop the time base at its current reading.
Clears mHasOrigin and stores the reading Now() would have reported in mPausedNs. Now() reports mPausedNs from then on. Does nothing while mHasOrigin is already clear. GrooveWorld::StopLevel() at 0x0018ec90 calls it on the song clock. The title is inferred.
| void Sch::TimeClock::Resume | ( | ) |
Restart the time base from the reading Pause() stopped it at.
Sets mHasOrigin and stores the origin that makes Now() continue from mPausedNs. Does nothing while mHasOrigin is already set. GrooveWorld::StartPlay() calls it on the song clock. The title is inferred.
| void Sch::TimeClock::Post | ( | Sch::Command * | pCommand, |
| Sch::Time | tick, | ||
| CmdID & | id, | ||
| int | bRecordable, | ||
| int | bDelta ) |
Queue a command, choosing between the absolute and the delta path.
A non-zero bDelta takes the delta path, which resolves the due tick against the later of the scheduler's current time and its clock. A zero bDelta takes the absolute path, which subtracts this clock's origin instead and passes a zero recordable flag. Two facts place it on this class rather than on Sch::TickClock. The body reads only mNegatedOrigin and mWatchdog, and TimeTask posts through it on the plain timer that Globals::InitServices() builds.
| pCommand | The command to run. |
| tick | The tick the caller requests. |
| id | The handle to queue under, allocated when it is still -2. |
| bRecordable | Non-zero for a post the recorded stream is to include. Recording writes such a post out and playback suppresses it, because the stream supplies it instead. |
| bDelta | Non-zero to treat tick as a distance from now. |
| void Sch::TimeClock::Withdraw | ( | const CmdID & | id | ) |
Withdraw the first wrapper queued under a handle.
Forwards a copy of the handle to Scheduler::WithdrawByCmdID(). The body reads only mWatchdog.
| id | The handle to withdraw. |
| void Sch::TimeClock::PostIn | ( | Sch::Command * | pCommand, |
| Sch::Time | tick, | ||
| CmdID & | id, | ||
| int | bRecordable ) |
Queue a command a distance from now, under a handle the caller retains.
The body reads only mWatchdog, which is what places it on this class rather than on Sch::TickClock. GameRecorder::ScheduleEnd() calls it on the plain Sch::TimeClock that Globals creates.
| pCommand | The command to run. |
| tick | The distance from now. |
| id | The handle to queue under. |
| bRecordable | Non-zero for a post the recorded stream is to include. |
| void Sch::TimeClock::PostIn | ( | Sch::Command * | pCommand, |
| Sch::Time | tick ) |
Queue a command a distance from now, discarding the handle.
The body reads only mWatchdog, as the keyed overload does.
| pCommand | The command to run. |
| tick | The distance from now. |
| long long Sch::TimeClock::mNegatedOrigin |
The origin, negated, in nanoseconds.
Sch::TickClock::PostAt() and both PostAtSongTick() overloads subtract it to express a due time in the scheduler's frame.
| long long Sch::TimeClock::mPausedNs |
The reading Now() reports while no origin is set, in nanoseconds.
Sch::TickClock::SetSongTick() writes it.
| int Sch::TimeClock::mHasOrigin |
Non-zero while the time base runs against the scheduler.
| Scheduler* Sch::TimeClock::mWatchdog |
The scheduler whose current time the readings follow.
Sch::TickClock::PostAt() and both PostAtSongTick() overloads queue through it.