Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qgar::GenMask2d< T > Class Template Reference
[Masks]

#include <qgarlib/GenMask2d.H>

List of all members.


Detailed Description

template<class T>
class qgar::GenMask2d< T >

Generic 2D mask with coefficients of type T.

Warning:
A mask is stored as consecutive rows im memory space. The top-left corner of the mask has coordinates (0,0).
Author:
Gérald Masini
Date:
Apr 11, 2003 15:17
Since:
Qgar 2.1

Definition at line 63 of file GenMask2d.H.

Public Types

Types related to 2D masks
typedef T value_type
 Type of the mask coefficients.
typedef value_typereference
 Reference to qgar::GenMask2d::value_type.
typedef const value_typeconst_reference
 Constant reference to qgar::GenMask2d::value_type.
typedef value_typepointer
 Pointer to qgar::GenMask2d::value_type.
typedef const value_typeconst_pointer
 Constant pointer to qgar::GenMask2d::value_type.

Public Member Functions

Constructors
 GenMask2d ()
 Default constructor: Set 0 to mask width and height, to pointer to the coefficient map, and to reference counter.
 GenMask2d (const GenMask2d< value_type > &aMask)
 Copy constructor.
 GenMask2d (unsigned int aWidth, unsigned int aHeight, value_type aValue=static_cast< value_type >(0))
 Initialize with given width, height and value.
 GenMask2d (unsigned int aWidth, unsigned int aHeight, const_pointer const valArray)
 Builds a mask from an array of values.
Destructor
 ~GenMask2d ()
 Non-virtual destructor.
Access to mask characteristics
int width () const
 Get mask width.
int height () const
 Get mask height.
Access to coefficient values
value_type coeff (int aX, int aY) const
 Get a coefficient value.
Access to direct transformations of the coefficient map
pointer pCoeffMap () const
 Get the pointer to the coefficient map.
Transformation
void setCoeff (int aX, int aY, value_type aCoeff)
 Set coefficient at given position.
Copy
GenMask2d< value_typeshallowCopy ()
 Shallow copy: The coefficient map of the source mask is not duplicated.
Operators
GenMask2d< value_type > & operator= (const GenMask2d< value_type > &aMask)
 Assignment.

Protected Member Functions

Shallow copy constructor
 GenMask2d (const GenMask2d< value_type > &rhs, int)
 Shallow copy constructor.

Protected Attributes

Representation of a mask
int * _pRefCnt
 Reference counter.
int _width
 Mask width.
int _height
 Mask height.
pointer _pCoeffMap
 Pointer to the memory space of the mask.

Private Member Functions

Auxiliaries
void PRIVATEdeepCopy (const GenMask2d< T > &aMask)
 Store a deep copy of a given mask into the current mask.


Member Typedef Documentation

template<class T>
typedef const value_type* qgar::GenMask2d< T >::const_pointer
 

Constant pointer to qgar::GenMask2d::value_type.

Definition at line 96 of file GenMask2d.H.

template<class T>
typedef const value_type& qgar::GenMask2d< T >::const_reference
 

Constant reference to qgar::GenMask2d::value_type.

Definition at line 86 of file GenMask2d.H.

template<class T>
typedef value_type* qgar::GenMask2d< T >::pointer
 

Pointer to qgar::GenMask2d::value_type.

Definition at line 91 of file GenMask2d.H.

template<class T>
typedef value_type& qgar::GenMask2d< T >::reference
 

Reference to qgar::GenMask2d::value_type.

Definition at line 81 of file GenMask2d.H.

template<class T>
typedef T qgar::GenMask2d< T >::value_type
 

Type of the mask coefficients.

Definition at line 76 of file GenMask2d.H.


Constructor & Destructor Documentation

template<class T>
qgar::GenMask2d< T >::GenMask2d  ) 
 

Default constructor: Set 0 to mask width and height, to pointer to the coefficient map, and to reference counter.

Definition at line 56 of file GenMask2d.TCC.

Referenced by qgar::GenMask2d< T >::shallowCopy().

template<class T>
qgar::GenMask2d< T >::GenMask2d const GenMask2d< value_type > &  aMask  ) 
 

Copy constructor.

See also qgar::GenMask2d::operator= and qgar::GenMask2d::shallowCopy.

Warning:
Perform a deep copy: The coefficent map of the source mask is duplicated.

Definition at line 71 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_height, qgar::GenMask2d< T >::_pCoeffMap, qgar::GenMask2d< T >::_width, and qgar::GenMask2d< T >::pCoeffMap().

template<class T>
qgar::GenMask2d< T >::GenMask2d unsigned int  aWidth,
unsigned int  aHeight,
value_type  aValue = static_cast< value_type >(0)
 

Initialize with given width, height and value.

All the coefficients are set to the given value.

Parameters:
aWidth mask width
aHeight mask height
aValue value to fill the mask with (default 0)

Definition at line 88 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_height, qgar::GenMask2d< T >::_pCoeffMap, qgar::GenMask2d< T >::_width, and qgar::qgFill().

template<class T>
qgar::GenMask2d< T >::GenMask2d unsigned int  aWidth,
unsigned int  aHeight,
const_pointer const   valArray
 

Builds a mask from an array of values.

Parameters:
aWidth 
aHeight 
valArray 

