-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFactory.hpp
64 lines (50 loc) · 1.62 KB
/
Factory.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include <vector>
#include "Product.hpp"
class Factory
{
private:
int ProductsPerHour = 0;
char FactoryName = '?';
char ProductName = '?';
int ProductWeight = 0;
WrapperType ProductWrapper = WrapperType::Cardboard;
public:
const char GetFactoryName() const
{
return FactoryName;
}
const int GetProductsPerHour() const
{
return ProductsPerHour;
}
const int GetProductsWeight() const
{
return ProductWeight;
}
Factory& operator=(const Factory&) = delete;
Factory(const Factory&) = delete;
Factory() = delete;
Factory(int NewProductsPerHour, char NewFactoryName, char NewProductName, int NewProductWeight, WrapperType NewWrapperType) :
ProductsPerHour(NewProductsPerHour), FactoryName(NewFactoryName), ProductName(NewProductName), ProductWeight(NewProductWeight),
ProductWrapper(NewWrapperType)
{
}
friend std::ostream& operator<<(std::ostream& os, const Factory& factory)
{
os << "Name: " << factory.FactoryName << " Products per hour: " << factory.ProductsPerHour << " Product name: " << factory.ProductName <<
" Product weight: " << factory.ProductWeight << " Product wrapper: " << factory.ProductWrapper;
return os;
}
void Produce(std::vector<Product>& Result) const
{
for (int i = 0; i < ProductsPerHour; ++i)
{
Product NewProduct;
NewProduct.Name = ProductName;
NewProduct.Weight = ProductWeight;
NewProduct.Wrapper = ProductWrapper;
Result.push_back(NewProduct);
}
}
};