StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | List of all members
AliHLTResizableArray< T, Dim, alignment > Class Template Reference

#include <AliHLTArray.h>

Inheritance diagram for AliHLTResizableArray< T, Dim, alignment >:
AliHLTArray< AliHLTInternal::TypeForAlignmentHelper< T, alignment >::Type, Dim > AliHLTInternal::ArrayBase< AliHLTInternal::TypeForAlignmentHelper< T, alignment >::Type, Dim >

Public Types

typedef
AliHLTInternal::TypeForAlignmentHelper
< T, alignment >::Type 
T2
 
typedef
AliHLTInternal::ArrayBase< T2,
Dim > 
Parent
 
- Public Types inherited from AliHLTArray< AliHLTInternal::TypeForAlignmentHelper< T, alignment >::Type, Dim >
typedef
AliHLTInternal::ArrayBase
< AliHLTInternal::TypeForAlignmentHelper
< T, alignment >::Type, Dim > 
Parent
 

Public Member Functions

 AliHLTResizableArray ()
 
 AliHLTResizableArray (int x)
 
 AliHLTResizableArray (int x, int y)
 
 AliHLTResizableArray (int x, int y, int z)
 
 ~AliHLTResizableArray ()
 
void Resize (int x)
 
void Resize (int x, int y)
 
void Resize (int x, int y, int z)
 
- Public Member Functions inherited from AliHLTArray< AliHLTInternal::TypeForAlignmentHelper< T, alignment >::Type, Dim >
int Size () const
 
 operator bool () const
 
bool IsValid () const
 
AliHLTInternal::TypeForAlignmentHelper
< T, alignment >::Type & 
operator* ()
 
const
AliHLTInternal::TypeForAlignmentHelper
< T, alignment >::Type & 
operator* () const
 
AliHLTInternal::TypeForAlignmentHelper
< T, alignment >::Type * 
Data ()
 
const
AliHLTInternal::TypeForAlignmentHelper
< T, alignment >::Type * 
Data () const
 
AliHLTArray operator+ (int x) const
 
AliHLTArray operator- (int x) const
 
AliHLTArray< Other, Dim > ReinterpretCast () const
 

Detailed Description

template<typename T, int Dim = 1, int alignment = 0>
class AliHLTResizableArray< T, Dim, alignment >

Owns the data. When it goes out of scope the data is freed.

The memory is allocated on the heap.

Instantiate this class on the stack. Allocation on the heap is disallowed.

Parameters
Ttype of the entries in the array.
Dimselects the operator[]/operator() behavior it should have. I.e. makes it behave like a 1-, 2- or 3-dim array. (defaults to 1)
alignmentDefaults to 0 (default alignment). Other valid values are any multiples of 2. This is especially useful for aligning data for SIMD vectors.
Warning
when using alignment the type T may not have a destructor (well it may, but it won't be called)

Example:

* void init( AliHLTArray<int> a, int size )
* {
* for ( int i = 0; i < size; ++i ) {
* a[i] = i;
* }
* }
*
* int size = ...;
* AliHLTResizableArray<int> foo( size ); // notice that size doesn't have to be a constant like it
* // has to be for C-Arrays in ISO C++
* init( foo, size );
* // now foo[i] == i
*
*

Definition at line 462 of file AliHLTArray.h.

Constructor & Destructor Documentation

template<typename T , int Dim, int alignment>
AliHLTResizableArray< T, Dim, alignment >::AliHLTResizableArray ( )
inline

does not allocate any memory

Definition at line 686 of file AliHLTArray.h.

template<typename T , int Dim, int alignment>
AliHLTResizableArray< T, Dim, alignment >::AliHLTResizableArray ( int  x)
inline

use for 1-dim arrays: allocates x * sizeof(T) bytes for the array

Definition at line 693 of file AliHLTArray.h.

template<typename T , int Dim, int alignment>
AliHLTResizableArray< T, Dim, alignment >::AliHLTResizableArray ( int  x,
int  y 
)
inline

use for 2-dim arrays: allocates x * y * sizeof(T) bytes for the array

Definition at line 701 of file AliHLTArray.h.

template<typename T , int Dim, int alignment>
AliHLTResizableArray< T, Dim, alignment >::AliHLTResizableArray ( int  x,
int  y,
int  z 
)
inline

use for 3-dim arrays: allocates x * y * z * sizeof(T) bytes for the array

Definition at line 709 of file AliHLTArray.h.

template<typename T, int Dim = 1, int alignment = 0>
AliHLTResizableArray< T, Dim, alignment >::~AliHLTResizableArray ( )
inline

frees the data

Definition at line 487 of file AliHLTArray.h.

Member Function Documentation

template<typename T , int Dim, int alignment>
void AliHLTResizableArray< T, Dim, alignment >::Resize ( int  x)
inline

use for 1-dim arrays: resizes the memory for the array to x * sizeof(T) bytes.

Warning
this does not keep your previous data. If you were looking for this you probably want to use std::vector instead.

Definition at line 718 of file AliHLTArray.h.

Referenced by AliHLTTPCCAGBTracker::FindTracks(), AliHLTTPCCASliceData::InitFromClusterData(), and AliHLTTPCCAGBTracker::SetHits().

template<typename T , int Dim, int alignment>
void AliHLTResizableArray< T, Dim, alignment >::Resize ( int  x,
int  y 
)
inline

use for 2-dim arrays: resizes the memory for the array to x * y * sizeof(T) bytes.

Warning
this does not keep your previous data. If you were looking for this you probably want to use std::vector instead.

Definition at line 727 of file AliHLTArray.h.

template<typename T , int Dim, int alignment>
void AliHLTResizableArray< T, Dim, alignment >::Resize ( int  x,
int  y,
int  z 
)
inline

use for 3-dim arrays: resizes the memory for the array to x * y * z * sizeof(T) bytes.

Warning
this does not keep your previous data. If you were looking for this you probably want to use std::vector instead.

Definition at line 736 of file AliHLTArray.h.


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