-
Notifications
You must be signed in to change notification settings - Fork 0
/
IBox.hpp
134 lines (110 loc) · 3.62 KB
/
IBox.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include "includes.hpp"
#include "defines.hpp"
namespace Geometry
{
//interface class, wich gave properties to hyper-dimensional box objects
class ITopology
{
//an interface class has no implementation
//it contaions only a virtual destructor and pure virtual functions
public:
virtual ~ITopology() = default;
//even pure virtual functions must know ther argument list
virtual void SetDimensions(const size_t &) = 0;
virtual size_t GetDimensions() = 0;
};
//length of each dimension
//vector with all og them
//set function with for loop for their length
class NBox: public ITopology
{
public:
NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n NBox Constructor called.\n\033[0m";
// std::cout << "\n\n NBox Constructor called.\n";
#endif
}; //need implemntation
virtual ~NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n NBox Destructor called.\n\033[0m";
// std::cout << "\n\n NBox Destructor called.\n";
#endif
m_nbox_lengths.clear();
};
virtual void SetDimensions( const size_t &dimension )
{
m_nbox_dimensions = dimension;
}
virtual size_t GetDimensions()
{
return m_nbox_dimensions;
}
//vector<double> with lengths
virtual void SetLengthOfAllDimensions( const std::vector<double> &lengths )
{
m_nbox_lengths = lengths;
}
virtual std::vector<double>* GetSizeOfAllDimensions()
{
return &m_nbox_lengths;
}
//pure virtual, wich will be derivated and described,
//used to show polymorphism
virtual void ShowName() = 0;
//CalculateVolume
protected:
size_t m_nbox_dimensions;
std::vector<double> m_nbox_lengths;
};
class ThreeDimensionalBox: public NBox
{
public:
ThreeDimensionalBox():NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n ThreeDimensionalBox Constructor called.\n\033[0m";
//std::cout << "\n\n ThreeDimensionalBox Constructor called.\n";
#endif
this->SetDimensions( THREE );
};
~ThreeDimensionalBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n ThreeDimensionalBox Constructor called.\n\033[0m";
//std::cout << "\n\n ThreeDimensionalBox Destructor called.\n";
#endif
};
virtual void ShowName()
{
std::cout << "\033[0;36m\n3D box\n\033[0m";
//std::cout << "\n3D box\n";
}
};
class FourDimensionalBox: public NBox
{
public:
FourDimensionalBox():NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n FourDimensionalBox Constructor called.\n\033[0m";
//std::cout << "\n\n FourDimensionalBox Constructor called.\n";
#endif
this->SetDimensions( FOUR );
};
~FourDimensionalBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n FourDimensionalBox Destructor called\n\033[0m";
//std::cout << "\n\n FourDimensionalBox Destructor called.\n";
#endif
};
virtual void ShowName()
{
std::cout << "\033[0;35m\n4D box\n\033[0m";
//std::cout << "\n4D box\n";
}
};
};//end of namespace Geometry