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

Member Typedef Documentation

◆ R

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

Definition at line 409 of file PndCAArray.h.

Constructor & Destructor Documentation

◆ ArrayBase() [1/2]

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

Definition at line 398 of file PndCAArray.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 >
PndCAInternal::ArrayBase< T, 3 >::ArrayBase ( const ArrayBase< T, 3 > &  rhs)
inline

Definition at line 399 of file PndCAArray.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 >
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 724 of file PndCAArray.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: PndCAArray.h:134

◆ 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 730 of file PndCAArray.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: PndCAArray.h:134

◆ operator=()

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

Definition at line 400 of file PndCAArray.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 >
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 736 of file PndCAArray.h.

References BOUNDS_CHECK.

737 {
738  x *= fStrideX;
739  typedef PndCAArray<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 }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:134

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

References BOUNDS_CHECK.

750 {
751  x *= fStrideX;
752  typedef PndCAArray<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 }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:134

◆ SetSize()

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

Definition at line 432 of file PndCAArray.h.

Member Data Documentation

◆ fData

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

Definition at line 428 of file PndCAArray.h.

◆ fSize

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

Definition at line 429 of file PndCAArray.h.

◆ fStrideX

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

Definition at line 430 of file PndCAArray.h.

◆ fStrideY

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

Definition at line 431 of file PndCAArray.h.


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