FairRoot/PandaRoot
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PndCAInternal::ArrayBase< T, 3 > Class Template Reference

#include <PndCAArray.h>

Inheritance diagram for PndCAInternal::ArrayBase< T, 3 >:
PndCAInternal::ArrayBoundsCheck

Public Types

typedef ReturnTypeHelper< T >::Type R
 

Public Member Functions

 ArrayBase ()
 
 ArrayBase (const ArrayBase &rhs)
 
ArrayBaseoperator= (const ArrayBase &rhs)
 
Roperator() (int x, int y, int z)
 
const Roperator() (int x, int y, int z) const
 
PndCAArray< T, 2 > operator[] (int x)
 
const PndCAArray< T, 2 > operator[] (int x) const
 

Protected Member Functions

void SetSize (int x, int y, int z)
 
bool IsInBounds (int) const
 
void SetBounds (int, int)
 
void MoveBounds (int)
 
void ReinterpretCast (const ArrayBoundsCheck &, int, int)
 

Protected Attributes

TfData
 
int fSize
 
int fStrideX
 
int fStrideY
 

Detailed Description

template<typename T>
class PndCAInternal::ArrayBase< T, 3 >

3-dim arrays should use operator(int, int, int) operator[] can be used to return a 2-dim array

Definition at line 296 of file PndCAArray.h.

Member Typedef Documentation

template<typename T >
typedef ReturnTypeHelper<T>::Type PndCAInternal::ArrayBase< T, 3 >::R

Definition at line 302 of file PndCAArray.h.

Constructor & Destructor Documentation

template<typename T >
PndCAInternal::ArrayBase< T, 3 >::ArrayBase ( )
inline

Definition at line 299 of file PndCAArray.h.

299 : fData( 0 ), fSize( 0 ), fStrideX( 0 ), fStrideY( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
template<typename T >
PndCAInternal::ArrayBase< T, 3 >::ArrayBase ( const ArrayBase< T, 3 > &  rhs)
inline

Definition at line 300 of file PndCAArray.h.

300 : ArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStrideX( rhs.fStrideX ), fStrideY( rhs.fStrideY ) {} // XXX

Member Function Documentation

bool PndCAInternal::ArrayBoundsCheck::IsInBounds ( int  ) const
inlineprotectedinherited

Definition at line 113 of file PndCAArray.h.

113 { return true; }
void PndCAInternal::ArrayBoundsCheck::MoveBounds ( int  )
inlineprotectedinherited

Definition at line 115 of file PndCAArray.h.

115 {}
template<typename T >
PndCAInternal::ArrayBase< T, 3 >::R & PndCAInternal::ArrayBase< T, 3 >::operator() ( int  x,
int  y,
int  z 
)
inline

return a reference to the value at the given indexes

Definition at line 613 of file PndCAArray.h.

References BOUNDS_CHECK, and z.

614  {
615  BOUNDS_CHECK( x * fStrideX + y + fStrideY + z, fData[0] );
616  return fData[x * fStrideX + y + fStrideY + z];
617  }
Double_t z
Double_t x
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:118
Double_t y
template<typename T >
const PndCAInternal::ArrayBase< T, 3 >::R & PndCAInternal::ArrayBase< T, 3 >::operator() ( int  x,
int  y,
int  z 
) const
inline

return a const reference to the value at the given indexes

Definition at line 619 of file PndCAArray.h.

References BOUNDS_CHECK, and z.

620  {
621  BOUNDS_CHECK( x * fStrideX + y + fStrideY + z, fData[0] );
622  return fData[x * fStrideX + y + fStrideY + z];
623  }
Double_t z
Double_t x
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:118
Double_t y
template<typename T >
ArrayBase& PndCAInternal::ArrayBase< T, 3 >::operator= ( const ArrayBase< T, 3 > &  rhs)
inline

Definition at line 301 of file PndCAArray.h.

301 { ArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStrideX = rhs.fStrideX; fStrideY = rhs.fStrideY; return *this; } // XXX
template<typename T >
PndCAArray< T, 2 > PndCAInternal::ArrayBase< T, 3 >::operator[] ( int  x)
inline

return a 2-dim array at the given index. This makes it behave like a 3-dim C-Array.

Definition at line 625 of file PndCAArray.h.

References a, BOUNDS_CHECK, and x.

626  {
627  x *= fStrideX;
628  typedef PndCAArray<T, 2> AT2;
629  BOUNDS_CHECK( x, AT2() );
631  a.fData = &fData[x];
632  a.fStride = fStrideY;
633  a.ArrayBoundsCheck::operator=( *this );
634  a.MoveBounds( -x );
635  return a;
636  }
Int_t a
Definition: anaLmdDigi.C:126
Double_t x
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:118
template<typename T >
const PndCAArray< T, 2 > PndCAInternal::ArrayBase< T, 3 >::operator[] ( int  x) const
inline

return a const 2-dim array at the given index. This makes it behave like a 3-dim C-Array.

Definition at line 638 of file PndCAArray.h.

References a, BOUNDS_CHECK, and x.

639  {
640  x *= fStrideX;
641  typedef PndCAArray<T, 2> AT2;
642  BOUNDS_CHECK( x, AT2() );
644  a.fData = &fData[x];
645  a.fStride = fStrideY;
646  a.ArrayBoundsCheck::operator=( *this );
647  a.MoveBounds( -x );
648  return a;
649  }
Int_t a
Definition: anaLmdDigi.C:126
Double_t x
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:118
void PndCAInternal::ArrayBoundsCheck::ReinterpretCast ( const ArrayBoundsCheck ,
int  ,
int   
)
inlineprotectedinherited

Definition at line 116 of file PndCAArray.h.

116 {}
void PndCAInternal::ArrayBoundsCheck::SetBounds ( int  ,
int   
)
inlineprotectedinherited

Definition at line 114 of file PndCAArray.h.

114 {}
template<typename T >
void PndCAInternal::ArrayBase< T, 3 >::SetSize ( int  x,
int  y,
int  z 
)
inlineprotected

Definition at line 325 of file PndCAArray.h.

References x, and z.

Member Data Documentation

template<typename T >
T* PndCAInternal::ArrayBase< T, 3 >::fData
protected

Definition at line 321 of file PndCAArray.h.

template<typename T >
int PndCAInternal::ArrayBase< T, 3 >::fSize
protected

Definition at line 322 of file PndCAArray.h.

template<typename T >
int PndCAInternal::ArrayBase< T, 3 >::fStrideX
protected

Definition at line 323 of file PndCAArray.h.

template<typename T >
int PndCAInternal::ArrayBase< T, 3 >::fStrideY
protected

Definition at line 324 of file PndCAArray.h.


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