CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes
DynArray< T > Class Template Reference

#include <DynArray.h>

Public Types

using const_reference = T const &
 
using reference = T &
 
using size_type = unsigned int
 
using value_type = T
 

Public Member Functions

Tback ()
 
T const & back () const
 
Tbegin ()
 
T const * begin () const
 
T const * data () const
 
 DynArray ()
 
 DynArray (unsigned char *storage)
 
 DynArray (unsigned char *storage, unsigned int isize)
 
 DynArray (unsigned char *storage, unsigned int isize, T const &it)
 
 DynArray (DynArray const &)=delete
 
 DynArray (DynArray &&other)
 
bool empty () const
 
Tend ()
 
T const * end () const
 
Tfront ()
 
T const & front () const
 
DynArrayoperator= (DynArray const &)=delete
 
DynArrayoperator= (DynArray &&other)
 
Toperator[] (unsigned int i)
 
T const & operator[] (unsigned int i) const
 
void pop_back ()
 
void push_back (T const &t)
 
void push_back (T &&t)
 
unsigned int size () const
 
 ~DynArray ()
 

Public Attributes

Ta = nullptr
 
unsigned int s = 0
 

Detailed Description

template<typename T>
class DynArray< T >

Definition at line 5 of file DynArray.h.

Member Typedef Documentation

◆ const_reference

template<typename T>
using DynArray< T >::const_reference = T const&

Definition at line 14 of file DynArray.h.

◆ reference

template<typename T>
using DynArray< T >::reference = T&

Definition at line 13 of file DynArray.h.

◆ size_type

template<typename T>
using DynArray< T >::size_type = unsigned int

Definition at line 11 of file DynArray.h.

◆ value_type

template<typename T>
using DynArray< T >::value_type = T

Definition at line 12 of file DynArray.h.

Constructor & Destructor Documentation

◆ DynArray() [1/6]

template<typename T>
DynArray< T >::DynArray ( )
inline

Definition at line 16 of file DynArray.h.

16 {}

◆ DynArray() [2/6]

template<typename T>
DynArray< T >::DynArray ( unsigned char *  storage)
inlineexplicit

Definition at line 18 of file DynArray.h.

18 : a((T*)(storage)), s(0) {}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
long double T

◆ DynArray() [3/6]

template<typename T>
DynArray< T >::DynArray ( unsigned char *  storage,
unsigned int  isize 
)
inline

Definition at line 20 of file DynArray.h.

References DynArray< T >::begin(), mps_fire::i, DynArray< T >::s, and mitigatedMETSequence_cff::U.

20  : a((T*)(storage)), s(isize) {
21  for (auto i = 0U; i < s; ++i)
22  new ((begin() + i)) T();
23  }
T * a
Definition: DynArray.h:7
T * begin()
Definition: DynArray.h:52
unsigned int s
Definition: DynArray.h:8
long double T

◆ DynArray() [4/6]

template<typename T>
DynArray< T >::DynArray ( unsigned char *  storage,
unsigned int  isize,
T const &  it 
)
inline

Definition at line 24 of file DynArray.h.

References DynArray< T >::begin(), mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, DynArray< T >::s, and mitigatedMETSequence_cff::U.

24  : a((T*)(storage)), s(isize) {
25  for (auto i = 0U; i < s; ++i)
26  new ((begin() + i)) T(it);
27  }
T * a
Definition: DynArray.h:7
T * begin()
Definition: DynArray.h:52
unsigned int s
Definition: DynArray.h:8
long double T

◆ DynArray() [5/6]

template<typename T>
DynArray< T >::DynArray ( DynArray< T > const &  )
delete

◆ DynArray() [6/6]

template<typename T>
DynArray< T >::DynArray ( DynArray< T > &&  other)
inline

Definition at line 32 of file DynArray.h.

References DynArray< T >::a, trackingPlots::other, and DynArray< T >::s.

32  {
33  a = other.a;
34  s = other.s;
35  other.s = 0;
36  other.a = nullptr;
37  }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8

◆ ~DynArray()

template<typename T>
DynArray< T >::~DynArray ( )
inline

Definition at line 46 of file DynArray.h.

References DynArray< T >::a, mps_fire::i, DynArray< T >::s, and mitigatedMETSequence_cff::U.

46  {
47  for (auto i = 0U; i < s; ++i)
48  a[i].~T();
49  }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
long double T

Member Function Documentation

◆ back() [1/2]

template<typename T>
T& DynArray< T >::back ( )
inline

Definition at line 55 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

Referenced by DynArray< T >::pop_back().

55 { return a[s - 1]; }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8

