Represents a switch with a description and a status.
More...
#include <gswitch.h>
|
| GSwitch ()=default |
| Default constructor.
|
|
| GSwitch (const std::string &d) |
| Parameterized constructor.
|
|
void | turnOn () |
| Turns the switch on.
|
|
void | turnOff () |
| Turns the switch off.
|
|
bool | getStatus () const |
| Retrieves the current status of the switch.
|
|
const std::string & | getDescription () const |
| Retrieves the description of the switch.
|
|
The GSwitch
class encapsulates a switch's description and its status, allowing the switch to be turned on or off, and providing methods to query its current state.
Definition at line 13 of file gswitch.h.
◆ GSwitch() [1/2]
Constructs an empty GSwitch
object. This constructor is necessary for the GSwitch
to be used in containers like unordered_map<std::string, GSwitch>
.
◆ GSwitch() [2/2]
GSwitch::GSwitch |
( |
const std::string & | d | ) |
|
|
inline |
Initializes the switch with a description and sets its status to false
.
- Parameters
-
d | The description of the switch. |
Definition at line 32 of file gswitch.h.
◆ getDescription()
const std::string & GSwitch::getDescription |
( |
| ) |
const |
|
inline |
- Returns
- A
const
reference to the switch's description.
Definition at line 60 of file gswitch.h.
◆ getStatus()
bool GSwitch::getStatus |
( |
| ) |
const |
|
inline |
- Returns
true
if the switch is on, false
otherwise.
Definition at line 53 of file gswitch.h.
◆ turnOff()
void GSwitch::turnOff |
( |
| ) |
|
|
inline |
Sets the switch's status to false
, indicating that the switch is off.
Definition at line 46 of file gswitch.h.
◆ turnOn()
Sets the switch's status to true
, indicating that the switch is on.
Definition at line 39 of file gswitch.h.
The documentation for this class was generated from the following file: