FairRoot/PandaRoot
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndCAFixedArray< T, Size, alignment > Class Template Reference

#include <PndCAArray.h>

Inheritance diagram for PndCAFixedArray< T, Size, alignment >:
PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Dim > PndCAInternal::ArrayBase< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type, Dim >

Public Types

typedef
PndCAInternal::TypeForAlignmentHelper
< T, alignment >::Type 
T2
 
typedef
PndCAInternal::ArrayBase< T2,
Size::Dim > 
Parent
 

Public Member Functions

 PndCAFixedArray ()
 
 PndCAFixedArray (const PndCAFixedArray &rhs)
 
int Size () const
 
 operator bool () const
 
bool IsValid () const
 
PndCAInternal::TypeForAlignmentHelper
< T, alignment >::Type & 
operator* ()
 
const
PndCAInternal::TypeForAlignmentHelper
< T, alignment >::Type & 
operator* () const
 
PndCAInternal::TypeForAlignmentHelper
< T, alignment >::Type * 
Data ()
 
const
PndCAInternal::TypeForAlignmentHelper
< T, alignment >::Type * 
Data () const
 
PndCAArray operator+ (int x) const
 
PndCAArray operator- (int x) const
 
PndCAArray< Other, Dim > ReinterpretCast () const
 

Private Member Functions

void * operator new (size_t)
 
PndCAFixedArrayoperator= (const PndCAFixedArray &)
 

Private Attributes

PndCAInternal::AlignedData
< typename
PndCAInternal::TypeForAlignmentHelper
< T, alignment >::Type,
Size::Size, alignment > 
fFixedArray
 

Detailed Description

template<typename T, typename Size, int alignment = 0>
class PndCAFixedArray< T, Size, alignment >

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

The memory is allocated on the stack.

Instantiate this class on the stack.

Parameters
Ttype of the entries in the array.
Sizenumber of 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)

Definition at line 536 of file PndCAArray.h.

Member Typedef Documentation

template<typename T , typename Size , int alignment = 0>
typedef PndCAInternal::ArrayBase<T2, Size::Dim> PndCAFixedArray< T, Size, alignment >::Parent

Definition at line 540 of file PndCAArray.h.

template<typename T , typename Size , int alignment = 0>
typedef PndCAInternal::TypeForAlignmentHelper<T, alignment>::Type PndCAFixedArray< T, Size, alignment >::T2

Definition at line 539 of file PndCAArray.h.

Constructor & Destructor Documentation

template<typename T , typename Size , int alignment = 0>
PndCAFixedArray< T, Size, alignment >::PndCAFixedArray ( )
inline

Definition at line 541 of file PndCAArray.h.

References X, Y, and Z.

541  {
543  Parent::SetBounds( 0, Size::Size - 1 );
544  SetSize( Size::X, Size::Y, Size::Z );
545  }
double Y
Definition: anaLmdDigi.C:68
PndCAInternal::AlignedData< typename PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Size, alignment > fFixedArray
Definition: PndCAArray.h:554
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
template<typename T , typename Size , int alignment = 0>
PndCAFixedArray< T, Size, alignment >::PndCAFixedArray ( const PndCAFixedArray< T, Size, alignment > &  rhs)
inline

Definition at line 546 of file PndCAArray.h.

References T, X, Y, and Z.

546  {
548  Parent::SetBounds( 0, Size::Size - 1 );
549  SetSize( Size::X, Size::Y, Size::Z );
550  std::memcpy( fData, rhs.fData, Size::Size * sizeof( T ) );
551  }
double Y
Definition: anaLmdDigi.C:68
TTree * T
Definition: anaLmdReco.C:32
PndCAInternal::AlignedData< typename PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Size, alignment > fFixedArray
Definition: PndCAArray.h:554
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68

Member Function Documentation

PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type * PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::Data ( )
inlineinherited

returns a pointer to the data This circumvents bounds checking so it should not be used.

Definition at line 398 of file PndCAArray.h.

398 { return Parent::fData; }
const PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type * PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::Data ( ) const
inlineinherited

returns a const pointer to the data This circumvents bounds checking so it should not be used.

Definition at line 403 of file PndCAArray.h.

403 { return Parent::fData; }
bool PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::IsValid ( ) const
inlineinherited

allows you to check for validity of the array

Definition at line 383 of file PndCAArray.h.

383 { return Parent::fData != 0; }
PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::operator bool ( ) const
inlineinherited

allows you to check for validity of the array by casting to bool

Definition at line 379 of file PndCAArray.h.

379 { return Parent::fData != 0; }
template<typename T , typename Size , int alignment = 0>
void* PndCAFixedArray< T, Size, alignment >::operator new ( size_t  )
private
PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type & PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::operator* ( )
inlineinherited

returns a reference to the data at index 0

Definition at line 388 of file PndCAArray.h.

References BOUNDS_CHECK.

388 { BOUNDS_CHECK( 0, Parent::fData[0] ); return *Parent::fData; }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:118
const PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type & PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::operator* ( ) const
inlineinherited

returns a const reference to the data at index 0

Definition at line 392 of file PndCAArray.h.

References BOUNDS_CHECK.

392 { BOUNDS_CHECK( 0, Parent::fData[0] ); return *Parent::fData; }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:118
PndCAArray PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::operator+ ( int  x) const
inlineinherited

moves the array base pointer so that the data that was once at index 0 will then be at index -x

PndCAArray PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::operator- ( int  x) const
inlineinherited

moves the array base pointer so that the data that was once at index 0 will then be at index x

template<typename T , typename Size , int alignment = 0>
PndCAFixedArray& PndCAFixedArray< T, Size, alignment >::operator= ( const PndCAFixedArray< T, Size, alignment > &  )
private
PndCAArray<Other, Dim> PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::ReinterpretCast ( ) const
inlineinherited

Definition at line 414 of file PndCAArray.h.

References r, PndCAArray< T, Dim >::ReinterpretCast(), and T.

414  {
416  r.fData = reinterpret_cast<Other *>( Parent::fData );
417  r.ReinterpretCast( *this, sizeof( T ), sizeof( Other ) );
418  }
double r
Definition: RiemannTest.C:14
PndCAArray< Other, Dim > ReinterpretCast() const
Definition: PndCAArray.h:414
TTree * T
Definition: anaLmdReco.C:32
int PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::Size ( ) const
inlineinherited

Returns the number of elements in the array. If it is a multi-dimensional array the size is the multiplication of the dimensions ( e.g. a 10 x 20 array returns 200 as its size ).

Definition at line 374 of file PndCAArray.h.

374 { return Parent::fSize; }

Member Data Documentation

template<typename T , typename Size , int alignment = 0>
PndCAInternal::AlignedData<typename PndCAInternal::TypeForAlignmentHelper<T, alignment>::Type, Size::Size, alignment> PndCAFixedArray< T, Size, alignment >::fFixedArray
private

Definition at line 554 of file PndCAArray.h.


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