GfSize2 Class Reference

Two-dimensional array of sizes. More...

Public Member Functions

 GfSize2 ()
 Default constructor initializes components to zero. More...
 
 GfSize2 (const GfSize2 &o)
 Copy constructor. More...
 
 GfSize2 (const GfVec2i &o)
 Conversion from GfVec2i. More...
 
 GfSize2 (const size_t v[2])
 Construct from an array. More...
 
 GfSize2 (size_t v0, size_t v1)
 Construct from two values. More...
 
GfSize2Set (const size_t v[2])
 Set to the values in a given array. More...
 
GfSize2Set (size_t v0, size_t v1)
 Set to values passed directly. More...
 
size_t & operator [] (size_t i)
 Array operator. More...
 
const size_t & operator [] (size_t i) const
 Const array operator. More...
 
bool operator== (const GfSize2 &v) const
 Component-wise equality. More...
 
bool operator != (const GfSize2 &v) const
 Component-wise inequality. More...
 
GfSize2operator+= (const GfSize2 &v)
 Component-wise in-place addition. More...
 
GfSize2operator -= (const GfSize2 &v)
 Component-wise in-place subtraction. More...
 
GfSize2operator *= (GfSize2 const &v)
 Component-wise in-place multiplication. More...
 
GfSize2operator *= (int d)
 Component-wise in-place multiplication by a scalar. More...
 
GfSize2operator/= (int d)
 Component-wise in-place division by a scalar. More...
 
 operator GfVec2i () const
 Conversion to GfVec2i. More...
 

Friends

GfSize2 operator+ (const GfSize2 &v1, const GfSize2 &v2)
 Component-wise addition. More...
 
GfSize2 operator - (const GfSize2 &v1, const GfSize2 &v2)
 Component-wise subtraction. More...
 
GfSize2 operator * (const GfSize2 &v1, const GfSize2 &v2)
 Component-wise multiplication. More...
 
GfSize2 operator * (const GfSize2 &v1, int s)
 Component-wise multiplication by a scalar. More...
 
GfSize2 operator * (int s, const GfSize2 &v1)
 Component-wise multiplication by a scalar. More...
 
GfSize2 operator/ (const GfSize2 &v1, int s)
 Component-wise division by a scalar. More...
 
GF_API friend std::ostream & operator<< (std::ostream &o, GfSize2 const &v)
 Output operator. More...
 

Detailed Description

Two-dimensional array of sizes.

GfSize2 is used to represent pairs of counts. It is based on the datatype size_t, and thus can only represent non-negative values in each dimension. If you need to represent negative numbers as well, use GfVec2i.

Usage of GfSize2 is similar to that of GfVec2i, except that all mathematical operations are componentwise (including multiplication).

Definition at line 51 of file size2.h.

Constructor & Destructor Documentation

◆ GfSize2() [1/5]

GfSize2 ( )
inline

Default constructor initializes components to zero.

Definition at line 54 of file size2.h.

◆ GfSize2() [2/5]

GfSize2 ( const GfSize2 o)
inline

Copy constructor.

Definition at line 59 of file size2.h.

◆ GfSize2() [3/5]

GfSize2 ( const GfVec2i o)
inlineexplicit

Conversion from GfVec2i.

Definition at line 64 of file size2.h.

◆ GfSize2() [4/5]

GfSize2 ( const size_t  v[2])
inline

Construct from an array.

Definition at line 69 of file size2.h.

◆ GfSize2() [5/5]

GfSize2 ( size_t  v0,
size_t  v1 
)
inline

Construct from two values.

Definition at line 74 of file size2.h.

Member Function Documentation

◆ operator !=()

bool operator != ( const GfSize2 v) const
inline

Component-wise inequality.

Definition at line 108 of file size2.h.

◆ operator *=() [1/2]

GfSize2& operator *= ( GfSize2 const &  v)
inline

Component-wise in-place multiplication.

Definition at line 127 of file size2.h.

◆ operator *=() [2/2]

GfSize2& operator *= ( int  d)
inline

Component-wise in-place multiplication by a scalar.

Definition at line 134 of file size2.h.

◆ operator -=()

GfSize2& operator -= ( const GfSize2 v)
inline

Component-wise in-place subtraction.

Definition at line 120 of file size2.h.

◆ operator []() [1/2]

size_t& operator [] ( size_t  i)
inline

Array operator.

Definition at line 93 of file size2.h.

◆ operator []() [2/2]

const size_t& operator [] ( size_t  i) const
inline

Const array operator.

Definition at line 98 of file size2.h.

◆ operator GfVec2i()

operator GfVec2i ( ) const
inline

Conversion to GfVec2i.

Definition at line 188 of file size2.h.

◆ operator+=()

GfSize2& operator+= ( const GfSize2 v)
inline

Component-wise in-place addition.

Definition at line 113 of file size2.h.

◆ operator/=()

GfSize2& operator/= ( int  d)
inline

Component-wise in-place division by a scalar.

Definition at line 141 of file size2.h.

◆ operator==()

bool operator== ( const GfSize2 v) const
inline

Component-wise equality.

Definition at line 103 of file size2.h.

◆ Set() [1/2]

GfSize2& Set ( const size_t  v[2])
inline

Set to the values in a given array.

Definition at line 79 of file size2.h.

◆ Set() [2/2]

GfSize2& Set ( size_t  v0,
size_t  v1 
)
inline

Set to values passed directly.

Definition at line 86 of file size2.h.

Friends And Related Function Documentation

◆ operator * [1/3]

GfSize2 operator * ( const GfSize2 v1,
const GfSize2 v2 
)
friend

Component-wise multiplication.

Definition at line 160 of file size2.h.

◆ operator * [2/3]

GfSize2 operator * ( const GfSize2 v1,
int  s 
)
friend

Component-wise multiplication by a scalar.

Definition at line 166 of file size2.h.

◆ operator * [3/3]

GfSize2 operator * ( int  s,
const GfSize2 v1 
)
friend

Component-wise multiplication by a scalar.

Definition at line 172 of file size2.h.

◆ operator -

GfSize2 operator - ( const GfSize2 v1,
const GfSize2 v2 
)
friend

Component-wise subtraction.

Definition at line 154 of file size2.h.

◆ operator+

GfSize2 operator+ ( const GfSize2 v1,
const GfSize2 v2 
)
friend

Component-wise addition.

Definition at line 148 of file size2.h.

◆ operator/

GfSize2 operator/ ( const GfSize2 v1,
int  s 
)
friend

Component-wise division by a scalar.

Definition at line 178 of file size2.h.

◆ operator<<

GF_API friend std::ostream& operator<< ( std::ostream &  o,
GfSize2 const &  v 
)
friend

Output operator.


The documentation for this class was generated from the following file: