PandaRoot
PndCAArray< T, Dim > Class Template Reference

#include <PndCAArray.h>

Inheritance diagram for PndCAArray< T, Dim >:
PndCAInternal::ArrayBase< T, Dim >

Public Types

typedef PndCAInternal::ArrayBase< T, Dim > Parent
 

Public Member Functions

int Size () const
 
 operator bool () const
 
bool IsValid () const
 
T & operator* ()
 
const T & operator* () const
 
T * Data ()
 
const T * Data () const
 
PndCAArray operator+ (int x) const
 
PndCAArray operator- (int x) const
 
template<typename Other >
PndCAArray< Other, Dim > ReinterpretCast () const
 

Detailed Description

template<typename T, int Dim = 1>
class PndCAArray< T, Dim >

C-Array like class with the dimension dependent behavior defined in the ArrayBase class

Definition at line 88 of file PndCAArray.h.

Member Typedef Documentation

◆ Parent

template<typename T, int Dim = 1>
typedef PndCAInternal::ArrayBase<T, Dim> PndCAArray< T, Dim >::Parent

Definition at line 492 of file PndCAArray.h.

Member Function Documentation

◆ Data() [1/2]

template<typename T, int Dim = 1>
T* PndCAArray< T, Dim >::Data ( )
inline

returns a pointer to the data This circumvents bounds checking so it should not be used.

Definition at line 530 of file PndCAArray.h.

530 { return Parent::fData; }

◆ Data() [2/2]

template<typename T, int Dim = 1>
const T* PndCAArray< T, Dim >::Data ( ) const
inline

returns a const pointer to the data This circumvents bounds checking so it should not be used.

Definition at line 535 of file PndCAArray.h.

535 { return Parent::fData; }

◆ IsValid()

template<typename T, int Dim = 1>
bool PndCAArray< T, Dim >::IsValid ( ) const
inline

allows you to check for validity of the array

Definition at line 507 of file PndCAArray.h.

507 { return Parent::fData != 0; }

◆ operator bool()

template<typename T, int Dim = 1>
PndCAArray< T, Dim >::operator bool ( ) const
inline

allows you to check for validity of the array by casting to bool

Definition at line 503 of file PndCAArray.h.

503 { return Parent::fData != 0; }

◆ operator*() [1/2]

template<typename T, int Dim = 1>
T& PndCAArray< T, Dim >::operator* ( )
inline

returns a reference to the data at index 0

Definition at line 512 of file PndCAArray.h.

513  {
514  BOUNDS_CHECK(0, Parent::fData[0]);
515  return *Parent::fData;
516  }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:146

◆ operator*() [2/2]

template<typename T, int Dim = 1>
const T& PndCAArray< T, Dim >::operator* ( ) const
inline

returns a const reference to the data at index 0

Definition at line 520 of file PndCAArray.h.

521  {
522  BOUNDS_CHECK(0, Parent::fData[0]);
523  return *Parent::fData;
524  }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:146

◆ operator+()

template<typename T , int Dim>
PndCAArray< T, Dim > PndCAArray< T, Dim >::operator+ ( int  x) const
inline

moves the array base pointer so that the data that was once at index 0 will then be at index -x

Definition at line 776 of file PndCAArray.h.

777 {
778  PndCAArray<T, Dim> r(*this);
779  r.fData += x;
780  r.MoveBounds(-x);
781  return r;
782 }

◆ operator-()

template<typename T , int Dim>
PndCAArray< T, Dim > PndCAArray< T, Dim >::operator- ( int  x) const
inline

moves the array base pointer so that the data that was once at index 0 will then be at index x

Definition at line 784 of file PndCAArray.h.

785 {
786  PndCAArray<T, Dim> r(*this);
787  r.fData -= x;
788  r.MoveBounds(x);
789  return r;
790 }

◆ ReinterpretCast()

template<typename T, int Dim = 1>
template<typename Other >
PndCAArray<Other, Dim> PndCAArray< T, Dim >::ReinterpretCast ( ) const
inline

Definition at line 547 of file PndCAArray.h.

Referenced by PndCAArray< PndCAInternal::TypeForAlignmentHelper< T, alignment >::Type, Size::Dim >::ReinterpretCast().

548  {
550  r.fData = reinterpret_cast<Other *>(Parent::fData);
551  r.ReinterpretCast(*this, sizeof(T), sizeof(Other));
552  }
PndCAArray< Other, Dim > ReinterpretCast() const
Definition: PndCAArray.h:547

◆ Size()

template<typename T, int Dim = 1>
int PndCAArray< T, Dim >::Size ( ) const
inline

Returns the number of elements in the array. If it is a multi-dimensional array the size is the multiplication of the dimensions ( e.g. a 10 x 20 array returns 200 as its size ).

Definition at line 498 of file PndCAArray.h.

498 { return Parent::fSize; }

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