PandaRoot
Vec< T > Class Template Reference

#include <PndTrkVectors.h>

Public Member Functions

 Vec (T *p, int dim, TString nam)
 
 ~Vec ()
 
T & at (int index)
 
T & operator[] (int index)
 

Public Attributes

int dimension
 
TString name
 
T * array
 

Detailed Description

template<class T>
class Vec< T >

Definition at line 43 of file PndTrkVectors.h.

Constructor & Destructor Documentation

◆ Vec()

template<class T>
Vec< T >::Vec ( T *  p,
int  dim,
TString  nam 
)
inline

Definition at line 51 of file PndTrkVectors.h.

52  {
53  if (dim < 0 || dim > 1000000) {
54  cout << "PndTrkVectors::Vec the dimension of the array " << nam << " is " << dim << " and not acceptable; exit(-2) the program.\n";
55  exit(-2);
56  }
57  dimension = dim;
58  array = p;
59  name = nam;
60  };
TString name
Definition: PndTrkVectors.h:47
T * array
Definition: PndTrkVectors.h:48
int dimension
Definition: PndTrkVectors.h:46

◆ ~Vec()

template<class T>
Vec< T >::~Vec ( )
inline

Definition at line 62 of file PndTrkVectors.h.

62 { ; };

Member Function Documentation

◆ at()

template<class T>
T& Vec< T >::at ( int  index)
inline

Definition at line 65 of file PndTrkVectors.h.

66  {
67 
68  if (index >= 0 && index < dimension) {
69  T &alias = array[index];
70  return alias;
71  }
72  cout << "PndTrkVectors:: array " << name << ": index = " << index << " and it is out of bounds [from 0 to " << dimension - 1 << " included]; exiting the process.\n";
73  exit(-1);
74  };
TString name
Definition: PndTrkVectors.h:47
T * array
Definition: PndTrkVectors.h:48
int dimension
Definition: PndTrkVectors.h:46

◆ operator[]()

template<class T>
T& Vec< T >::operator[] ( int  index)
inline

Definition at line 77 of file PndTrkVectors.h.

78  {
79 
80  T &alias = at(index);
81  return alias;
82  };
T & at(int index)
Definition: PndTrkVectors.h:65

Member Data Documentation

◆ array

template<class T>
T* Vec< T >::array

Definition at line 48 of file PndTrkVectors.h.

◆ dimension

template<class T>
int Vec< T >::dimension

Definition at line 46 of file PndTrkVectors.h.

◆ name

template<class T>
TString Vec< T >::name

Definition at line 47 of file PndTrkVectors.h.


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