Represents a two-dimensional size with non-negative width and height.
More...
#include <peak_common/types/geometry/peak_common_size.hpp>
|
| constexpr | SizeT ()=default |
| | Default constructor for SizeT.
|
| template<typename H = T> |
| constexpr | SizeT (T width, T height) |
| | Constructs a SizeT object from integral width and height.
|
| template<typename H = T> |
| constexpr | SizeT (T width, T height) |
| | Constructs a SizeT object from floating-point width and height.
|
| constexpr T | GetWidth () const |
| | Returns the width.
|
| constexpr T | GetHeight () const |
| | Returns the height.
|
| constexpr SizeT< T > | Transposed () const |
| | Returns a transposed size with width and height swapped.
|
| template<typename H> |
| constexpr bool | operator== (const SizeT< H > &rhs) const |
| | Equality operator for integral types.
|
| template<typename H> |
| constexpr bool | operator== (const SizeT< H > &rhs) const |
| | Equality operator for floating point types.
|
| template<typename H> |
| constexpr bool | operator!= (const SizeT< H > &rhs) const |
| | Inequality operator.
|
| std::string | ToString () const |
| | Convert the SizeT instance to a string representation.
|
|
| std::ostream & | operator<< (std::ostream &os, SizeT size) |
| | Stream operator to output SizeT in a readable format.
|
template<typename T>
class peak::common::detail::SizeT< T >
Represents a two-dimensional size with non-negative width and height.
A SizeT stores the width and height of an object or area. Both dimensions must be greater than or equal to zero.
- Template Parameters
-
| T | Arithmetic type used for width and height. |
- Since
- ids_peak_common 1.0
◆ SizeT() [1/3]
Default constructor for SizeT.
Initializes a size with default values for width and height.
- Since
- ids_peak_common 1.0
◆ SizeT() [2/3]
template<typename T>
template<typename H = T>
| SizeT |
( |
T | width, |
|
|
T | height ) |
|
inlineconstexpr |
Constructs a SizeT object from integral width and height.
Initializes the size with the specified width and height values.
- Parameters
-
| width | Width of the size. |
| height | Height of the size. |
- Since
- ids_peak_common 1.0
◆ SizeT() [3/3]
template<typename T>
template<typename H = T>
| SizeT |
( |
T | width, |
|
|
T | height ) |
|
inlineconstexpr |
Constructs a SizeT object from floating-point width and height.
Initializes the size with the specified width and height values. Throws an exception if either value is negative.
- Parameters
-
| width | Width of the size. |
| height | Height of the size. |
- Exceptions
-
- Since
- ids_peak_common 1.0
◆ GetHeight()
Returns the height.
- Returns
- The height value.
- Since
- ids_peak_common 1.0
◆ GetWidth()
Returns the width.
- Returns
- The width value.
- Since
- ids_peak_common 1.0
◆ operator!=()
template<typename T>
template<typename H>
| bool operator!= |
( |
const SizeT< H > & | rhs | ) |
const |
|
inlineconstexpr |
Inequality operator.
Returns true if the sizes are not equal.
- Parameters
-
| rhs | The SizeT object to compare against. |
- Returns
- true if sizes are different; false otherwise.
- Since
- ids_peak_common 1.0
◆ operator==() [1/2]
template<typename T>
template<typename H>
| bool operator== |
( |
const SizeT< H > & | rhs | ) |
const |
|
inlineconstexpr |
Equality operator for integral types.
Compares width and height for exact equality.
- Parameters
-
| rhs | The SizeT object to compare against. |
- Returns
- true if both width and height are equal; false otherwise.
- Since
- ids_peak_common 1.0
◆ operator==() [2/2]
template<typename T>
template<typename H>
| bool operator== |
( |
const SizeT< H > & | rhs | ) |
const |
|
inlineconstexpr |
Equality operator for floating point types.
Compares width and height using a tolerance based on ULP (Units in Last Place).
- Parameters
-
| rhs | The SizeT object to compare against. |
- Returns
- true if both width and height are approximately equal within tolerance; false otherwise.
- Since
- ids_peak_common 1.0
◆ ToString()
template<typename T>
| std::string ToString |
( |
| ) |
const |
|
inline |
Convert the SizeT instance to a string representation.
Outputs width and height in the form: { width: ..., height: ... }
- Returns
- String representation of the size
- Since
- ids_peak_common 1.0
◆ Transposed()
template<typename T>
| SizeT< T > Transposed |
( |
| ) |
const |
|
inlineconstexpr |
Returns a transposed size with width and height swapped.
- Returns
- A new SizeT object with width and height swapped.
- Since
- ids_peak_common 1.0
◆ operator<<
template<typename T>
| std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
SizeT< T > | size ) |
|
friend |
Stream operator to output SizeT in a readable format.
Outputs width and height in the form: { width: ..., height: ... }
- Parameters
-
| os | Output stream |
| size | SizeT instance to output |
- Returns
- Reference to the output stream
- Since
- ids_peak_common 1.0
The documentation for this class was generated from the following file: