sudo apt-get marks
 
Loading...
Searching...
No Matches
PowerPlant Class Referenceabstract

Abstract class representing a power plant. More...

#include <Utilities.h>

Inheritance diagram for PowerPlant:
Utility FunctionalPowerPlant NonFunctionalPowerPlant

Public Member Functions

 PowerPlant (powerPlants type, bool isbuilt, int powerGen=0)
 Constructs a PowerPlant object.
 
 ~PowerPlant ()
 Destructor for PowerPlant.
 
virtual PowerPlantrepair ()=0
 Repairs the power plant.
 
virtual PowerPlantmulfunction ()=0
 Indicates a malfunction in the power plant.
 
int getPowerGeneration ()
 Gets the effective power generation.
 
powerPlants getType ()
 Gets the type of power plant.
 
void generate ()
 Generates power.
 
int getPowerGenerationRaw () const
 Gets the raw power generation value.
 
powerPlants getType () const
 Gets the type of power plant.
 
void setPowerGeneration (int value)
 Sets the power generation capacity.
 
void setType (powerPlants value)
 Sets the type of power plant.
 
- Public Member Functions inherited from Utility
 Utility ()
 Constructor for Utility.
 
 ~Utility ()
 Destructor for Utility.
 
float getEfficiency () const
 Gets the efficiency of the utility.
 
void setEfficiency (float value)
 Sets the efficiency of the utility.
 
bool getFunctional () const
 Checks if the utility is functional.
 
void setFunctional (bool value)
 Sets the functional status of the utility.
 

Protected Attributes

int powerGeneration
 Power generation capacity in watts.
 
powerPlants type
 Type of power plant.
 
Energyenergy
 Pointer to energy resources.
 
bool isInitialBuild = false
 Indicates if it is an initial build.
 
- Protected Attributes inherited from Utility
float efficiency
 Efficiency of the utility service (percentage).
 
Budgetbudget
 Pointer to the budget for the utility.
 
Concreteconcrete
 Pointer to concrete resources.
 
Steelsteel
 Pointer to steel resources.
 
Woodwood
 Pointer to wood resources.
 
bool isFunctional
 Indicates whether the utility is functional.
 

Detailed Description

Abstract class representing a power plant.

This class includes attributes for power generation and type of power plant.

Constructor & Destructor Documentation

◆ PowerPlant()

PowerPlant::PowerPlant ( powerPlants type,
bool isbuilt,
int powerGen = 0 )

Constructs a PowerPlant object.

Parameters
typeThe type of power plant.
isbuiltIndicates if the power plant is built.
powerGenInitial power generation capacity.

Member Function Documentation

◆ getPowerGeneration()

int PowerPlant::getPowerGeneration ( )

Gets the effective power generation.

Returns
Effective power generation based on efficiency.

◆ getPowerGenerationRaw()

int PowerPlant::getPowerGenerationRaw ( ) const
inline

Gets the raw power generation value.

Returns
The raw power generation capacity.

◆ getType() [1/2]

powerPlants PowerPlant::getType ( )

Gets the type of power plant.

Returns
The type of power plant.

◆ getType() [2/2]

powerPlants PowerPlant::getType ( ) const
inline

Gets the type of power plant.

Returns
The type of the power plant.

◆ mulfunction()

virtual PowerPlant * PowerPlant::mulfunction ( )
pure virtual

Indicates a malfunction in the power plant.

Returns
Pointer to the malfunctioning PowerPlant.

Implemented in FunctionalPowerPlant, and NonFunctionalPowerPlant.

◆ repair()

virtual PowerPlant * PowerPlant::repair ( )
pure virtual

Repairs the power plant.

Returns
Pointer to the repaired PowerPlant.

Implemented in FunctionalPowerPlant, and NonFunctionalPowerPlant.

◆ setPowerGeneration()

void PowerPlant::setPowerGeneration ( int value)
inline

Sets the power generation capacity.

Parameters
valuePower generation value to set.

◆ setType()

void PowerPlant::setType ( powerPlants value)
inline

Sets the type of power plant.

Parameters
valueThe type of power plant to set.