wavelength 1.0.0
Loading...
Searching...
No Matches
command.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/attachment.h"
4#include "os/binstream.h"
5
13class Command : public Attachment {
14public:
21 ~Command() override;
22
24 virtual void Execute() = 0;
25
35 virtual bool IsSerializable() {
36 return false;
37 }
38
48 virtual int GetSerialId() {
49 return 0;
50 }
51
59 virtual void Save([[maybe_unused]] BinStream &stream) const {
60 }
61
69 virtual void Load([[maybe_unused]] BinStream &stream) {
70 }
71};
Attachment()
Construct an object with no reference.
Definition attachment.h:23
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Unit of work a Scheduler runs at a set time.
Definition command.h:13
virtual void Execute()=0
Do the work.
virtual void Save(BinStream &stream) const
Write the command to a recording.
Definition command.h:59
virtual void Load(BinStream &stream)
Read the command Save() writes.
Definition command.h:69
virtual bool IsSerializable()
Report whether a recording saves the command.
Definition command.h:35
virtual int GetSerialId()
Report the identifier a recording rebuilds the command by.
Definition command.h:48
~Command() override
Release the command.