resonance 1.0.1
Loading...
Searching...
No Matches
timedcommand.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5#include "app/attachment.h"
6#include "sch/cmdid.h"
7#include "sch/time.h"
8
9namespace Sch {
10class Command;
11}
12class IBStream;
13class OBStream;
14
15namespace Sch {
16
46class TimedCommand : public Attachment {
47public:
68 TimedCommand(Command *pCommand, Time tick, int bDelta);
69
77 }
78
85 virtual ~TimedCommand();
86
96 void Run();
97
105 void Print(std::ostream &stream);
106
114 void Save(OBStream &stream);
115
125 void Load(IBStream &stream);
126
137
154
166
179
180private:
181 // Non-zero when the requested tick is a distance from now rather than an absolute scheduler
182 // time. Print() writes " delta" for a non-zero value and " abs" for zero, and
183 // TimeClock::Post() at 0x004a7924 branches on the same argument to choose between the two
184 // queueing paths. Save() writes only the low byte. No code outside this class reads it. +0x20
185 int mDelta;
186
187public:
198};
199
200} // namespace Sch
Attachment()
Definition attachment.h:26
Input half of the byte stream interface.
Definition ibstream.h:36
Output half of the byte stream interface.
Definition obstream.h:25
Handle that identifies one batch of commands the scheduler has queued.
Definition cmdid.h:35
Base of every action the scheduler performs on behalf of another subsystem.
Definition command.h:60
Scheduler time, as a signed 64-bit count.
Definition time.h:44
int mOrder
Order among the wrappers that share one due tick.
Definition timedcommand.h:153
void Run()
Run the wrapped command.
void Save(OBStream &stream)
Write the wrapper and the command it refers to.
virtual ~TimedCommand()
Give back the reference to the command and release the wrapper.
Time mLocalTick
The tick the caller requested, in the caller's own clock frame.
Definition timedcommand.h:178
Command * mCommand
The command to run, or null.
Definition timedcommand.h:136
TimedCommand(Command *pCommand, Time tick, int bDelta)
Wrap a command, taking a reference to it.
void Load(IBStream &stream)
Read the wrapper and the command it refers to back.
CmdID mCmdID
Handle the queueing request was made under.
Definition timedcommand.h:197
void Print(std::ostream &stream)
Write a description of the wrapper to a diagnostic stream.
Time mDueTick
Scheduler time the command is to run at.
Definition timedcommand.h:165
TimedCommand()
Construct an empty wrapper for Load() to fill.
Definition timedcommand.h:76
Scheduling of timed commands.
Definition activefilter.h:9