goptions
gswitch.h
Go to the documentation of this file.
1 #ifndef GSWITCH_H
2 #define GSWITCH_H 1
3 
4 #include <string>
5 
14 class GSwitch {
15 
16 public:
17 
24  GSwitch() = default;
25 
33  GSwitch(const std::string &d) : description(d), status(false) {}
34 
40  void turnOn() { status = true; }
41 
47  void turnOff() { status = false; }
48 
54  bool getStatus() const { return status; }
55 
61  const std::string &getDescription() const { return description; }
62 
63 private:
67  std::string description;
68 
75  bool status{false};
76 
77 };
78 
79 #endif
Represents a switch with a description and a status.
Definition: gswitch.h:14
void turnOn()
Turns the switch on.
Definition: gswitch.h:40
const std::string & getDescription() const
Retrieves the description of the switch.
Definition: gswitch.h:61
void turnOff()
Turns the switch off.
Definition: gswitch.h:47
GSwitch(const std::string &d)
Parameterized constructor.
Definition: gswitch.h:33
bool getStatus() const
Retrieves the current status of the switch.
Definition: gswitch.h:54
GSwitch()=default
Default constructor.