-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOn.cpp
More file actions
36 lines (30 loc) · 680 Bytes
/
On.cpp
File metadata and controls
36 lines (30 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//////////////////////////////////////////
// Workfile : On.cpp
// Author : Michael Enzelsberger
// Date : 09.01.2021
// Description : Concrete On Command.
//////////////////////////////////////////
#include "On.h"
using namespace std;
On::On(Device::SPtr const& device)
{
//check nullpointer
if (device == nullptr)
{
throw string("null pointer in CTOR Off");
}
//store device
mDevice = device;
}
void On::Execute()
{
//store current state as previous state
mPrevState = mDevice->GetState();
//overwrite current state
mDevice->SetState(TStatePower::eOn);
}
void On::Undo() const
{
//overwrite current state with previous state
mDevice->SetState(mPrevState);
}