CVB++ 14.0
Size2D< T, ENABLE > Class Template Referencefinal

Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle. More...

#include <cvb/size_2d.hpp>

Public Member Functions

 Size2D () noexcept=default
 Creates a default, empty size. More...
 
 Size2D (T width, T height) noexcept
 Creates a size with a given width and height. More...
 
T Width () const noexcept
 Gets the horizontal component of the size. More...
 
void SetWidth (T width) noexcept
 Sets the horizontal component of the size. More...
 
T Height () const noexcept
 Gets the vertical component of the size. More...
 
void SetHeight (T height) noexcept
 Sets the vertical component of the size. More...
 
bool operator== (const Size2D< T > &size) const noexcept
 Compares to an other size. More...
 
bool operator!= (const Size2D< T > &size) const noexcept
 Compares to an other size. More...
 
template<class C >
 operator Size2D< C > () const noexcept
 Enable casting.
 

Detailed Description

template<class T, class ENABLE = void>
class Cvb::Size2D< T, ENABLE >

Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle.

Template Parameters
TThe type of the numbers which is an integer or a floating-point number.
Examples
ShapeFinder2/QtShapeFinder2.

Constructor & Destructor Documentation

◆ Size2D() [1/2]

Size2D ( )
defaultnoexcept

Creates a default, empty size.

Exceptions
Doesnot throw any exception.

◆ Size2D() [2/2]

Size2D ( T  width,
T  height 
)
inlinenoexcept

Creates a size with a given width and height.

Parameters
[in]widthHorizontal component of the size.
[in]heightVertical component of the size.
Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ Height()

T Height ( ) const
inlinenoexcept

Gets the vertical component of the size.

Returns
The vertical component.
Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const Size2D< T > &  size) const
inlinenoexcept

Compares to an other size.

Parameters
[in]sizeOther size.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator==()

bool operator== ( const Size2D< T > &  size) const
inlinenoexcept

Compares to an other size.

Parameters
[in]sizeOther size.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ SetHeight()

void SetHeight ( T  height)
inlinenoexcept

Sets the vertical component of the size.

Parameters
[in]heightThe vertical component.
Exceptions
Doesnot throw any exception.

◆ SetWidth()

void SetWidth ( T  width)
inlinenoexcept

Sets the horizontal component of the size.

Parameters
[in]widthThe horizontal component.
Exceptions
Doesnot throw any exception.

◆ Width()

T Width ( ) const
inlinenoexcept

Gets the horizontal component of the size.

Returns
The horizontal component.
Exceptions
Doesnot throw any exception.