LTL  2.0.x
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
util::Region Class Reference

To represent geometries or subarrays of N-dimensional arrays. More...

Public Member Functions

 Region (const size_t N)
 Construct an N dimensional Region. More...
 
 Region (const Region &other)
 Construct as copy from other. More...
 
 Region (const string &s, const size_t N)
 Construct as N dimensional Region from input string with format start_1:end_1,...,start_N:end_N. More...
 
 ~Region ()
 
size_t getDim () const
 Return number of dimensions. More...
 
int getStart (const size_t i) const throw (UException)
 Return start coordinate of dimension i. More...
 
int getEnd (const size_t i) const throw (UException)
 Return end coordinate of dimension i. More...
 
size_t getLength () const throw (UException)
 Return size of Region. More...
 
size_t getLength (const size_t i) const throw (UException)
 Return length along dimension i. More...
 
Region getSlice (const size_t startdim, const size_t enddim) const throw (UException)
 Return a (rand reduced) slice of Region. More...
 
void setStart (const size_t i, const int x) throw (UException)
 Set start coordinate of dimension i to x. More...
 
void setEnd (const size_t i, const int x) throw (UException)
 Set end coordinate of dimension i to x. More...
 
void setRange (const size_t i, const int s, const int e) throw (UException)
 Set range of dimension i to start at s and end at e. More...
 
void setRegion (const Region &region) throw (UException)
 Copy settings from region. More...
 
string toString () const
 Parse Region to a string with format start_1:end_1,...,start_N:end_N. More...
 

Protected Attributes

const size_t N_
 Number of dimensions. More...
 
int *const start_
 Pointer to array with start coordinates. More...
 
int *const end_
 Pointer to array with end coordinates. More...
 

Static Protected Attributes

static const string error_get_dim
 Error message for invalid dimension requests. More...
 
static const string error_set_dim
 Error message for invalid dimension requests. More...
 

Detailed Description

To represent geometries or subarrays of N-dimensional arrays.

A utility class to allow an easy selection of regions within N-dimensional arrays. Used for Interfacing with command line, config file and FITS I/O.

Exceptions
UExceptionon request of illegal (i.e. > N or < 0) dimensions.

Constructor & Destructor Documentation

util::Region::Region ( const size_t  N)

Construct an N dimensional Region.

util::Region::Region ( const Region other)

Construct as copy from other.

util::Region::Region ( const string &  s,
const size_t  N 
)

Construct as N dimensional Region from input string with format start_1:end_1,...,start_N:end_N.

util::Region::~Region ( )
inline

References start_.

Member Function Documentation

size_t util::Region::getDim ( ) const
inline

Return number of dimensions.

References N_.

int util::Region::getStart ( const size_t  i) const
throw (UException
)

Return start coordinate of dimension i.

Referenced by ltl::getMArrayRegion().

int util::Region::getEnd ( const size_t  i) const
throw (UException
)

Return end coordinate of dimension i.

Referenced by ltl::getMArrayRegion().

size_t util::Region::getLength ( ) const
throw (UException
)

Return size of Region.

Referenced by ltl::getMArrayRegion().

size_t util::Region::getLength ( const size_t  i) const
throw (UException
)

Return length along dimension i.

Region util::Region::getSlice ( const size_t  startdim,
const size_t  enddim 
) const
throw (UException
)

Return a (rand reduced) slice of Region.

void util::Region::setStart ( const size_t  i,
const int  x 
)
throw (UException
)

Set start coordinate of dimension i to x.

void util::Region::setEnd ( const size_t  i,
const int  x 
)
throw (UException
)

Set end coordinate of dimension i to x.

void util::Region::setRange ( const size_t  i,
const int  s,
const int  e 
)
throw (UException
)

Set range of dimension i to start at s and end at e.

Referenced by ltl::insertFitsMArray().

void util::Region::setRegion ( const Region region)
throw (UException
)

Copy settings from region.

string util::Region::toString ( ) const

Parse Region to a string with format start_1:end_1,...,start_N:end_N.

Member Data Documentation

const size_t util::Region::N_
protected

Number of dimensions.

Referenced by getDim().

int* const util::Region::start_
protected

Pointer to array with start coordinates.

Referenced by ~Region().

int* const util::Region::end_
protected

Pointer to array with end coordinates.

const string util::Region::error_get_dim
staticprotected

Error message for invalid dimension requests.

const string util::Region::error_set_dim
staticprotected

Error message for invalid dimension requests.