1#ifndef SCIFIR_UNITS_SPECIAL_UNITS_SIZE_3D_HPP_INCLUDED
2#define SCIFIR_UNITS_SPECIAL_UNITS_SIZE_3D_HPP_INCLUDED
4#include "../derived_units/space_units.hpp"
5#include "../util/types.hpp"
7#include "boost/algorithm/string.hpp"
15 template<
typename T = length>
49 width = std::move(x.width);
50 height = std::move(x.height);
51 depth = std::move(x.depth);
109 boost::split(widths,
init_size_3d,boost::is_any_of(
"*"));
110 if (widths.size() == 3)
112 boost::trim(widths[0]);
113 boost::trim(widths[1]);
114 boost::trim(widths[2]);
156 width = std::move(x.width);
157 height = std::move(x.height);
158 depth = std::move(x.depth);
212 boost::split(widths,
init_size_3d,boost::is_any_of(
"*"));
213 if (widths.size() == 3)
215 boost::trim(widths[0]);
216 boost::trim(widths[1]);
217 boost::trim(widths[2]);
231 string to_string(
const size_3d<float>& x);
237 if (x.width == y.width and x.height == y.height and x.depth == y.depth)
263 return !(x == init_size_3d);
276 return !(init_size_3d == x);
288 return x + to_string(y);
294 return to_string(x) + y;
300 return os << to_string(x);
Class that allows to create scalar units, which are composed of a value (as a float) and dimensions....
string display() const
Returns a string representation of size_3d<float>, with his width, height and depth.
float depth
Depth, stored as a float. The advantage related to size_3d<float> over size_3d<T> is that it sizes le...
size_3d(const float &new_width, const float &new_height, const float &new_depth)
Constructor. width is new_width, height is new_height and depth is new_depth.
size_3d()
Default constructor. Initializes width, height and depth to 0.
size_3d(const size_3d< float > &x)
Copy constructor. The width, height and depth are copied from the size_3d<float> x.
float height
Height, stored as a float. The advantage related to size_3d<float> over size_3d<T> is that it sizes l...
void initialize_from_string(const string &init_size_3d)
Internal function. Initializes the member-variables with an initialization string of size_3d<float>.
size_3d(size_3d< float > &&x)
Move constructor. The width, height and depth are moved from the size_3d<float> x.
size_3d(const string &init_size_3d)
Constructor. The member-variables are initialized by the initialization string init_size_3d specializ...
float width
Width, stored as a float. The advantage related to size_3d<float> over size_3d<T> is that it sizes le...
size_3d(const string &new_width, const string &new_height, const string &new_depth)
Constructor. width is new_width, height is new_height and depth is new_depth, they are initialized by...
float get_volume() const
Calculates the volume as the multiplication of the width, height and depth.
Class that allows to store and calculate size in 3D, with width, height and depth....
size_3d(const scalar_unit &new_width, const scalar_unit &new_height, const scalar_unit &new_depth)
size_3d(const string &init_size_3d)
Constructor. The member-variables are initialized by the initialization string init_size_3d.
T width
Width, usually stored as length.
scalar_unit get_volume() const
Calculates the volume as the multiplication of the width, height and depth.
size_3d(const string &new_width, const string &new_height, const string &new_depth)
Constructor. width is new_width, height is new_height and depth is new_depth, they are initialized by...
string display() const
Returns a string representation of size_3d<T>, with his width, height and depth.
T depth
Depth, usually stored as length.
size_3d(size_3d< T > &&x)
Move constructor. The width, height and depth are moved from the size_3d<T> x.
size_3d()
Default constructor. Both width, height and depth are initialized to 0, with the dimensions to the de...
size_3d(const size_3d< T > &x)
Copy constructor. The width, height and depth are copied from the size_3d<T> x.
void initialize_from_string(const string &init_size_3d)
Internal function. Initializes the member-variables with an initialization string of size_3d<T>.
void operator-=(const size_3d< U > &x)
Substracts the width of size_3d<T> x to the width, substracts the height of size_3d<T> x to the heigh...
size_3d< T > operator-(const size_3d< U > &x) const
Creates a new size_3d<T> by the difference of two size_3d<T> classes. The width, height and depth are...
size_3d< T > & operator=(const size_3d< T > &x)
Copy assignment. The width, height and depth are copied from the size_3d<T> x.
size_3d< T > operator+(const size_3d< U > &x) const
Creates a new size_3d<T> by the addition of two size_3d<T> classes. The width, height and depth are t...
T height
Height, usually stored as length.
void operator+=(const size_3d< U > &x)
Sums the width of size_3d<T> x to the width, sums the height of size_3d<T> x to the height and sums t...
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
string display_float(const float &value, int number_of_decimals)
string operator+(const string &x, const scifir::size_3d< T > &y)
Creates a new string as the concatenation of the string x with the string representation of size_3d<T...
void operator+=(string &x, const scifir::size_3d< T > &y)
Concatenates the string x with the string representation of size_3d<T> y.
bool operator!=(const scifir::size_3d< T > &x, const scifir::size_3d< T > &y)
Returns true if the width, height and depth of x and y are any of them different.
istream & operator>>(istream &is, scifir::size_3d< T > &x)
Allows that an istream initializes by string a size_3d<T> x.
ostream & operator<<(ostream &os, const scifir::size_3d< T > &x)
Adds the string representation of the size_3d<T> x to an output stream os.
bool operator==(const scifir::size_3d< T > &x, const scifir::size_3d< T > &y)
Returns true if the width, height and depth of x and y are both equal.