This repository was archived by the owner on May 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevice.cpp
More file actions
61 lines (55 loc) · 1.45 KB
/
Copy pathDevice.cpp
File metadata and controls
61 lines (55 loc) · 1.45 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <string>
#include "Device.h"
Device::Device(int id, const std::string& deviceName, const std::string& deviceManufacturer, bool status = false) {
setId(id);
setDeviceName(deviceName);
setManufacturer(deviceManufacturer);
setStatus(status);
}
//setter and getter definition for m_id
void Device::setId(int id) {
m_id = id;
}
int Device::getId() const {
return m_id;
}
//setter and getter definition for m_device
void Device::setDeviceName(const std::string& deviceName) {
m_deviceName = deviceName;
}
std::string Device::getDeviceName() const {
return m_deviceName;
}
//setter and getter definition for m_manufacturer
void Device::setManufacturer(const std::string& manufacturer) {
m_manufacturer = manufacturer;
}
std::string Device::getManufacturer() const {
return m_manufacturer;
}
//setter and getter definition for m_status (bool)
void Device::setStatus(bool status) {
m_status = status;
}
bool Device::getStatus() const {
return m_status;
}
void Device::activate() {
if (m_status == false) { //device is not active
m_status = true;
std::cout << m_deviceName << " has been activated!" << std::endl;
}
else {
std::cout << m_deviceName << " is already active!" << std::endl;
}
}
void Device::deactivate() {
if (m_status == true) { //device is active
m_status = false;
std::cout << m_deviceName << " has been deactivated!" << std::endl;
}
else {
std::cout << m_deviceName << " is already deactivated!" << std::endl;
}
}