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 76 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 480 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 518 of file PndCAArray.h.

518 { 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 523 of file PndCAArray.h.

523 { 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 495 of file PndCAArray.h.

495 { 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 491 of file PndCAArray.h.

491 { 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 500 of file PndCAArray.h.

501  {
502  BOUNDS_CHECK(0, Parent::fData[0]);
503  return *Parent::fData;
504  }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:134

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

509  {
510  BOUNDS_CHECK(0, Parent::fData[0]);
511  return *Parent::fData;
512  }
#define BOUNDS_CHECK(x, y)
Definition: PndCAArray.h:134

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

765 {
766  PndCAArray<T, Dim> r(*this);
767  r.fData += x;
768  r.MoveBounds(-x);
769  return r;
770 }

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

773 {
774  PndCAArray<T, Dim> r(*this);
775  r.fData -= x;
776  r.MoveBounds(x);
777  return r;
778 }

◆ ReinterpretCast()

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

Definition at line 535 of file PndCAArray.h.

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

536  {
538  r.fData = reinterpret_cast<Other *>(Parent::fData);
539  r.ReinterpretCast(*this, sizeof(T), sizeof(Other));
540  }
PndCAArray< Other, Dim > ReinterpretCast() const
Definition: PndCAArray.h:535

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

486 { return Parent::fSize; }

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