]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTArray.h
HLTcalo module
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTArray.h
index 8c5416c0dcaebd46bbc28569fa46f19befd849b4..d0d396ea8f39bed5d0d7eae055efab65551a1c5f 100644 (file)
@@ -1,3 +1,6 @@
+//-*- Mode: C++ -*-
+// $Id$
+
 // ****************************************************************************
 // * This file is property of and copyright by the ALICE HLT Project          *
 // * ALICE Experiment at CERN, All rights reserved.                           *
 #endif
 
 enum {
-  AliHLTFullyCacheLineAligned = -1
+  kAliHLTFullyCacheLineAligned = -1
 };
 
+#if defined(__CUDACC__) & 0
+#define ALIHLTARRAY_STATIC_ASSERT(a, b)
+#define ALIHLTARRAY_STATIC_ASSERT_NC(a, b)
+#else
 namespace AliHLTArrayInternal
 {
-  template<bool> class STATIC_ASSERT_FAILURE;
-  template<> class STATIC_ASSERT_FAILURE<true> {};
+  template<bool> class AliHLTStaticAssertFailure;
+  template<> class AliHLTStaticAssertFailure<true> {};
 }
 
 #define ALIHLTARRAY_STATIC_ASSERT_CONCAT_HELPER(a, b) a##b
 #define ALIHLTARRAY_STATIC_ASSERT_CONCAT(a, b) ALIHLTARRAY_STATIC_ASSERT_CONCAT_HELPER(a, b)
 #define ALIHLTARRAY_STATIC_ASSERT_NC(cond, msg) \
-  typedef AliHLTArrayInternal::STATIC_ASSERT_FAILURE<cond> ALIHLTARRAY_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__); \
+  typedef AliHLTArrayInternal::AliHLTStaticAssertFailure<cond> ALIHLTARRAY_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__); \
   ALIHLTARRAY_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__) Error_##msg
 #define ALIHLTARRAY_STATIC_ASSERT(cond, msg) ALIHLTARRAY_STATIC_ASSERT_NC(cond, msg); (void) Error_##msg
+#endif
 
 template<typename T, int Dim> class AliHLTArray;
 
