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

Represents the overall growth and management of the city. More...

#include <CityGrowth.h>

Inheritance diagram for CityGrowth:
CitySector

Public Member Functions

 CityGrowth ()
 Default constructor for CityGrowth.
 
 ~CityGrowth ()
 Destructor for CityGrowth.
 
void addSector ()
 Adds a new sector to the city growth management.
 
void addSector (CitySector *sector)
 Adds an existing sector to the city growth management.
 
bool addBuilding (Building *building, int sectorId)
 Adds a building to a specified sector.
 
int getTotalBuildingCount ()
 Gets the total count of buildings across all sectors.
 
int getTotalSectorCount ()
 Gets the total count of sectors in the city.
 
std::vector< CitySector * > getSectors ()
 Gets a vector of pointers to the sectors in the city.
 
std::string printSectors ()
 Prints information about all sectors in the city.
 
void printSectorsCitizens (int sectorID)
 Prints the citizens in a specified sector.
 
void setRoads (RoadSystemAdapter *rs)
 Sets the road system for the city.
 
- Public Member Functions inherited from CitySector
 ~CitySector ()
 Destructor for CitySector.
 
void addBuilding (Building *building)
 Adds a building to the city sector.
 
int getBuildingCount ()
 Gets the count of buildings in the sector.
 
const std::vector< Building * > & getBuildings () const
 Gets a constant reference to the vector of buildings in the sector.
 
std::vector< Building * > getBlock ()
 Gets a vector representing the block of buildings.
 

Detailed Description

Represents the overall growth and management of the city.

The CityGrowth class inherits from CitySector and manages multiple city sectors. It handles the addition of sectors and buildings, tracks total building and sector counts, and manages city infrastructure such as roads.

Member Function Documentation

◆ addBuilding()

bool CityGrowth::addBuilding ( Building * building,
int sectorId )

Adds a building to a specified sector.

Parameters
buildingA pointer to the Building object to be added.
sectorIdThe identifier of the sector where the building should be added.
Returns
True if the building was successfully added, false otherwise.

◆ addSector()

void CityGrowth::addSector ( CitySector * sector)

Adds an existing sector to the city growth management.

Parameters
sectorA pointer to the CitySector object to be added.

◆ getSectors()

std::vector< CitySector * > CityGrowth::getSectors ( )

Gets a vector of pointers to the sectors in the city.

Returns
A vector containing pointers to CitySector objects.

◆ getTotalBuildingCount()

int CityGrowth::getTotalBuildingCount ( )

Gets the total count of buildings across all sectors.

Returns
The total number of buildings in the city.

◆ getTotalSectorCount()

int CityGrowth::getTotalSectorCount ( )

Gets the total count of sectors in the city.

Returns
The total number of sectors.

◆ printSectors()

std::string CityGrowth::printSectors ( )

Prints information about all sectors in the city.

Returns
A string containing information about the sectors.

◆ printSectorsCitizens()

void CityGrowth::printSectorsCitizens ( int sectorID)

Prints the citizens in a specified sector.

Parameters
sectorIDThe identifier of the sector whose citizens will be printed.

◆ setRoads()

void CityGrowth::setRoads ( RoadSystemAdapter * rs)

Sets the road system for the city.

Parameters
rsA pointer to a RoadSystemAdapter object representing the road system.