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

#include <PndFTSArray.h>

Inheritance diagram for PndFTSInternal::ArrayBase< T, 2 >:
PndFTSInternal::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)
 
const Roperator() (int x, int y) const
 
PndFTSArray< T, 1 > operator[] (int x)
 
const PndFTSArray< T, 1 > operator[] (int x) const
 

Protected Member Functions

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

Protected Attributes

TfData
 
int fSize
 
int fStride
 

Friends

class ArrayBase< T, 3 >
 

Detailed Description

template<typename T>
class PndFTSInternal::ArrayBase< T, 2 >

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

Definition at line 259 of file PndFTSArray.h.

Member Typedef Documentation

template<typename T >
typedef ReturnTypeHelper<T>::Type PndFTSInternal::ArrayBase< T, 2 >::R

Definition at line 266 of file PndFTSArray.h.

Constructor & Destructor Documentation

template<typename T >
PndFTSInternal::ArrayBase< T, 2 >::ArrayBase ( )
inline

Definition at line 263 of file PndFTSArray.h.

263 : fData( 0 ), fSize( 0 ), fStride( 0 ) {} // XXX really shouldn't be done. But -Weffc++ wants it so
template<typename T >
PndFTSInternal::ArrayBase< T, 2 >::ArrayBase ( const ArrayBase< T, 2 > &  rhs)
inline

Definition at line 264 of file PndFTSArray.h.

264 : ArrayBoundsCheck( rhs ), fData( rhs.fData ), fSize( rhs.fSize ), fStride( rhs.fStride ) {} // XXX

Member Function Documentation

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

Definition at line 113 of file PndFTSArray.h.

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

Definition at line 115 of file PndFTSArray.h.

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

return a reference to the value at the given indexes

Definition at line 270 of file PndFTSArray.h.

References BOUNDS_CHECK, and y.

270 { BOUNDS_CHECK( x * fStride + y, fData[0] ); return fData[x * fStride + y]; }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:118
Double_t x
Double_t y
template<typename T >
const R& PndFTSInternal::ArrayBase< T, 2 >::operator() ( int  x,
int  y 
) const
inline

return a const reference to the value at the given indexes

Definition at line 274 of file PndFTSArray.h.

References BOUNDS_CHECK, and y.

274 { BOUNDS_CHECK( x * fStride + y, fData[0] ); return fData[x * fStride + y]; }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:118
Double_t x
Double_t y
template<typename T >
ArrayBase& PndFTSInternal::ArrayBase< T, 2 >::operator= ( const ArrayBase< T, 2 > &  rhs)
inline

Definition at line 265 of file PndFTSArray.h.

265 { ArrayBoundsCheck::operator=( rhs ); fData = rhs.fData; fSize = rhs.fSize; fStride = rhs.fStride; return *this; } // XXX
template<typename T >
PndFTSArray< T, 1 > PndFTSInternal::ArrayBase< T, 2 >::operator[] ( int  x)
inline

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

Definition at line 587 of file PndFTSArray.h.

References a, and x.

588  {
589  x *= fStride;
590  //typedef PndFTSArray<T, 1> AT1;
591  //BOUNDS_CHECK( x, AT1() );
593  a.fData = &fData[x];
594  a.ArrayBoundsCheck::operator=( *this );
595  a.MoveBounds( -x );
596  return a;
597  }
Int_t a
Definition: anaLmdDigi.C:126
Double_t x
template<typename T >
const PndFTSArray< T, 1 > PndFTSInternal::ArrayBase< T, 2 >::operator[] ( int  x) const
inline

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

Definition at line 600 of file PndFTSArray.h.

References a, and x.

601  {
602  x *= fStride;
603  //typedef PndFTSArray<T, 1> AT1;
604  //BOUNDS_CHECK( x, AT1() );
606  a.fData = &fData[x];
607  a.ArrayBoundsCheck::operator=( *this );
608  a.MoveBounds( -x );
609  return a;
610  }
Int_t a
Definition: anaLmdDigi.C:126
Double_t x
void PndFTSInternal::ArrayBoundsCheck::ReinterpretCast ( const ArrayBoundsCheck ,
int  ,
int   
)
inlineprotectedinherited

Definition at line 116 of file PndFTSArray.h.

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

Definition at line 114 of file PndFTSArray.h.

114 {}
template<typename T >
void PndFTSInternal::ArrayBase< T, 2 >::SetSize ( int  x,
int  y,
int   
)
inlineprotected

Definition at line 288 of file PndFTSArray.h.

References y.

Friends And Related Function Documentation

template<typename T >
friend class ArrayBase< T, 3 >
friend

Definition at line 261 of file PndFTSArray.h.

Member Data Documentation

template<typename T >
T* PndFTSInternal::ArrayBase< T, 2 >::fData
protected

Definition at line 285 of file PndFTSArray.h.

template<typename T >
int PndFTSInternal::ArrayBase< T, 2 >::fSize
protected

Definition at line 286 of file PndFTSArray.h.

template<typename T >
int PndFTSInternal::ArrayBase< T, 2 >::fStride
protected

Definition at line 287 of file PndFTSArray.h.


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