PandaRoot
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)
 
- Protected Member Functions inherited from PndCAInternal::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 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 408 of file PndCAArray.h.

Member Typedef Documentation

◆ R

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

Definition at line 421 of file PndCAArray.h.

Constructor & Destructor Documentation

◆ ArrayBase() [1/2]

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

Definition at line 410 of file PndCAArray.h.

410 : 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 >
PndCAInternal::ArrayBase< T, 3 >::ArrayBase ( const ArrayBase< T, 3 > &  rhs)
inline

Definition at line 411 of file PndCAArray.h.

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

Member Function Documentation

◆ operator()() [1/2]

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 736 of file PndCAArray.h.

References BOUNDS_CHECK.

737 {
738  BOUNDS_CHECK(x * fStrideX + y + fStrideY + z, fData[0]);
739  return fData[x * fStrideX + y + fStrideY + z];
740 }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:146

◆ operator()() [2/2]

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 742 of file PndCAArray.h.

References BOUNDS_CHECK.

743 {
744  BOUNDS_CHECK(x * fStrideX + y + fStrideY + z, fData[0]);
745  return fData[x * fStrideX + y + fStrideY + z];
746 }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:146

◆ operator=()

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

Definition at line 412 of file PndCAArray.h.

413  {
414  ArrayBoundsCheck::operator=(rhs);
415  fData = rhs.fData;
416  fSize = rhs.fSize;
417  fStrideX = rhs.fStrideX;
418  fStrideY = rhs.fStrideY;
419  return *this;
420  } // XXX

◆ operator[]() [1/2]

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 748 of file PndCAArray.h.

References BOUNDS_CHECK.

749 {
750  x *= fStrideX;
751  typedef PndCAArray<T, 2> AT2;
752  BOUNDS_CHECK(x, AT2());
754  a.fData = &fData[x];
755  a.fStride = fStrideY;
756  a.ArrayBoundsCheck::operator=(*this);
757  a.MoveBounds(-x);
758  return a;
759 }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:146

◆ operator[]() [2/2]

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 761 of file PndCAArray.h.

References BOUNDS_CHECK.

762 {
763  x *= fStrideX;
764  typedef PndCAArray<T, 2> AT2;
765  BOUNDS_CHECK(x, AT2());
767  a.fData = &fData[x];
768  a.fStride = fStrideY;
769  a.ArrayBoundsCheck::operator=(*this);
770  a.MoveBounds(-x);
771  return a;
772 }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:146

◆ SetSize()

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

Definition at line 444 of file PndCAArray.h.

Member Data Documentation

◆ fData

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

Definition at line 440 of file PndCAArray.h.

◆ fSize

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

Definition at line 441 of file PndCAArray.h.

◆ fStrideX

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

Definition at line 442 of file PndCAArray.h.

◆ fStrideY

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

Definition at line 443 of file PndCAArray.h.


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