@@ -70,8 +78,8 @@ namespace AliHLTInternal
 {
   template<unsigned int Size> struct Padding { char fPadding[Size]; };
   template<> struct Padding<0> {};
-  template<typename T> struct CacheLineSizeHelperData { T fData; };
-  template<typename T> struct CacheLineSizeHelperEnums {
+  template<typename T> struct AliHLTCacheLineSizeHelperData { T fData; };
+  template<typename T> struct AliHLTCacheLineSizeHelperEnums {
     enum {
       CacheLineSize = 64,
       MaskedSize = sizeof( T ) & ( CacheLineSize - 1 ),
@@ -79,20 +87,20 @@ namespace AliHLTInternal
       PaddingSize = RequiredSize - sizeof( T )
     };
   };
-  template<typename T> class CacheLineSizeHelper : private CacheLineSizeHelperData<T>, private Padding<CacheLineSizeHelperEnums<T>::PaddingSize>
+  template<typename T> class AliCacheLineSizeHelper : private AliHLTCacheLineSizeHelperData<T>, private Padding<AliHLTCacheLineSizeHelperEnums<T>::PaddingSize>
   {
     public:
-      operator T &() { return CacheLineSizeHelperData<T>::fData; }
-      operator const T &() const { return CacheLineSizeHelperData<T>::fData; }
-      //const T &operator=( const T &rhs ) { CacheLineSizeHelperData<T>::fData = rhs; }
+      operator T &() { return AliHLTCacheLineSizeHelperData<T>::fData; }
+      operator const T &() const { return AliHLTCacheLineSizeHelperData<T>::fData; }
+      //const T &operator=( const T &rhs ) { AliHLTCacheLineSizeHelperData<T>::fData = rhs; }
 
     private:
   };
   template<typename T, int alignment> struct TypeForAlignmentHelper { typedef T Type; };
-  template<typename T> struct TypeForAlignmentHelper<T, AliHLTFullyCacheLineAligned> { typedef CacheLineSizeHelper<T> Type; };
+  template<typename T> struct TypeForAlignmentHelper<T, kAliHLTFullyCacheLineAligned> { typedef AliCacheLineSizeHelper<T> Type; };
 
   // XXX
-  // The ArrayBoundsCheck and Allocator classes implement a virtual destructor only in order to
+  // The AliArrayBoundsCheck and AliAllocator classes implement a virtual destructor only in order to
   // silence the -Weffc++ warning. It really is not required for these classes to have a virtual
   // dtor since polymorphism is not used (AliHLTResizableArray and AliHLTFixedArray are allocated on
   // the stack only). The virtual dtor only adds an unnecessary vtable to the code.
@@ -100,24 +108,24 @@ namespace AliHLTInternal
   /**
    * no-op implementation that for no-bounds-checking
    */
-  class ArrayBoundsCheck
+  class AliArrayBoundsCheck
   {
     protected:
-      virtual inline ~ArrayBoundsCheck() {}
+      virtual inline ~AliArrayBoundsCheck() {}
       inline bool IsInBounds( int ) const { return true; }
-      inline void SetBounds( int, int ) {}
-      inline void MoveBounds( int ) {}
-      inline void ReinterpretCast( const ArrayBoundsCheck &, int, int ) {}
+      inline void SetBounds( int, int ) const {}
+      inline void MoveBounds( int ) const {}
+      inline void ReinterpretCast( const AliArrayBoundsCheck &, int, int ) const {}
   };
 #define BOUNDS_CHECK(x, y)
 #else
   /**
    * implementation for bounds-checking.
    */
-  class ArrayBoundsCheck
+  class AliArrayBoundsCheck
   {
     protected:
-      virtual inline ~ArrayBoundsCheck() {}
+      virtual inline ~AliArrayBoundsCheck() {}
       /**
        * checks whether the given offset is valid
        */
@@ -131,61 +139,53 @@ namespace AliHLTInternal
        */
       inline void MoveBounds( int d ) { fStart += d; fEnd += d; }
 
-      inline void ReinterpretCast( const ArrayBoundsCheck &other, int sizeofOld, int sizeofNew ) {
+      inline void ReinterpretCast( const AliArrayBoundsCheck &other, int sizeofOld, int sizeofNew ) {
         fStart = other.fStart * sizeofNew / sizeofOld;
         fEnd = other.fEnd * sizeofNew / sizeofOld;
       }
 
     private:
-      int fStart;
-      int fEnd;
+      int fStart; // start
+      int fEnd;   // end
   };
-#define BOUNDS_CHECK(x, y) if (AliHLTInternal::ArrayBoundsCheck::IsInBounds(x)) {} else return y
+#define BOUNDS_CHECK(x, y) if (AliHLTInternal::AliArrayBoundsCheck::IsInBounds(x)) {} else return y
 #endif
-  template<typename T, int alignment> class Allocator
+  template<typename T, int alignment> class AliAllocator
   {
     public:
 #ifdef USE_MM_MALLOC
       static inline T *Alloc( int s ) { T *p = reinterpret_cast<T *>( _mm_malloc( s * sizeof( T ), alignment ) ); return new( p ) T[s]; }
       static inline void Free( T *const p, int size ) {
-        for ( int i = 0; i < size; ++i ) {
-          p[i].~T();
-        }
+        for ( int i = 0; i < size; ++i ) p[i].~T();        
         _mm_free( p );
       }
 #else
       static inline T *Alloc( int s ) { T *p; posix_memalign( &p, alignment, s * sizeof( T ) ); return new( p ) T[s]; }
       static inline void Free( T *const p, int size ) {
-        for ( int i = 0; i < size; ++i ) {
-          p[i].~T();
-        }
+        for ( int i = 0; i < size; ++i ) p[i].~T();        
         std::free( p );
       }
 #endif
   };
-  template<typename T> class Allocator<T, AliHLTFullyCacheLineAligned>
+  template<typename T> class AliAllocator<T, kAliHLTFullyCacheLineAligned>
   {
     public:
-      typedef CacheLineSizeHelper<T> T2;
+      typedef AliCacheLineSizeHelper<T> T2;
 #ifdef USE_MM_MALLOC
       static inline T2 *Alloc( int s ) { T2 *p = reinterpret_cast<T2 *>( _mm_malloc( s * sizeof( T2 ), 128 ) ); return new( p ) T2[s]; }
       static inline void Free( T2 *const p, int size ) {
-        for ( int i = 0; i < size; ++i ) {
-          p[i].~T2();
-        }
+        for ( int i = 0; i < size; ++i ) p[i].~T2();        
         _mm_free( p );
       }
 #else
       static inline T2 *Alloc( int s ) { T2 *p; posix_memalign( &p, 128, s * sizeof( T2 ) ); return new( p ) T2[s]; }
       static inline void Free( T2 *const p, int size ) {
-        for ( int i = 0; i < size; ++i ) {
-          p[i].~T2();
-        }
+        for ( int i = 0; i < size; ++i ) p[i].~T2();
         std::free( p );
       }
 #endif
   };
-  template<typename T> class Allocator<T, 0>
+  template<typename T> class AliAllocator<T, 0>
   {
     public:
       static inline T *Alloc( int s ) { return new T[s]; }
@@ -193,23 +193,23 @@ namespace AliHLTInternal
   };
 
   template<typename T> struct ReturnTypeHelper { typedef T Type; };
-  template<typename T> struct ReturnTypeHelper<CacheLineSizeHelper<T> > { typedef T Type; };
+  template<typename T> struct ReturnTypeHelper<AliCacheLineSizeHelper<T> > { typedef T Type; };
   /**
    * Array base class for dimension dependent behavior
    */
-  template<typename T, int Dim> class ArrayBase;
+  template<typename T, int Dim> class AliHLTArrayBase;
 
   /**
    * 1-dim arrays only have operator[]
    */
   template<typename T>
-  class ArrayBase<T, 1> : public ArrayBoundsCheck
+  class AliHLTArrayBase<T, 1> : public AliArrayBoundsCheck
   {
-      friend class ArrayBase<T, 2>;
+    friend class AliHLTArrayBase<T, 2>; // declare friend 
     public:
-      ArrayBase() : fData( 0 ), fSize( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
-      ArrayBase( const ArrayBase &rhs ) : ArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ) {} // XXX
-      ArrayBase &operator=( const ArrayBase &rhs ) { ArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; return *this; } // XXX
+      AliHLTArrayBase() : fData( 0 ), fSize( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
+      AliHLTArrayBase( const AliHLTArrayBase &rhs ) : AliArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ) {} // XXX
+      AliHLTArrayBase &operator=( const AliHLTArrayBase &rhs ) { AliArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; return *this; } // XXX
       typedef typename ReturnTypeHelper<T>::Type R;
       /**
        * return a reference to the value at the given index
@@ -221,8 +221,8 @@ namespace AliHLTInternal
       inline const R &operator[]( int x ) const { BOUNDS_CHECK( x, fData[0] ); return fData[x]; }
 
     protected:
-      T *fData;
-      int fSize;
+      T *fData;  // actual data
+      int fSize; // data size
       inline void SetSize( int x, int, int ) { fSize = x; }
   };
 
@@ -231,13 +231,13 @@ namespace AliHLTInternal
    * operator[] can be used to return a 1-dim array
    */
   template<typename T>
-  class ArrayBase<T, 2> : public ArrayBoundsCheck
+  class AliHLTArrayBase<T, 2> : public AliArrayBoundsCheck
   {
-      friend class ArrayBase<T, 3>;
+    friend class AliHLTArrayBase<T, 3>; // declare friend
     public:
-      ArrayBase() : fData( 0 ), fSize( 0 ), fStride( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
-      ArrayBase( const ArrayBase &rhs ) : ArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStride( rhs.fStride ) {} // XXX
-      ArrayBase &operator=( const ArrayBase &rhs ) { ArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStride = rhs.fStride; return *this; } // XXX
+      AliHLTArrayBase() : fData( 0 ), fSize( 0 ), fStride( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
+      AliHLTArrayBase( const AliHLTArrayBase &rhs ) : AliArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStride( rhs.fStride ) {} // XXX
+      AliHLTArrayBase &operator=( const AliHLTArrayBase &rhs ) { AliArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStride = rhs.fStride; return *this; } // XXX
       typedef typename ReturnTypeHelper<T>::Type R;
       /**
        * return a reference to the value at the given indexes
@@ -257,9 +257,9 @@ namespace AliHLTInternal
       inline const AliHLTArray<T, 1> operator[]( int x ) const;
 
     protected:
-      T *fData;
-      int fSize;
-      int fStride;
+      T *fData;    // actual data
+      int fSize;   // data size
+      int fStride; // stride
       inline void SetSize( int x, int y, int ) { fStride = y; fSize = x * y; }
   };
 
@@ -268,21 +268,22 @@ namespace AliHLTInternal
    * operator[] can be used to return a 2-dim array
    */
   template<typename T>
-  class ArrayBase<T, 3> : public ArrayBoundsCheck
+  class AliHLTArrayBase<T, 3> : public AliArrayBoundsCheck
   {
     public:
-      ArrayBase() : fData( 0 ), fSize( 0 ), fStrideX( 0 ), fStrideY( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
-      ArrayBase( const ArrayBase &rhs ) : ArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStrideX( rhs.fStrideX ), fStrideY( rhs.fStrideY ) {} // XXX
-      ArrayBase &operator=( const ArrayBase &rhs ) { ArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStrideX = rhs.fStrideX; fStrideY = rhs.fStrideY; return *this; } // XXX
-      typedef typename ReturnTypeHelper<T>::Type R;
+      AliHLTArrayBase() : fData( 0 ), fSize( 0 ), fStrideX( 0 ), fStrideY( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
+      AliHLTArrayBase( const AliHLTArrayBase &rhs ) : AliArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStrideX( rhs.fStrideX ), fStrideY( rhs.fStrideY ) {} // XXX
+      AliHLTArrayBase &operator=( const AliHLTArrayBase &rhs ) { AliArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStrideX = rhs.fStrideX; fStrideY = rhs.fStrideY; return *this; } // XXX
+      // Stopped working on GCC 4.5.0
+      //typedef typename ReturnTypeHelper<T>::Type R;
       /**
        * return a reference to the value at the given indexes
        */
-      inline R &operator()( int x, int y, int z );
+      inline typename ReturnTypeHelper<T>::Type &operator()( int x, int y, int z );
       /**
        * return a const reference to the value at the given indexes
        */
-      inline const R &operator()( int x, int y, int z ) const;
+      inline const typename ReturnTypeHelper<T>::Type &operator()( int x, int y, int z ) const;
       /**
        * return a 2-dim array at the given index. This makes it behave like a 3-dim C-Array.
        */
@@ -293,10 +294,10 @@ namespace AliHLTInternal
       inline const AliHLTArray<T, 2> operator[]( int x ) const;
 
     protected:
-      T *fData;
-      int fSize;
-      int fStrideX;
-      int fStrideY;
+      T *fData;     // actual data
+      int fSize;    // data size
+      int fStrideX; // stride X
+      int fStrideY; // stride Y
       inline void SetSize( int x, int y, int z ) { fStrideX = y * z; fStrideY = z; fSize = fStrideX * x; }
   };
 
@@ -311,36 +312,34 @@ namespace AliHLTInternal
       ~AlignedData() {
         const int offset = reinterpret_cast<unsigned long>( &fUnalignedArray[0] ) & ( Alignment - 1 );
         T *mem = reinterpret_cast<T *>( &fUnalignedArray[0] + ( Alignment - offset ) );
-        for ( unsigned int i = 0; i < Size; ++i ) {
-          mem[i].~T();
-        }
+        for ( unsigned int i = 0; i < Size; ++i ) mem[i].~T();        
       }
     private:
       enum {
-        Alignment = _alignment == AliHLTFullyCacheLineAligned ? 128 : _alignment,
+        Alignment = _alignment == kAliHLTFullyCacheLineAligned ? 128 : _alignment,
         PaddedSize = Size * sizeof( T ) + Alignment
       };
       ALIHLTARRAY_STATIC_ASSERT_NC( ( Alignment & ( Alignment - 1 ) ) == 0, alignment_needs_to_be_a_multiple_of_2 );
 
-      char fUnalignedArray[PaddedSize];
+      char fUnalignedArray[PaddedSize]; // data array
   };
   template<typename T, unsigned int Size> class AlignedData<T, Size, 0>
   {
     public:
       T *ConstructAlignedData() { return &fArray[0]; }
     private:
-      T fArray[Size];
+      T fArray[Size]; // data array
   };
 } // namespace AliHLTInternal
 
 /**
- * C-Array like class with the dimension dependent behavior defined in the ArrayBase class
+ * C-Array like class with the dimension dependent behavior defined in the AliHLTArrayBase class
  */
 template < typename T, int Dim = 1 >
-class AliHLTArray : public AliHLTInternal::ArrayBase<T, Dim>
+class AliHLTArray : public AliHLTInternal::AliHLTArrayBase<T, Dim>
 {
   public:
-    typedef AliHLTInternal::ArrayBase<T, Dim> Parent;
+    typedef AliHLTInternal::AliHLTArrayBase<T, Dim> Parent;
 
     /**
      * Returns the number of elements in the array. If it is a multi-dimensional array the size is
@@ -386,11 +385,13 @@ class AliHLTArray : public AliHLTInternal::ArrayBase<T, Dim>
      */
     inline AliHLTArray operator-( int x ) const;
 
+#ifndef HLTCA_GPUCODE
     template<typename Other> inline AliHLTArray<Other, Dim> ReinterpretCast() const {
       AliHLTArray<Other, Dim> r;
       r.fData = reinterpret_cast<Other *>( Parent::fData );
       r.ReinterpretCast( *this, sizeof( T ), sizeof( Other ) );
     }
+#endif
 };
 
 /**
@@ -431,7 +432,7 @@ class AliHLTResizableArray : public AliHLTArray<typename AliHLTInternal::TypeFor
 {
   public:
     typedef typename AliHLTInternal::TypeForAlignmentHelper<T, alignment>::Type T2;
-    typedef AliHLTInternal::ArrayBase<T2, Dim> Parent;
+    typedef AliHLTInternal::AliHLTArrayBase<T2, Dim> Parent;
     /**
      * does not allocate any memory
      */
@@ -452,7 +453,7 @@ class AliHLTResizableArray : public AliHLTArray<typename AliHLTInternal::TypeFor
     /**
      * frees the data
      */
-    inline ~AliHLTResizableArray() { AliHLTInternal::Allocator<T, alignment>::Free( Parent::fData, Parent::fSize ); }
+    inline ~AliHLTResizableArray() { AliHLTInternal::AliAllocator<T, alignment>::Free( Parent::fData, Parent::fSize ); }
 
     /**
      * use for 1-dim arrays: resizes the memory for the array to x * sizeof(T) bytes.
@@ -512,7 +513,7 @@ class AliHLTFixedArray : public AliHLTArray<typename AliHLTInternal::TypeForAlig
 {
   public:
     typedef typename AliHLTInternal::TypeForAlignmentHelper<T, alignment>::Type T2;
-    typedef AliHLTInternal::ArrayBase<T2, Size::Dim> Parent;
+    typedef AliHLTInternal::AliHLTArrayBase<T2, Size::Dim> Parent;
     inline AliHLTFixedArray() {
       Parent::fData = fFixedArray.ConstructAlignedData();
       Parent::SetBounds( 0, Size::Size - 1 );
@@ -520,14 +521,17 @@ class AliHLTFixedArray : public AliHLTArray<typename AliHLTInternal::TypeForAlig
     }
 
   private:
-    AliHLTInternal::AlignedData<typename AliHLTInternal::TypeForAlignmentHelper<T, alignment>::Type, Size::Size, alignment> fFixedArray;
+    AliHLTInternal::AlignedData<typename AliHLTInternal::TypeForAlignmentHelper<T, alignment>::Type, Size::Size, alignment> fFixedArray; // data array
 
     // disable allocation on the heap
     void *operator new( size_t );
 
     // disable copy
+#ifdef HLTCA_GPUCODE
+#else
     AliHLTFixedArray( const AliHLTFixedArray & );
     AliHLTFixedArray &operator=( const AliHLTFixedArray & );
+#endif
 };
 
 
@@ -543,7 +547,7 @@ class AliHLTFixedArray : public AliHLTArray<typename AliHLTInternal::TypeForAlig
 namespace AliHLTInternal
 {
 #ifdef ENABLE_ARRAY_BOUNDS_CHECKING
-  inline bool ArrayBoundsCheck::IsInBounds( int x ) const
+  inline bool AliArrayBoundsCheck::IsInBounds( int x ) const
   {
     assert( x >= fStart );
     assert( x <= fEnd );
@@ -552,45 +556,45 @@ namespace AliHLTInternal
 #endif
 
   template<typename T>
-  inline AliHLTArray<T, 1> ArrayBase<T, 2>::operator[]( int x )
+  inline AliHLTArray<T, 1> AliHLTArrayBase<T, 2>::operator[]( int x )
   {
     x *= fStride;
     typedef AliHLTArray<T, 1> AT1;
     BOUNDS_CHECK( x, AT1() );
     AliHLTArray<T, 1> a;
     a.fData = &fData[x];
-    a.ArrayBoundsCheck::operator=( *this );
+    a.AliArrayBoundsCheck::operator=( *this );
     a.MoveBounds( -x );
     return a;
   }
 
   template<typename T>
-  inline const AliHLTArray<T, 1> ArrayBase<T, 2>::operator[]( int x ) const
+  inline const AliHLTArray<T, 1> AliHLTArrayBase<T, 2>::operator[]( int x ) const
   {
     x *= fStride;
     typedef AliHLTArray<T, 1> AT1;
     BOUNDS_CHECK( x, AT1() );
     AliHLTArray<T, 1> a;
     a.fData = &fData[x];
-    a.ArrayBoundsCheck::operator=( *this );
+    a.AliArrayBoundsCheck::operator=( *this );
     a.MoveBounds( -x );
     return a;
   }
 
   template<typename T>
-  inline typename AliHLTInternal::ReturnTypeHelper<T>::Type &ArrayBase<T, 3>::operator()( int x, int y, int z )
+  inline typename AliHLTInternal::ReturnTypeHelper<T>::Type &AliHLTArrayBase<T, 3>::operator()( int x, int y, int z )
   {
     BOUNDS_CHECK( x * fStrideX + y + fStrideY + z, fData[0] );
     return fData[x * fStrideX + y + fStrideY + z];
   }
   template<typename T>
-  inline const typename AliHLTInternal::ReturnTypeHelper<T>::Type &ArrayBase<T, 3>::operator()( int x, int y, int z ) const
+  inline const typename AliHLTInternal::ReturnTypeHelper<T>::Type &AliHLTArrayBase<T, 3>::operator()( int x, int y, int z ) const
   {
     BOUNDS_CHECK( x * fStrideX + y + fStrideY + z, fData[0] );
     return fData[x * fStrideX + y + fStrideY + z];
   }
   template<typename T>
-  inline AliHLTArray<T, 2> ArrayBase<T, 3>::operator[]( int x )
+  inline AliHLTArray<T, 2> AliHLTArrayBase<T, 3>::operator[]( int x )
   {
     x *= fStrideX;
     typedef AliHLTArray<T, 2> AT2;
@@ -598,12 +602,12 @@ namespace AliHLTInternal
     AliHLTArray<T, 2> a;
     a.fData = &fData[x];
     a.fStride = fStrideY;
-    a.ArrayBoundsCheck::operator=( *this );
+    a.AliArrayBoundsCheck::operator=( *this );
     a.MoveBounds( -x );
     return a;
   }
   template<typename T>
-  inline const AliHLTArray<T, 2> ArrayBase<T, 3>::operator[]( int x ) const
+  inline const AliHLTArray<T, 2> AliHLTArrayBase<T, 3>::operator[]( int x ) const
   {
     x *= fStrideX;
     typedef AliHLTArray<T, 2> AT2;
@@ -611,7 +615,7 @@ namespace AliHLTInternal
     AliHLTArray<T, 2> a;
     a.fData = &fData[x];
     a.fStride = fStrideY;
-    a.ArrayBoundsCheck::operator=( *this );
+    a.AliArrayBoundsCheck::operator=( *this );
     a.MoveBounds( -x );
     return a;
   }
@@ -646,7 +650,7 @@ template<typename T, int Dim, int alignment>
 inline AliHLTResizableArray<T, Dim, alignment>::AliHLTResizableArray( int x )
 {
   ALIHLTARRAY_STATIC_ASSERT( Dim == 1, AliHLTResizableArray1_used_with_incorrect_dimension );
-  Parent::fData = AliHLTInternal::Allocator<T, alignment>::Alloc( x );
+  Parent::fData = AliHLTInternal::AliAllocator<T, alignment>::Alloc( x );
   Parent::SetSize( x, 0, 0 );
   Parent::SetBounds( 0, x - 1 );
 }
@@ -654,7 +658,7 @@ template<typename T, int Dim, int alignment>
 inline AliHLTResizableArray<T, Dim, alignment>::AliHLTResizableArray( int x, int y )
 {
   ALIHLTARRAY_STATIC_ASSERT( Dim == 2, AliHLTResizableArray2_used_with_incorrect_dimension );
-  Parent::fData = AliHLTInternal::Allocator<T, alignment>::Alloc( x * y );
+  Parent::fData = AliHLTInternal::AliAllocator<T, alignment>::Alloc( x * y );
   Parent::SetSize( x, y, 0 );
   Parent::SetBounds( 0, x * y - 1 );
 }
@@ -662,7 +666,7 @@ template<typename T, int Dim, int alignment>
 inline AliHLTResizableArray<T, Dim, alignment>::AliHLTResizableArray( int x, int y, int z )
 {
   ALIHLTARRAY_STATIC_ASSERT( Dim == 3, AliHLTResizableArray3_used_with_incorrect_dimension );
-  Parent::fData = AliHLTInternal::Allocator<T, alignment>::Alloc( x * y * z );
+  Parent::fData = AliHLTInternal::AliAllocator<T, alignment>::Alloc( x * y * z );
   Parent::SetSize( x, y, z );
   Parent::SetBounds( 0, x * y * z - 1 );
 }
@@ -670,8 +674,8 @@ template<typename T, int Dim, int alignment>
 inline void AliHLTResizableArray<T, Dim, alignment>::Resize( int x )
 {
   ALIHLTARRAY_STATIC_ASSERT( Dim == 1, AliHLTResizableArray1_resize_used_with_incorrect_dimension );
-  AliHLTInternal::Allocator<T, alignment>::Free( Parent::fData, Parent::fSize );
-  Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::Allocator<T, alignment>::Alloc( x );
+  AliHLTInternal::AliAllocator<T, alignment>::Free( Parent::fData, Parent::fSize );
+  Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::AliAllocator<T, alignment>::Alloc( x );
   Parent::SetSize( x, 0, 0 );
   Parent::SetBounds( 0, x - 1 );
 }
@@ -679,8 +683,8 @@ template<typename T, int Dim, int alignment>
 inline void AliHLTResizableArray<T, Dim, alignment>::Resize( int x, int y )
 {
   ALIHLTARRAY_STATIC_ASSERT( Dim == 2, AliHLTResizableArray2_resize_used_with_incorrect_dimension );
-  AliHLTInternal::Allocator<T, alignment>::Free( Parent::fData, Parent::fSize );
-  Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::Allocator<T, alignment>::Alloc( x * y );
+  AliHLTInternal::AliAllocator<T, alignment>::Free( Parent::fData, Parent::fSize );
+  Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::AliAllocator<T, alignment>::Alloc( x * y );
   Parent::SetSize( x, y, 0 );
   Parent::SetBounds( 0, x * y - 1 );
 }
@@ -688,8 +692,8 @@ template<typename T, int Dim, int alignment>
 inline void AliHLTResizableArray<T, Dim, alignment>::Resize( int x, int y, int z )
 {
   ALIHLTARRAY_STATIC_ASSERT( Dim == 3, AliHLTResizableArray3_resize_used_with_incorrect_dimension );
-  AliHLTInternal::Allocator<T, alignment>::Free( Parent::fData, Parent::fSize );
-  Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::Allocator<T, alignment>::Alloc( x * y * z );
+  AliHLTInternal::AliAllocator<T, alignment>::Free( Parent::fData, Parent::fSize );
+  Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::AliAllocator<T, alignment>::Alloc( x * y * z );
   Parent::SetSize( x, y, z );
   Parent::SetBounds( 0, x * y * z - 1 );
 }