scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
|
Specialization class of size_2d<T> that allows to store and calculate size in 2D, with width and height as float types. Initialization string example: "1 * 2". More...
#include <size_2d.hpp>
Public Member Functions | |
size_2d () | |
Default constructor. Initializes width and height to 0. | |
size_2d (const size_2d< float > &x) | |
Copy constructor. The width and height are copied from the size_2d<float> x. | |
size_2d (size_2d< float > &&x) | |
Move constructor. The width and height are moved from the size_2d<float> x. | |
size_2d (const float &new_width, const float &new_height) | |
Constructor. width is new_width and height is new_height. | |
size_2d (const string &new_width, const string &new_height) | |
Constructor. width is new_width and height is new_height, they are initialized by string. | |
size_2d (const string &init_size_2d) | |
Constructor. The member-variables are initialized by the initialization string init_size_2d specialized for float. | |
size_2d< float > & | operator= (const size_2d< float > &x) |
Copy assignment. The width and height are copied from the size_2d<float> x. | |
size_2d< float > & | operator= (size_2d< float > &&x) |
Move assignment. The width and height are moved from the size_2d<float> x. | |
size_2d< float > & | operator= (const string &init_size_2d) |
Assignment. The member-variables are initialized by the initialization string init_size_2d specialized for float. | |
size_2d< float > | operator+ (const size_2d< float > &x) const |
Creates a new size_2d<float> by the addition of two size_2d<float> classes. The width is the result of the addition of the two width of the size_2d<float> classes and the height the result of the addition of the two height of the size_2d<float> classes. | |
size_2d< float > | operator- (const size_2d< float > &x) const |
Creates a new size_2d<float> by the difference of two size_2d<float> classes. The width is the result of the difference of the two width of the size_2d<float> classes and the height the result of the difference of the two height of the size_2d<float> classes. | |
void | operator+= (const size_2d< float > &x) |
Sums the width of size_2d<float> x to the width and sums the height of size_2d<float> x to the height. | |
void | operator-= (const size_2d< float > &x) |
Substracts the width of size_2d<float> x to the width and substracts the height of size_2d<float> x to the height. | |
float | get_area () const |
Calculates the area as the multiplication of the width and height. | |
string | display () const |
Returns a string representation of size_2d<float>, with his width and height. | |
Public Attributes | |
float | width |
Width, stored as a float. The advantage related to size_2d<float> over size_2d<T> is that it sizes less, the disadvantage is the lack of dimensions. | |
float | height |
Height, stored as a float. The advantage related to size_2d<float> over size_2d<T> is that it sizes less, the disadvantage is the lack of dimensions. | |
Private Member Functions | |
void | initialize_from_string (const string &init_size_2d) |
Internal function. Initializes the member-variables with an initialization string of size_2d<float>. | |
Specialization class of size_2d<T> that allows to store and calculate size in 2D, with width and height as float types. Initialization string example: "1 * 2".
Definition at line 116 of file size_2d.hpp.
|
inline |
Default constructor. Initializes width and height to 0.
Definition at line 119 of file size_2d.hpp.
|
inline |
Copy constructor. The width and height are copied from the size_2d<float> x.
Definition at line 122 of file size_2d.hpp.
|
inline |
Move constructor. The width and height are moved from the size_2d<float> x.
Definition at line 125 of file size_2d.hpp.
|
inlineexplicit |
Constructor. width is new_width and height is new_height.
Definition at line 128 of file size_2d.hpp.
|
inlineexplicit |
Constructor. width is new_width and height is new_height, they are initialized by string.
Definition at line 131 of file size_2d.hpp.
|
inlineexplicit |
Constructor. The member-variables are initialized by the initialization string init_size_2d specialized for float.
Definition at line 134 of file size_2d.hpp.
|
inline |
Returns a string representation of size_2d<float>, with his width and height.
Definition at line 186 of file size_2d.hpp.
|
inline |
Calculates the area as the multiplication of the width and height.
Definition at line 181 of file size_2d.hpp.
|
inlineprivate |
Internal function. Initializes the member-variables with an initialization string of size_2d<float>.
Definition at line 197 of file size_2d.hpp.
Creates a new size_2d<float> by the addition of two size_2d<float> classes. The width is the result of the addition of the two width of the size_2d<float> classes and the height the result of the addition of the two height of the size_2d<float> classes.
Definition at line 159 of file size_2d.hpp.
Sums the width of size_2d<float> x to the width and sums the height of size_2d<float> x to the height.
Definition at line 169 of file size_2d.hpp.
Creates a new size_2d<float> by the difference of two size_2d<float> classes. The width is the result of the difference of the two width of the size_2d<float> classes and the height the result of the difference of the two height of the size_2d<float> classes.
Definition at line 164 of file size_2d.hpp.
Substracts the width of size_2d<float> x to the width and substracts the height of size_2d<float> x to the height.
Definition at line 175 of file size_2d.hpp.
Copy assignment. The width and height are copied from the size_2d<float> x.
Definition at line 139 of file size_2d.hpp.
Assignment. The member-variables are initialized by the initialization string init_size_2d specialized for float.
Definition at line 153 of file size_2d.hpp.
Move assignment. The width and height are moved from the size_2d<float> x.
Definition at line 146 of file size_2d.hpp.
float scifir::size_2d< float >::height |
Height, stored as a float. The advantage related to size_2d<float> over size_2d<T> is that it sizes less, the disadvantage is the lack of dimensions.
Definition at line 194 of file size_2d.hpp.
float scifir::size_2d< float >::width |
Width, stored as a float. The advantage related to size_2d<float> over size_2d<T> is that it sizes less, the disadvantage is the lack of dimensions.
Definition at line 193 of file size_2d.hpp.