sudo apt-get marks
 
Loading...
Searching...
No Matches
Energy Class Reference

Singleton class representing energy resources in the city. More...

#include <Resources.h>

Inheritance diagram for Energy:
Resources

Public Member Functions

 Energy (const Energy &)=delete
 
void operator= (const Energy &)=delete
 
int getWattsCoal () const
 Gets the amount of energy generated from coal.
 
int getWattsHydro () const
 Gets the amount of energy generated from hydro.
 
int getWattsWind () const
 Gets the amount of energy generated from wind.
 
int getWattsSolar () const
 Gets the amount of energy generated from solar.
 
int getTotalWatts () const
 Gets the total amount of energy generated.
 
void setWattsCoal (int value)
 Sets the amount of energy generated from coal.
 
void setWattsHydro (int value)
 Sets the amount of energy generated from hydro.
 
void setWattsWind (int value)
 Sets the amount of energy generated from wind.
 
void setWattsSolar (int value)
 Sets the amount of energy generated from solar.
 
void setTotalWatts (int value)
 Sets the total amount of energy generated.
 
- Public Member Functions inherited from Resources
 Resources ()
 Default constructor for Resources.
 

Static Public Member Functions

static EnergygetInstance ()
 Gets the singleton instance of the Energy class.
 

Detailed Description

Singleton class representing energy resources in the city.

The Energy class manages different types of energy sources such as coal, hydro, wind, and solar. It provides access to their wattage values and follows the Singleton design pattern to ensure that only one instance of this class exists throughout the application.

Member Function Documentation

◆ getInstance()

Energy * Energy::getInstance ( )
static

Gets the singleton instance of the Energy class.

Returns
A pointer to the singleton Energy instance.

This method checks if an instance of the Energy class already exists; if not, it creates one and returns it. This guarantees that there is only one instance of Energy throughout the application.

◆ getTotalWatts()

int Energy::getTotalWatts ( ) const
inline

Gets the total amount of energy generated.

Returns
The total energy generated (in watts).

◆ getWattsCoal()

int Energy::getWattsCoal ( ) const
inline

Gets the amount of energy generated from coal.

Returns
The amount of energy from coal (in watts).

◆ getWattsHydro()

int Energy::getWattsHydro ( ) const
inline

Gets the amount of energy generated from hydro.

Returns
The amount of energy from hydro (in watts).

◆ getWattsSolar()

int Energy::getWattsSolar ( ) const
inline

Gets the amount of energy generated from solar.

Returns
The amount of energy from solar (in watts).

◆ getWattsWind()

int Energy::getWattsWind ( ) const
inline

Gets the amount of energy generated from wind.

Returns
The amount of energy from wind (in watts).

◆ setTotalWatts()

void Energy::setTotalWatts ( int value)
inline

Sets the total amount of energy generated.

Parameters
valueThe total energy to set (in watts).

◆ setWattsCoal()

void Energy::setWattsCoal ( int value)
inline

Sets the amount of energy generated from coal.

Parameters
valueThe amount of energy to set (in watts).

◆ setWattsHydro()

void Energy::setWattsHydro ( int value)
inline

Sets the amount of energy generated from hydro.

Parameters
valueThe amount of energy to set (in watts).

◆ setWattsSolar()

void Energy::setWattsSolar ( int value)
inline

Sets the amount of energy generated from solar.

Parameters
valueThe amount of energy to set (in watts).

◆ setWattsWind()

void Energy::setWattsWind ( int value)
inline

Sets the amount of energy generated from wind.

Parameters
valueThe amount of energy to set (in watts).