From dd5579d1e1865835f62216004a5fe04376295b31 Mon Sep 17 00:00:00 2001 From: richterm Date: Tue, 15 Mar 2011 13:32:38 +0000 Subject: [PATCH] changing some names to fulfill coding rules --- HLT/BASE/AliHLTArray.h | 94 +++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/HLT/BASE/AliHLTArray.h b/HLT/BASE/AliHLTArray.h index 61c062e0a51..dee7d93c457 100644 --- a/HLT/BASE/AliHLTArray.h +++ b/HLT/BASE/AliHLTArray.h @@ -51,7 +51,7 @@ #endif enum { - AliHLTFullyCacheLineAligned = -1 + kAliHLTFullyCacheLineAligned = -1 }; #if defined(__CUDACC__) & 0 @@ -87,7 +87,7 @@ namespace AliHLTInternal PaddingSize = RequiredSize - sizeof( T ) }; }; - template class CacheLineSizeHelper : private CacheLineSizeHelperData, private Padding::PaddingSize> + template class AliCacheLineSizeHelper : private CacheLineSizeHelperData, private Padding::PaddingSize> { public: operator T &() { return CacheLineSizeHelperData::fData; } @@ -97,10 +97,10 @@ namespace AliHLTInternal private: }; template struct TypeForAlignmentHelper { typedef T Type; }; - template struct TypeForAlignmentHelper { typedef CacheLineSizeHelper Type; }; + template struct TypeForAlignmentHelper { typedef AliCacheLineSizeHelper 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. @@ -108,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 ReinterpretCast( const AliArrayBoundsCheck &, int, int ) {} }; #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 */ @@ -139,7 +139,7 @@ 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; } @@ -148,9 +148,9 @@ namespace AliHLTInternal 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 class Allocator + template class AliAllocator { public: #ifdef USE_MM_MALLOC @@ -171,10 +171,10 @@ namespace AliHLTInternal } #endif }; - template class Allocator + template class AliAllocator { public: - typedef CacheLineSizeHelper T2; + typedef AliCacheLineSizeHelper T2; #ifdef USE_MM_MALLOC static inline T2 *Alloc( int s ) { T2 *p = reinterpret_cast( _mm_malloc( s * sizeof( T2 ), 128 ) ); return new( p ) T2[s]; } static inline void Free( T2 *const p, int size ) { @@ -193,7 +193,7 @@ namespace AliHLTInternal } #endif }; - template class Allocator + template class AliAllocator { public: static inline T *Alloc( int s ) { return new T[s]; } @@ -201,7 +201,7 @@ namespace AliHLTInternal }; template struct ReturnTypeHelper { typedef T Type; }; - template struct ReturnTypeHelper > { typedef T Type; }; + template struct ReturnTypeHelper > { typedef T Type; }; /** * Array base class for dimension dependent behavior */ @@ -211,13 +211,13 @@ namespace AliHLTInternal * 1-dim arrays only have operator[] */ template - class ArrayBase : public ArrayBoundsCheck + class ArrayBase : public AliArrayBoundsCheck { friend class ArrayBase; 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 + ArrayBase( const ArrayBase &rhs ) : AliArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ) {} // XXX + ArrayBase &operator=( const ArrayBase &rhs ) { AliArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; return *this; } // XXX typedef typename ReturnTypeHelper::Type R; /** * return a reference to the value at the given index @@ -239,13 +239,13 @@ namespace AliHLTInternal * operator[] can be used to return a 1-dim array */ template - class ArrayBase : public ArrayBoundsCheck + class ArrayBase : public AliArrayBoundsCheck { friend class ArrayBase; 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 + ArrayBase( const ArrayBase &rhs ) : AliArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStride( rhs.fStride ) {} // XXX + ArrayBase &operator=( const ArrayBase &rhs ) { AliArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStride = rhs.fStride; return *this; } // XXX typedef typename ReturnTypeHelper::Type R; /** * return a reference to the value at the given indexes @@ -267,7 +267,7 @@ namespace AliHLTInternal protected: T *fData; // actual data int fSize; // data size - int fStride; // + int fStride; // stride inline void SetSize( int x, int y, int ) { fStride = y; fSize = x * y; } }; @@ -276,12 +276,12 @@ namespace AliHLTInternal * operator[] can be used to return a 2-dim array */ template - class ArrayBase : public ArrayBoundsCheck + class ArrayBase : 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 + ArrayBase( const ArrayBase &rhs ) : AliArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStrideX( rhs.fStrideX ), fStrideY( rhs.fStrideY ) {} // XXX + ArrayBase &operator=( const ArrayBase &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::Type R; /** @@ -304,8 +304,8 @@ namespace AliHLTInternal protected: T *fData; // actual data int fSize; // data size - int fStrideX; // - int fStrideY; // + 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; } }; @@ -326,19 +326,19 @@ namespace AliHLTInternal } 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 class AlignedData { public: T *ConstructAlignedData() { return &fArray[0]; } private: - T fArray[Size]; // + T fArray[Size]; // data array }; } // namespace AliHLTInternal @@ -463,7 +463,7 @@ class AliHLTResizableArray : public AliHLTArray::Free( Parent::fData, Parent::fSize ); } + inline ~AliHLTResizableArray() { AliHLTInternal::AliAllocator::Free( Parent::fData, Parent::fSize ); } /** * use for 1-dim arrays: resizes the memory for the array to x * sizeof(T) bytes. @@ -531,7 +531,7 @@ class AliHLTFixedArray : public AliHLTArray::Type, Size::Size, alignment> fFixedArray; // + AliHLTInternal::AlignedData::Type, Size::Size, alignment> fFixedArray; // data array // disable allocation on the heap void *operator new( size_t ); @@ -557,7 +557,7 @@ class AliHLTFixedArray : public AliHLTArray= fStart ); assert( x <= fEnd ); @@ -573,7 +573,7 @@ namespace AliHLTInternal BOUNDS_CHECK( x, AT1() ); AliHLTArray a; a.fData = &fData[x]; - a.ArrayBoundsCheck::operator=( *this ); + a.AliArrayBoundsCheck::operator=( *this ); a.MoveBounds( -x ); return a; } @@ -586,7 +586,7 @@ namespace AliHLTInternal BOUNDS_CHECK( x, AT1() ); AliHLTArray a; a.fData = &fData[x]; - a.ArrayBoundsCheck::operator=( *this ); + a.AliArrayBoundsCheck::operator=( *this ); a.MoveBounds( -x ); return a; } @@ -612,7 +612,7 @@ namespace AliHLTInternal AliHLTArray a; a.fData = &fData[x]; a.fStride = fStrideY; - a.ArrayBoundsCheck::operator=( *this ); + a.AliArrayBoundsCheck::operator=( *this ); a.MoveBounds( -x ); return a; } @@ -625,7 +625,7 @@ namespace AliHLTInternal AliHLTArray a; a.fData = &fData[x]; a.fStride = fStrideY; - a.ArrayBoundsCheck::operator=( *this ); + a.AliArrayBoundsCheck::operator=( *this ); a.MoveBounds( -x ); return a; } @@ -660,7 +660,7 @@ template inline AliHLTResizableArray::AliHLTResizableArray( int x ) { ALIHLTARRAY_STATIC_ASSERT( Dim == 1, AliHLTResizableArray1_used_with_incorrect_dimension ); - Parent::fData = AliHLTInternal::Allocator::Alloc( x ); + Parent::fData = AliHLTInternal::AliAllocator::Alloc( x ); Parent::SetSize( x, 0, 0 ); Parent::SetBounds( 0, x - 1 ); } @@ -668,7 +668,7 @@ template inline AliHLTResizableArray::AliHLTResizableArray( int x, int y ) { ALIHLTARRAY_STATIC_ASSERT( Dim == 2, AliHLTResizableArray2_used_with_incorrect_dimension ); - Parent::fData = AliHLTInternal::Allocator::Alloc( x * y ); + Parent::fData = AliHLTInternal::AliAllocator::Alloc( x * y ); Parent::SetSize( x, y, 0 ); Parent::SetBounds( 0, x * y - 1 ); } @@ -676,7 +676,7 @@ template inline AliHLTResizableArray::AliHLTResizableArray( int x, int y, int z ) { ALIHLTARRAY_STATIC_ASSERT( Dim == 3, AliHLTResizableArray3_used_with_incorrect_dimension ); - Parent::fData = AliHLTInternal::Allocator::Alloc( x * y * z ); + Parent::fData = AliHLTInternal::AliAllocator::Alloc( x * y * z ); Parent::SetSize( x, y, z ); Parent::SetBounds( 0, x * y * z - 1 ); } @@ -684,8 +684,8 @@ template inline void AliHLTResizableArray::Resize( int x ) { ALIHLTARRAY_STATIC_ASSERT( Dim == 1, AliHLTResizableArray1_resize_used_with_incorrect_dimension ); - AliHLTInternal::Allocator::Free( Parent::fData, Parent::fSize ); - Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::Allocator::Alloc( x ); + AliHLTInternal::AliAllocator::Free( Parent::fData, Parent::fSize ); + Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::AliAllocator::Alloc( x ); Parent::SetSize( x, 0, 0 ); Parent::SetBounds( 0, x - 1 ); } @@ -693,8 +693,8 @@ template inline void AliHLTResizableArray::Resize( int x, int y ) { ALIHLTARRAY_STATIC_ASSERT( Dim == 2, AliHLTResizableArray2_resize_used_with_incorrect_dimension ); - AliHLTInternal::Allocator::Free( Parent::fData, Parent::fSize ); - Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::Allocator::Alloc( x * y ); + AliHLTInternal::AliAllocator::Free( Parent::fData, Parent::fSize ); + Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::AliAllocator::Alloc( x * y ); Parent::SetSize( x, y, 0 ); Parent::SetBounds( 0, x * y - 1 ); } @@ -702,8 +702,8 @@ template inline void AliHLTResizableArray::Resize( int x, int y, int z ) { ALIHLTARRAY_STATIC_ASSERT( Dim == 3, AliHLTResizableArray3_resize_used_with_incorrect_dimension ); - AliHLTInternal::Allocator::Free( Parent::fData, Parent::fSize ); - Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::Allocator::Alloc( x * y * z ); + AliHLTInternal::AliAllocator::Free( Parent::fData, Parent::fSize ); + Parent::fData = ( x == 0 ) ? 0 : AliHLTInternal::AliAllocator::Alloc( x * y * z ); Parent::SetSize( x, y, z ); Parent::SetBounds( 0, x * y * z - 1 ); } -- 2.43.0