Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts
Public Types | Public Member Functions

itk::Array< TValueType > Class Template Reference
[Data Representation Objects]

Array class with size defined at construction time. More...

#include <itkArray.h>

Inheritance diagram for itk::Array< TValueType >:
Inheritance graph
[legend]
Collaboration diagram for itk::Array< TValueType >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Array Self
typedef TValueType ValueType
typedef vnl_vector< TValueType > VnlVectorType

Public Member Functions

 Array ()
 Array (unsigned int dimension)
 Array (const ValueType *data, unsigned int sz, bool LetArrayManageMemory=false)
 Array (ValueType *data, unsigned int sz, bool LetArrayManageMemory=false)
void Fill (TValueType const &v)
const TValueType & GetElement (unsigned int i) const
void SetData (TValueType *data, unsigned int sz, bool LetArrayManageMemory=false)
void SetData (TValueType *data, bool LetArrayManageMemory=false)
void SetElement (unsigned int i, const TValueType &value)
 ~Array ()

const Selfoperator= (const Self &rhs)
const Selfoperator= (const VnlVectorType &rhs)

unsigned int Size (void) const
unsigned int GetNumberOfElements (void) const

void SetSize (unsigned int sz)
unsigned int GetSize (void) const

Detailed Description

template<typename TValueType>
class itk::Array< TValueType >

Array class with size defined at construction time.

This class derives from the vnl_vector<> class. Its size is assigned at construction time (run time) and can not be changed afterwards except by using assignment to another Array.

The class is templated over the type of the elements.

Template parameters for class Array:

Definition at line 44 of file itkArray.h.


Member Typedef Documentation

template<typename TValueType>
typedef Array itk::Array< TValueType >::Self

Definition at line 50 of file itkArray.h.

template<typename TValueType>
typedef TValueType itk::Array< TValueType >::ValueType

The element type stored at each location in the Array.

Definition at line 49 of file itkArray.h.

template<typename TValueType>
typedef vnl_vector<TValueType> itk::Array< TValueType >::VnlVectorType

Definition at line 51 of file itkArray.h.


Constructor & Destructor Documentation

template<typename TValueType>
itk::Array< TValueType >::Array (  ) 

Default constructor. It is created with an empty array it has to be allocated later by assignment

template<typename TValueType>
itk::Array< TValueType >::Array ( unsigned int  dimension  )  [explicit]

Constructor with size. Size can only be changed by assignment

template<typename TValueType>
itk::Array< TValueType >::Array ( ValueType data,
unsigned int  sz,
bool  LetArrayManageMemory = false 
)

Constructor that initializes array with contents from a user supplied buffer. The pointer to the buffer and the length is specified. By default, the array does not manage the memory of the buffer. It merely points to that location and it is the user's responsibility to delete it. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.

template<typename TValueType>
itk::Array< TValueType >::Array ( const ValueType data,
unsigned int  sz,
bool  LetArrayManageMemory = false 
)

Constructor that initializes array with contents from a user supplied buffer. The pointer to the buffer and the length is specified. By default, the array does not manage the memory of the buffer. It merely points to that location and it is the user's responsibility to delete it. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.

template<typename TValueType>
itk::Array< TValueType >::~Array (  ) 

This destructor is not virtual for performance reasons. However, this means that subclasses cannot allocate memory.


Member Function Documentation

template<typename TValueType>
void itk::Array< TValueType >::Fill ( TValueType const &  v  )  [inline]
template<typename TValueType>
const TValueType& itk::Array< TValueType >::GetElement ( unsigned int  i  )  const [inline]

Get one element

Definition at line 96 of file itkArray.h.

template<typename TValueType>
unsigned int itk::Array< TValueType >::GetNumberOfElements ( void   )  const [inline]

Return the number of elements in the Array

Definition at line 91 of file itkArray.h.

template<typename TValueType>
unsigned int itk::Array< TValueType >::GetSize ( void   )  const [inline]
template<typename TValueType>
const Self& itk::Array< TValueType >::operator= ( const Self rhs  ) 

Copy opertor

template<typename TValueType>
const Self& itk::Array< TValueType >::operator= ( const VnlVectorType rhs  ) 

Copy opertor

template<typename TValueType>
void itk::Array< TValueType >::SetData ( TValueType *  data,
bool  LetArrayManageMemory = false 
)

Set the pointer from which the data is imported. If "LetArrayManageMemory" is false, then the application retains the responsibility of freeing the memory for this data. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.

Referenced by itk::MetaArrayReader::GetOutput().

template<typename TValueType>
void itk::Array< TValueType >::SetData ( TValueType *  data,
unsigned int  sz,
bool  LetArrayManageMemory = false 
)

Similar to the previous method. In the above method, the size must be seperately set prior to using user-supplied data. This introduces an unnecessary allocation step to be performed. This method avoids it and should be used to import data whereever possible to avoid this. Set the pointer from which the data is imported. If "LetArrayManageMemory" is false, then the application retains the responsibility of freeing the memory for this data. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.

template<typename TValueType>
void itk::Array< TValueType >::SetElement ( unsigned int  i,
const TValueType &  value 
) [inline]

Set one element

Definition at line 100 of file itkArray.h.

template<typename TValueType>
void itk::Array< TValueType >::SetSize ( unsigned int  sz  ) 
template<typename TValueType>
unsigned int itk::Array< TValueType >::Size ( void   )  const [inline]

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

Generated at Mon Jul 12 2010 20:38:53 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000