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

#include <PndFTSArray.h>

Inheritance diagram for PndFTSFixedArray< T, Size, alignment >:
PndFTSArray< PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Dim > PndFTSInternal::ArrayBase< PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type, Dim >

Public Types

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

Public Member Functions

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

Private Member Functions

void * operator new (size_t)
 
PndFTSFixedArrayoperator= (const PndFTSFixedArray &)
 

Private Attributes

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

Detailed Description

template<typename T, typename Size, int alignment = 0>
class PndFTSFixedArray< 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 PndFTSArray.h.

Member Typedef Documentation

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

Definition at line 540 of file PndFTSArray.h.

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

Definition at line 539 of file PndFTSArray.h.

Constructor & Destructor Documentation

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

Definition at line 541 of file PndFTSArray.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
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
PndFTSInternal::AlignedData< typename PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Size, alignment > fFixedArray
Definition: PndFTSArray.h:554
template<typename T , typename Size , int alignment = 0>
PndFTSFixedArray< T, Size, alignment >::PndFTSFixedArray ( const PndFTSFixedArray< T, Size, alignment > &  rhs)
inline

Definition at line 546 of file PndFTSArray.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
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
PndFTSInternal::AlignedData< typename PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Size, alignment > fFixedArray
Definition: PndFTSArray.h:554

Member Function Documentation

PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type * PndFTSArray< PndFTSInternal::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 PndFTSArray.h.

398 { return Parent::fData; }
const PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type * PndFTSArray< PndFTSInternal::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 PndFTSArray.h.

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

allows you to check for validity of the array

Definition at line 383 of file PndFTSArray.h.

383 { return Parent::fData != 0; }
PndFTSArray< PndFTSInternal::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 PndFTSArray.h.

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

returns a reference to the data at index 0

Definition at line 388 of file PndFTSArray.h.

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

returns a const reference to the data at index 0

Definition at line 392 of file PndFTSArray.h.

392 { BOUNDS_CHECK( 0, Parent::fData[0] ); return *Parent::fData; }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:118
PndFTSArray PndFTSArray< PndFTSInternal::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

PndFTSArray PndFTSArray< PndFTSInternal::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>
PndFTSFixedArray& PndFTSFixedArray< T, Size, alignment >::operator= ( const PndFTSFixedArray< T, Size, alignment > &  )
private
PndFTSArray<Other, Dim> PndFTSArray< PndFTSInternal::TypeForAlignmentHelper< T, alignment >::Type , Dim >::ReinterpretCast ( ) const
inlineinherited

Definition at line 414 of file PndFTSArray.h.

414  {
416  r.fData = reinterpret_cast<Other *>( Parent::fData );
417  r.ReinterpretCast( *this, sizeof( T ), sizeof( Other ) );
418  }
PndFTSArray< Other, Dim > ReinterpretCast() const
Definition: PndFTSArray.h:414
double r
Definition: RiemannTest.C:14
TTree * T
Definition: anaLmdReco.C:32
int PndFTSArray< PndFTSInternal::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 PndFTSArray.h.

374 { return Parent::fSize; }

Member Data Documentation

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

Definition at line 554 of file PndFTSArray.h.


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