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

3 years ago
3 years ago
3 years ago
3 years ago
  1. #include "Ware.h"
  2. Ware::Ware(){ ++count; }
  3. Ware::~Ware() { --count; }
  4. Ware::Ware(std::string name, bool hasCooling, double width, double height) {
  5. this->name = name;
  6. this->hasCooling = hasCooling;
  7. this->size = { width, height };
  8. if(hasCooling) {
  9. this->type = WareType::CoolingWare;
  10. } else if(isLargeWare(this->size)) {
  11. this->type = WareType::LargeWare;
  12. } else {
  13. this->type = WareType::DefaultWare;
  14. }
  15. count++;
  16. this->id = this->generateId();
  17. }
  18. Id Ware::getId() const {
  19. return id;
  20. }
  21. void Ware::setId(const Id id) {
  22. this->id = id;
  23. }
  24. Ware::WareType Ware::getType() const {
  25. return type;
  26. }
  27. void Ware::setType(const WareType type) {
  28. this->type = type;
  29. }
  30. bool Ware::getHasCooling() const {
  31. return hasCooling;
  32. }
  33. void Ware::setHasCooling(const bool hasCooling) {
  34. this->hasCooling = hasCooling;
  35. }
  36. std::string Ware::getName() const {
  37. return name;
  38. }
  39. void Ware::setName(const std::string name) {
  40. this->name = name;
  41. }
  42. Ware::Size Ware::getSize() const {
  43. return size;
  44. }
  45. void Ware::setSize(const double width, const double height) {
  46. this->size = Size{ width, height };
  47. }
  48. bool Ware::isLargeWare(Size s) {
  49. return (s.width > 20.0 || s.height > 20.0);
  50. }
  51. Id Ware::generateId() {
  52. //billige id generation da keine reference benutzt
  53. return (uint64_t) &this->name;
  54. }