MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Protected Attributes
mds::base::CStaticData< T, M > Class Template Reference

Class template providing data allocation. More...

#include <mdsStaticData.h>

Inheritance diagram for mds::base::CStaticData< T, M >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { MAX_SIZE = M }
 Maximal allowed size of the memory block. More...
typedef CDataAllocator< T > base
typedef base::tConstData tConstData
 Const data type.
typedef base::tConstDataPtr tConstDataPtr
 Pointer to the constant data.
typedef base::tData tData
 Data type.
typedef base::tDataPtr tDataPtr
 Pointer to the data.

Public Member Functions

T & at (tSize i)
 Returns reference to the element [i].
const T & at (tSize i) const
CStaticDatacreate (tSize Size)
 Creates data of a given size.
CStaticDatacreate (tConstDataPtr pData, tSize Size)
 Copies the specified data.
CStaticDatacreate (const CStaticData &Data)
 Allocates memory and copies the specified data.
 CStaticData ()
 Default constructor initializes length of the data to MAX_SIZE.
 CStaticData (EEmptyConst)
 This constructor does noething.
 CStaticData (tSize Size)
 Constructor initializes size of data.
 CStaticData (tConstDataPtr pData, tSize Size)
 Constructor that copies a specified data.
 CStaticData (const CStaticData &Data)
 Constructor copies a given data.
CStaticDatafill (const tData &Value)
 Initializes the data.
template<class Function >
Function forEach (Function Func)
template<class Function >
Function forEach (Function Func)
 Calls function object for every element.
template<class Function >
Function forEach (Function Func) const
 Calls function object for every element.
template<class Function >
Function forEach (Function Func) const
template<class Function >
Function forRange (tSize i, tSize j, Function Func)
 Calls function object for every element.
template<class Function >
Function forRange (tSize i, tSize j, Function Func) const
 Calls function object for every element.
template<class Function >
Function forRange (tSize i, tSize j, Function Func)
template<class Function >
Function forRange (tSize i, tSize j, Function Func) const
T * getPtr (tSize i)
 Returns pointer to the element [i].
const T * getPtr (tSize i) const
T * getPtr ()
 Returns pointer to the data.
const T * getPtr () const
tSize getSize () const
 Returns current data size.
bool isWithinBlock (tSize i, tSize j) const
 Returns true if the specified range of elements lie within a continuous block of memory.
T & operator() (tSize i)
 Returns reference to the subscripted element [i].
const T & operator() (tSize i) const
CStaticDataoperator= (const CStaticData &Data)
 Assignment operator.
CStaticDataset (tSize i, const T &Value)
 Sets the element of matrix at the position [i].
 ~CStaticData ()
 Destructor.

Protected Attributes

tData m_pData [M]
 Statically allocated data.
tSize m_Size
 Current size.

Detailed Description

template<typename T, tSize M>
class mds::base::CStaticData< T, M >

Class template providing data allocation.


Member Typedef Documentation

template<typename T, tSize M>
typedef CDataAllocator<T> mds::base::CStaticData< T, M >::base
template<typename T, tSize M>
typedef base::tConstData mds::base::CStaticData< T, M >::tConstData

Const data type.

Reimplemented from mds::base::CDataAllocator< T >.

template<typename T, tSize M>
typedef base::tConstDataPtr mds::base::CStaticData< T, M >::tConstDataPtr

Pointer to the constant data.

Reimplemented from mds::base::CDataAllocator< T >.

template<typename T, tSize M>
typedef base::tData mds::base::CStaticData< T, M >::tData

Data type.

Reimplemented from mds::base::CDataAllocator< T >.

template<typename T, tSize M>
typedef base::tDataPtr mds::base::CStaticData< T, M >::tDataPtr

Pointer to the data.

Reimplemented from mds::base::CDataAllocator< T >.


Member Enumeration Documentation

template<typename T, tSize M>
anonymous enum

Maximal allowed size of the memory block.

Enumerator:
MAX_SIZE 

Constructor & Destructor Documentation

template<typename T , tSize M>
CStaticData::CStaticData ( )

Default constructor initializes length of the data to MAX_SIZE.

