goptions
GSwitch Class Reference

Represents a switch with a description and a status. More...

#include <gswitch.h>

Collaboration diagram for GSwitch:
Collaboration graph

Public Member Functions

 GSwitch ()=default
 Default constructor. More...
 
 GSwitch (const std::string &d)
 Parameterized constructor. More...
 
void turnOn ()
 Turns the switch on. More...
 
void turnOff ()
 Turns the switch off. More...
 
bool getStatus () const
 Retrieves the current status of the switch. More...
 
const std::string & getDescription () const
 Retrieves the description of the switch. More...
 

Detailed Description

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 14 of file gswitch.h.

Constructor & Destructor Documentation

◆ GSwitch() [1/2]

GSwitch::GSwitch ( )
default

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
dThe description of the switch.

Definition at line 33 of file gswitch.h.

Member Function Documentation

◆ getDescription()

const std::string& GSwitch::getDescription ( ) const
inline
Returns
A const reference to the switch's description.

Definition at line 61 of file gswitch.h.

◆ getStatus()

bool GSwitch::getStatus ( ) const
inline
Returns
true if the switch is on, false otherwise.

Definition at line 54 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 47 of file gswitch.h.

◆ turnOn()

void GSwitch::turnOn ( )
inline

Sets the switch's status to true, indicating that the switch is on.

Definition at line 40 of file gswitch.h.


The documentation for this class was generated from the following file: