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 31 of file PndTrkVectors.h.

Constructor & Destructor Documentation

◆ Vec()

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

Definition at line 39 of file PndTrkVectors.h.

40  {
41  if (dim < 0 || dim > 1000000) {
42  cout << "PndTrkVectors::Vec the dimension of the array " << nam << " is " << dim << " and not acceptable; exit(-2) the program.\n";
43  exit(-2);
44  }
45  dimension = dim;
46  array = p;
47  name = nam;
48  };
TString name
Definition: PndTrkVectors.h:35
T * array
Definition: PndTrkVectors.h:36
int dimension
Definition: PndTrkVectors.h:34

◆ ~Vec()

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

Definition at line 50 of file PndTrkVectors.h.

50 { ; };

Member Function Documentation

◆ at()

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

Definition at line 53 of file PndTrkVectors.h.

54  {
55 
56  if (index >= 0 && index < dimension) {
57  T &alias = array[index];
58  return alias;
59  }
60  cout << "PndTrkVectors:: array " << name << ": index = " << index << " and it is out of bounds [from 0 to " << dimension - 1 << " included]; exiting the process.\n";
61  exit(-1);
62  };
TString name
Definition: PndTrkVectors.h:35
T * array
Definition: PndTrkVectors.h:36
int dimension
Definition: PndTrkVectors.h:34

◆ operator[]()

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

Definition at line 65 of file PndTrkVectors.h.

66  {
67 
68  T &alias = at(index);
69  return alias;
70  };
T & at(int index)
Definition: PndTrkVectors.h:53

Member Data Documentation

◆ array

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

Definition at line 36 of file PndTrkVectors.h.

◆ dimension

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

Definition at line 34 of file PndTrkVectors.h.

◆ name

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

Definition at line 35 of file PndTrkVectors.h.


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