◆ back() [2/2]

template<typename T>
T const& DynArray< T >::back ( ) const
inline

Definition at line 65 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

65 { return a[s - 1]; }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8

◆ begin() [1/2]

template<typename T>
T* DynArray< T >::begin ( void  )
inline

Definition at line 52 of file DynArray.h.

References DynArray< T >::a.

Referenced by DynArray< T >::DynArray(), and DynArray< T >::push_back().

52 { return a; }
T * a
Definition: DynArray.h:7

◆ begin() [2/2]

template<typename T>
T const* DynArray< T >::begin ( void  ) const
inline

Definition at line 58 of file DynArray.h.

References DynArray< T >::a.

58 { return a; }
T * a
Definition: DynArray.h:7

◆ data()

template<typename T>
T const* DynArray< T >::data ( ) const
inline

◆ empty()

template<typename T>
bool DynArray< T >::empty ( ) const
inline

Definition at line 61 of file DynArray.h.

References DynArray< T >::s.

61 { return 0 == s; }
unsigned int s
Definition: DynArray.h:8

◆ end() [1/2]

template<typename T>
T* DynArray< T >::end ( void  )
inline

Definition at line 53 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

53 { return a + s; }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8

◆ end() [2/2]

template<typename T>
T const* DynArray< T >::end ( void  ) const
inline

Definition at line 59 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

59 { return a + s; }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8

◆ front() [1/2]

template<typename T>
T& DynArray< T >::front ( )
inline

Definition at line 54 of file DynArray.h.

References DynArray< T >::a.

54 { return a[0]; }
T * a
Definition: DynArray.h:7

◆ front() [2/2]

template<typename T>
T const& DynArray< T >::front ( ) const
inline

Definition at line 64 of file DynArray.h.

References DynArray< T >::a.

64 { return a[0]; }
T * a
Definition: DynArray.h:7

◆ operator=() [1/2]

template<typename T>
DynArray& DynArray< T >::operator= ( DynArray< T > const &  )
delete

◆ operator=() [2/2]

template<typename T>
DynArray& DynArray< T >::operator= ( DynArray< T > &&  other)
inline

Definition at line 38 of file DynArray.h.

References DynArray< T >::a, trackingPlots::other, and DynArray< T >::s.

38  {
39  a = other.a;
40  s = other.s;
41  other.s = 0;
42  other.a = nullptr;
43  return *this;
44  }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8

◆ operator[]() [1/2]

template<typename T>
T& DynArray< T >::operator[] ( unsigned int  i)
inline

Definition at line 51 of file DynArray.h.

References DynArray< T >::a, and mps_fire::i.

51 { return a[i]; }
T * a
Definition: DynArray.h:7

◆ operator[]() [2/2]

template<typename T>
T const& DynArray< T >::operator[] ( unsigned int  i) const
inline

Definition at line 57 of file DynArray.h.

References DynArray< T >::a, and mps_fire::i.

57 { return a[i]; }
T * a
Definition: DynArray.h:7

◆ pop_back()

template<typename T>
void DynArray< T >::pop_back ( )
inline

Definition at line 67 of file DynArray.h.

References DynArray< T >::back(), and DynArray< T >::s.

67  {
68  back().~T();
69  --s;
70  }
T & back()
Definition: DynArray.h:55
unsigned int s
Definition: DynArray.h:8

◆ push_back() [1/2]

template<typename T>
void DynArray< T >::push_back ( T const &  t)
inline

Definition at line 71 of file DynArray.h.

References DynArray< T >::begin(), DynArray< T >::s, and submitPVValidationJobs::t.

71  {
72  new ((begin() + s)) T(t);
73  ++s;
74  }
T * begin()
Definition: DynArray.h:52
unsigned int s
Definition: DynArray.h:8
long double T

◆ push_back() [2/2]

template<typename T>
void DynArray< T >::push_back ( T &&  t)
inline

Definition at line 75 of file DynArray.h.

References DynArray< T >::begin(), DynArray< T >::s, and submitPVValidationJobs::t.

75  {
76  new ((begin() + s)) T(t);
77  ++s;
78  }
T * begin()
Definition: DynArray.h:52
unsigned int s
Definition: DynArray.h:8
long double T

◆ size()

template<typename T>
unsigned int DynArray< T >::size ( void  ) const
inline

Definition at line 60 of file DynArray.h.

References DynArray< T >::s.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

60 { return s; }
unsigned int s
Definition: DynArray.h:8

Member Data Documentation

◆ a

template<typename T>
T* DynArray< T >::a = nullptr

◆ s

template<typename T>
unsigned int DynArray< T >::s = 0