EMAN2
Public Member Functions | Private Attributes | List of all members
EMAN::IntSize Class Reference

IntSize is used to describe a 1D, 2D or 3D rectangular size in integers. More...

#include <geometry.h>

Public Member Functions

 IntSize (int xx=0, int yy=0, int zz=0)
 Construct an IntSize object. More...
 
int get_ndim () const
 Get its dimension, 1D, 2D, or 3D. More...
 
int operator[] (int i) const
 Get the ith direction's size. More...
 
int & operator[] (int i)
 Get the ith direction's size. More...
 

Private Attributes

int data [3]
 

Detailed Description

IntSize is used to describe a 1D, 2D or 3D rectangular size in integers.

Definition at line 48 of file geometry.h.

Constructor & Destructor Documentation

◆ IntSize()

EMAN::IntSize::IntSize ( int  xx = 0,
int  yy = 0,
int  zz = 0 
)
inlineexplicit

Construct an IntSize object.

Parameters
xxThe x direction size. Default is 0.
yyThe y direction size. Default is 0.
zzThe z direction size. Default is 0.

Definition at line 57 of file geometry.h.

58 {
59 data[0] = xx;
60 data[1] = yy;
61 data[2] = zz;
62 }
int data[3]
Definition: geometry.h:98

References data.

Member Function Documentation

◆ get_ndim()

int EMAN::IntSize::get_ndim ( ) const
inline

Get its dimension, 1D, 2D, or 3D.

Returns
The dimension.

Definition at line 68 of file geometry.h.

69 {
70 if (data[2] > 1) {
71 return 3;
72 }
73 else if (data[1] > 1) {
74 return 2;
75 }
76 return 1;
77 }

References data.

◆ operator[]() [1/2]

int & EMAN::IntSize::operator[] ( int  i)
inline

Get the ith direction's size.

Used as a lvalue.

Parameters
iThe ith direction, with 0 is x, 1 is y, 2 is z.
Returns
The ith direction's size.

Definition at line 92 of file geometry.h.

93 {
94 return data[i];
95 }

References data.

◆ operator[]() [2/2]

int EMAN::IntSize::operator[] ( int  i) const
inline

Get the ith direction's size.

Used as a rvalue.

Parameters
iThe ith direction, with 0 is x, 1 is y, 2 is z.
Returns
The ith direction's size.

Definition at line 83 of file geometry.h.

84 {
85 return data[i];
86 }

References data.

Member Data Documentation

◆ data

int EMAN::IntSize::data[3]
private

Definition at line 98 of file geometry.h.

Referenced by get_ndim(), IntSize(), and operator[]().


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