You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.3 KiB
69 lines
1.3 KiB
#include "Ware.h"
|
|
|
|
Ware::Ware(){ ++count; }
|
|
Ware::~Ware() { --count; }
|
|
|
|
Ware::Ware(std::string name, bool hasCooling, double width, double height) {
|
|
this->name = name;
|
|
this->hasCooling = hasCooling;
|
|
this->size = { width, height };
|
|
|
|
if(hasCooling) {
|
|
this->type = CoolingWare;
|
|
} else if(isLargeWare(this->size)) {
|
|
this->type = LargeWare;
|
|
} else {
|
|
this->type = DefaultWare;
|
|
}
|
|
count++;
|
|
this->id = this->generateId();
|
|
}
|
|
|
|
Id Ware::getId() const {
|
|
return id;
|
|
}
|
|
|
|
void Ware::setId(const Id id) {
|
|
this->id = id;
|
|
}
|
|
|
|
Ware::WareType Ware::getType() const {
|
|
return type;
|
|
}
|
|
|
|
void Ware::setType(const WareType type) {
|
|
this->type = type;
|
|
}
|
|
|
|
bool Ware::getHasCooling() const {
|
|
return hasCooling;
|
|
}
|
|
|
|
void Ware::setHasCooling(const bool hasCooling) {
|
|
this->hasCooling = hasCooling;
|
|
}
|
|
|
|
std::string Ware::getName() const {
|
|
return name;
|
|
}
|
|
|
|
void Ware::setName(const std::string name) {
|
|
this->name = name;
|
|
}
|
|
|
|
Ware::Size Ware::getSize() const {
|
|
return size;
|
|
}
|
|
|
|
void Ware::setSize(const double width, const double height) {
|
|
this->size = Size{ width, height };
|
|
}
|
|
|
|
bool Ware::isLargeWare(Size s) {
|
|
return (s.width > 20.0 || s.height > 20.0);
|
|
}
|
|
|
|
Id Ware::generateId() {
|
|
//billige id generation da keine reference benutzt
|
|
return (uint64_t) &this->name;
|
|
}
|