PandaRoot
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)
 
- 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 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 340 of file PndFTSArray.h.

Member Typedef Documentation

◆ R

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

Definition at line 354 of file PndFTSArray.h.

Constructor & Destructor Documentation

◆ ArrayBase() [1/2]

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

Definition at line 344 of file PndFTSArray.h.

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

◆ ArrayBase() [2/2]

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

Definition at line 345 of file PndFTSArray.h.

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

Member Function Documentation

◆ operator()() [1/2]

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 358 of file PndFTSArray.h.

References BOUNDS_CHECK.

359  {
360  BOUNDS_CHECK(x * fStride + y, fData[0]);
361  return fData[x * fStride + y];
362  }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:134

◆ operator()() [2/2]

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 366 of file PndFTSArray.h.

References BOUNDS_CHECK, and operator[]().

367  {
368  BOUNDS_CHECK(x * fStride + y, fData[0]);
369  return fData[x * fStride + y];
370  }
#define BOUNDS_CHECK(x, y)
Definition: PndFTSArray.h:134

◆ operator=()

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

Definition at line 346 of file PndFTSArray.h.

347  {
348  ArrayBoundsCheck::operator=(rhs);
349  fData = rhs.fData;
350  fSize = rhs.fSize;
351  fStride = rhs.fStride;
352  return *this;
353  } // XXX

◆ operator[]() [1/2]

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 698 of file PndFTSArray.h.

699 {
700  x *= fStride;
701  // typedef PndFTSArray<T, 1> AT1;
702  // BOUNDS_CHECK( x, AT1() );
704  a.fData = &fData[x];
705  a.ArrayBoundsCheck::operator=(*this);
706  a.MoveBounds(-x);
707  return a;
708 }

◆ operator[]() [2/2]

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 711 of file PndFTSArray.h.

712 {
713  x *= fStride;
714  // typedef PndFTSArray<T, 1> AT1;
715  // BOUNDS_CHECK( x, AT1() );
717  a.fData = &fData[x];
718  a.ArrayBoundsCheck::operator=(*this);
719  a.MoveBounds(-x);
720  return a;
721 }

◆ SetSize()

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

Definition at line 384 of file PndFTSArray.h.

385  {
386  fStride = y;
387  fSize = x * y;
388  }

Friends And Related Function Documentation

◆ ArrayBase< T, 3 >

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

Definition at line 341 of file PndFTSArray.h.

Member Data Documentation

◆ fData

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

Definition at line 381 of file PndFTSArray.h.

◆ fSize

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

Definition at line 382 of file PndFTSArray.h.

◆ fStride

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

Definition at line 383 of file PndFTSArray.h.


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