template<typename T , tSize M>
CStaticData::CStaticData ( EEmptyConst  ) [explicit]

This constructor does noething.

  • Be sure that one of the methods create(...) is called somewhere.
  • Use with care!
template<typename T , tSize M>
CStaticData::CStaticData ( tSize  Size) [explicit]

Constructor initializes size of data.

  • Data of the zero size can be also created.
  • Throws mds::base::CBadStaticAlloc() on failure!
template<typename T , tSize M>
CStaticData::CStaticData ( tConstDataPtr  pData,
tSize  Size 
)

Constructor that copies a specified data.

template<typename T , tSize M>
mds::base::CStaticData< T, M >::CStaticData ( const CStaticData< T, M > &  Data)

Constructor copies a given data.

template<typename T , tSize M>
CStaticData::~CStaticData ( )

Destructor.


Member Function Documentation

template<typename T, tSize M>
T& mds::base::CStaticData< T, M >::at ( tSize  i)

Returns reference to the element [i].

template<typename T, tSize M>
const T& mds::base::CStaticData< T, M >::at ( tSize  i) const
template<typename T , tSize M>
CStaticData< T, M > & CStaticData::create ( tSize  Size)

Creates data of a given size.

  • Throws mds::base::CBadStaticAlloc() on failure!
template<typename T , tSize M>
CStaticData< T, M > & CStaticData::create ( tConstDataPtr  pData,
tSize  Size 
)

Copies the specified data.

template<typename T , tSize M>
CStaticData< T, M > & mds::base::CStaticData< T, M >::create ( const CStaticData< T, M > &  Data)

Allocates memory and copies the specified data.

template<typename T , tSize M>
CStaticData< T, M > & CStaticData::fill ( const tData Value)

Initializes the data.

template<typename T, tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forEach ( Function  Func)
template<typename T , tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forEach ( Function  Func)

Calls function object for every element.

template<typename T , tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forEach ( Function  Func) const

Calls function object for every element.

template<typename T, tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forEach ( Function  Func) const
template<typename T , tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forRange ( tSize  i,
tSize  j,
Function  Func 
)

Calls function object for every element.

template<typename T , tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forRange ( tSize  i,
tSize  j,
Function  Func 
) const

Calls function object for every element.

template<typename T, tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forRange ( tSize  i,
tSize  j,
Function  Func 
)
template<typename T, tSize M>
template<class Function >
Function mds::base::CStaticData< T, M >::forRange ( tSize  i,
tSize  j,
Function  Func 
) const
template<typename T, tSize M>
T* mds::base::CStaticData< T, M >::getPtr ( tSize  i)

Returns pointer to the element [i].

template<typename T, tSize M>
const T* mds::base::CStaticData< T, M >::getPtr ( tSize  i) const
template<typename T, tSize M>
T* mds::base::CStaticData< T, M >::getPtr ( )

Returns pointer to the data.

template<typename T, tSize M>
const T* mds::base::CStaticData< T, M >::getPtr ( ) const
template<typename T, tSize M>
tSize mds::base::CStaticData< T, M >::getSize ( ) const

Returns current data size.

template<typename T, tSize M>
bool mds::base::CStaticData< T, M >::isWithinBlock ( tSize  i,
tSize  j 
) const

Returns true if the specified range of elements lie within a continuous block of memory.

template<typename T, tSize M>
T& mds::base::CStaticData< T, M >::operator() ( tSize  i)

Returns reference to the subscripted element [i].

template<typename T, tSize M>
const T& mds::base::CStaticData< T, M >::operator() ( tSize  i) const
template<typename T , tSize M>
CStaticData< T, M > & CStaticData::operator= ( const CStaticData< T, M > &  Data)

Assignment operator.

template<typename T, tSize M>
CStaticData& mds::base::CStaticData< T, M >::set ( tSize  i,
const T &  Value 
)

Sets the element of matrix at the position [i].


Member Data Documentation

template<typename T, tSize M>
tData mds::base::CStaticData< T, M >::m_pData[M] [protected]

Statically allocated data.

template<typename T, tSize M>
tSize mds::base::CStaticData< T, M >::m_Size [protected]

Current size.


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