template<class T>
qgar::GenMask2d< T >::~GenMask2d  ) 
 

Non-virtual destructor.

Free space allocated to the coefficient map if and only if the reference counter is null.

Definition at line 143 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_pCoeffMap, and qgar::GenMask2d< T >::_pRefCnt.

template<class T>
qgar::GenMask2d< T >::GenMask2d const GenMask2d< value_type > &  rhs,
int 
[protected]
 

Shallow copy constructor.

This constructor declares an unused integer parameter to avoid ambiguous calls to the copy constructor. It builds a shallow copy of a mask instance.

Parameters:
rhs A mask instance to create a copy from.


Member Function Documentation

template<class T>
T qgar::GenMask2d< T >::coeff int  aX,
int  aY
const
 

Get a coefficient value.

Parameters:
aX X coordinate (column index) of the coefficient
aY Y coordinate (row index) of the coefficient

Definition at line 196 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_pCoeffMap, and qgar::GenMask2d< T >::_width.

template<class T>
int qgar::GenMask2d< T >::height  )  const [inline]
 

Get mask height.

Definition at line 181 of file GenMask2d.TCC.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().

template<class T>
GenMask2d< T > & qgar::GenMask2d< T >::operator= const GenMask2d< value_type > &  aMask  ) 
 

Assignment.

Parameters:
aMask mask to assign
See also qgar::GenMask2d::operator=, and qgar::GenMask2d::shallowCopy.

Warning:
Perform a deep copy: The coefficient map of the source mask is duplicated. Before the copy is performed, the destination mask is not supposed to have the same dimensions as the destination mask.

Definition at line 283 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::PRIVATEdeepCopy().

template<class T>
T * qgar::GenMask2d< T >::pCoeffMap  )  const [inline]
 

Get the pointer to the coefficient map.

Definition at line 211 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_pCoeffMap.

Referenced by qgar::GenMask2d< T >::GenMask2d(), and qgar::GenMask2d< T >::PRIVATEdeepCopy().

template<class T>
void qgar::GenMask2d< T >::PRIVATEdeepCopy const GenMask2d< T > &  aMask  )  [private]
 

Store a deep copy of a given mask into the current mask.

Parameters:
aMask mask to be copied

Definition at line 252 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_height, qgar::GenMask2d< T >::_pCoeffMap, qgar::GenMask2d< T >::_pRefCnt, qgar::GenMask2d< T >::_width, and qgar::GenMask2d< T >::pCoeffMap().

Referenced by qgar::GenMask2d< T >::operator=().

template<class T>
void qgar::GenMask2d< T >::setCoeff int  aX,
int  aY,
value_type  aCoeff
 

Set coefficient at given position.

Parameters:
aX X coordinate (column index) of the coefficient
aY Y coordinate (row index) of the coefficient
aCoeff coefficient value

Definition at line 226 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_pCoeffMap, and qgar::GenMask2d< T >::_width.

template<class T>
GenMask2d< T > qgar::GenMask2d< T >::shallowCopy  ) 
 

Shallow copy: The coefficient map of the source mask is not duplicated.

See also qgar::GenMask2d::operator= and qgar::GenMask2d::shallowCopy.

Warning:
Before the copy is performed, the destination mask is not supposed to have the same dimensions as the source mask. When the copy is completed, the pixel map of the destination mask is the same memory space as the pixel map of the source mask.

Definition at line 242 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::GenMask2d().

template<class T>
int qgar::GenMask2d< T >::width  )  const [inline]
 

Get mask width.

Definition at line 171 of file GenMask2d.TCC.

References qgar::GenMask2d< T >::_width.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().


Member Data Documentation

template<class T>
int qgar::GenMask2d< T >::_height [protected]
 

Mask height.

Definition at line 315 of file GenMask2d.H.

Referenced by qgar::GenMask2d< T >::GenMask2d(), and qgar::GenMask2d< T >::PRIVATEdeepCopy().

template<class T>
pointer qgar::GenMask2d< T >::_pCoeffMap [protected]
 

Pointer to the memory space of the mask.

Definition at line 320 of file GenMask2d.H.

Referenced by qgar::GenMask2d< T >::coeff(), qgar::GenMask2d< T >::GenMask2d(), qgar::GenMask2d< T >::pCoeffMap(), qgar::GenMask2d< T >::PRIVATEdeepCopy(), qgar::GenMask2d< T >::setCoeff(), and qgar::GenMask2d< T >::~GenMask2d().

template<class T>
int* qgar::GenMask2d< T >::_pRefCnt [protected]
 

Reference counter.

Its value represent the number of other masks with which the current mask shares its coefficient map.

Definition at line 305 of file GenMask2d.H.

Referenced by qgar::GenMask2d< T >::PRIVATEdeepCopy(), and qgar::GenMask2d< T >::~GenMask2d().

template<class T>
int qgar::GenMask2d< T >::_width [protected]
 

Mask width.

Definition at line 310 of file GenMask2d.H.

Referenced by qgar::GenMask2d< T >::coeff(), qgar::GenMask2d< T >::GenMask2d(), qgar::GenMask2d< T >::PRIVATEdeepCopy(), qgar::GenMask2d< T >::setCoeff(), and qgar::GenMask2d< T >::width().


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