33 lines
872 B
C++
33 lines
872 B
C++
#include "Community.h"
|
|
|
|
std::string Community::name() const {
|
|
return Name;
|
|
}
|
|
|
|
void Community::set_name(const std::string& name) {
|
|
Name = name;
|
|
}
|
|
|
|
std::vector<std::unique_ptr<Building::Base>>& Community::buildings() {
|
|
return Buildings;
|
|
}
|
|
|
|
// Use move semantics for efficiency
|
|
void Community::set_buildings(std::vector<std::unique_ptr<Building::Base>> buildings) {
|
|
Buildings = std::move(buildings);
|
|
}
|
|
|
|
Energy_Tariff Community::energy_tariff() const {
|
|
return energy_Tariff;
|
|
}
|
|
|
|
void Community::set_energy_tariff(const Energy_Tariff& energy_tariff) {
|
|
energy_Tariff = energy_tariff;
|
|
}
|
|
|
|
void Community::iterateCommunities(std::vector<std::shared_ptr<Community>> &communities,
|
|
const std::function<void(std::shared_ptr<Community>&)> &function) {
|
|
for (auto &community : communities) {
|
|
function(community);
|
|
}
|
|
} |