PandaRoot
PndFTSInternal::ArrayBase< T, 3 > Class Template Reference

#include <PndFTSArray.h>

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

Protected Member Functions

void SetSize (int x, int y, int z)
 
- Protected Member Functions inherited from PndFTSInternal::ArrayBoundsCheck
virtual ~ArrayBoundsCheck ()
 
bool IsInBounds (int) const
 
void SetBounds (int, int)
 
void MoveBounds (int)
 
void ReinterpretCast (const ArrayBoundsCheck &, int, int)
 

Protected Attributes

T * fData
 
int fSize
 
int fStrideX
 
int fStrideY
 

Detailed Description

template<typename T>
class PndFTSInternal::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 396 of file PndFTSArray.h.

Member Typedef Documentation

◆ R

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

Definition at line 409 of file PndFTSArray.h.

Constructor & Destructor Documentation

◆ ArrayBase() [1/2]

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

Definition at line 398 of file PndFTSArray.h.

398 : fData(0), fSize(0), fStrideX(0), fStrideY(0) {} // XXX really shouldn't be done. But -Weffc++ wants it so

◆ ArrayBase() [2/2]

template<typename T >
PndFTSInternal::ArrayBase< T, 3 >::ArrayBase ( const ArrayBase< T, 3 > &  rhs)
inline

Definition at line 399 of file PndFTSArray.h.

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

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
PndFTSInternal::ArrayBase< T, 3 >::R & PndFTSInternal::ArrayBase< T, 3 >::operator() ( int  x,
int  y,
int  z 
)
inline

return a reference to the value at the given indexes

Definition at line 724 of file PndFTSArray.h.

References BOUNDS_CHECK.

725 {
726  BOUNDS_CHECK(x * fStrideX + y + fStrideY + z, fData[0]);
727  return fData[x * fStrideX + y + fStrideY + z];
728 }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:134

◆ operator()() [2/2]

template<typename T >
const PndFTSInternal::ArrayBase< T, 3 >::R & PndFTSInternal::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 730 of file PndFTSArray.h.

References BOUNDS_CHECK.

731 {
732  BOUNDS_CHECK(x * fStrideX + y + fStrideY + z, fData[0]);
733  return fData[x * fStrideX + y + fStrideY + z];
734 }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:134

◆ operator=()

template<typename T >
ArrayBase& PndFTSInternal::ArrayBase< T, 3 >::operator= ( const ArrayBase< T, 3 > &  rhs)
inline

Definition at line 400 of file PndFTSArray.h.

401  {
402  ArrayBoundsCheck::operator=(rhs);
403  fData = rhs.fData;
404  fSize = rhs.fSize;
405  fStrideX = rhs.fStrideX;
406  fStrideY = rhs.fStrideY;
407  return *this;
408  } // XXX

◆ operator[]() [1/2]

template<typename T >
PndFTSArray< T, 2 > PndFTSInternal::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 736 of file PndFTSArray.h.

737 {
738  x *= fStrideX;
739  // typedef PndFTSArray<T, 2> AT2;
740  // BOUNDS_CHECK( x, AT2() );
742  a.fData = &fData[x];
743  a.fStride = fStrideY;
744  a.ArrayBoundsCheck::operator=(*this);
745  a.MoveBounds(-x);
746  return a;
747 }

◆ operator[]() [2/2]

template<typename T >
const PndFTSArray< T, 2 > PndFTSInternal::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 749 of file PndFTSArray.h.

750 {
751  x *= fStrideX;
752  // typedef PndFTSArray<T, 2> AT2;
753  // BOUNDS_CHECK( x, AT2() );
755  a.fData = &fData[x];
756  a.fStride = fStrideY;
757  a.ArrayBoundsCheck::operator=(*this);
758  a.MoveBounds(-x);
759  return a;
760 }

◆ SetSize()

template<typename T >
void PndFTSInternal::ArrayBase< T, 3 >::SetSize ( int  x,
int  y,
int  z 
)
inlineprotected

Definition at line 432 of file PndFTSArray.h.

Member Data Documentation

◆ fData

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

Definition at line 428 of file PndFTSArray.h.

◆ fSize

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

Definition at line 429 of file PndFTSArray.h.

◆ fStrideX

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

Definition at line 430 of file PndFTSArray.h.

◆ fStrideY

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

Definition at line 431 of file PndFTSArray.h.


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