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 (DynArray &&other)
 
 DynArray (DynArray const &)=delete
 
 DynArray (unsigned char *storage)
 
 DynArray (unsigned char *storage, unsigned int isize)
 
 DynArray (unsigned char *storage, unsigned int isize, T const &it)
 
bool empty () const
 
Tend ()
 
T const * end () const
 
Tfront ()
 
T const & front () const
 
DynArrayoperator= (DynArray &&other)
 
DynArrayoperator= (DynArray const &)=delete
 
Toperator[] (unsigned int i)
 
T const & operator[] (unsigned int i) const
 
void pop_back ()
 
void push_back (T &&t)
 
void push_back (T const &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) {}

◆ DynArray() [3/6]

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

Definition at line 20 of file DynArray.h.

20  : a((T*)(storage)), s(isize) {
21  for (auto i = 0U; i < s; ++i)
22  new ((begin() + i)) T();
23  }

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

◆ 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.

24  : a((T*)(storage)), s(isize) {
25  for (auto i = 0U; i < s; ++i)
26  new ((begin() + i)) T(it);
27  }

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

◆ 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.

32  {
33  a = other.a;
34  s = other.s;
35  other.s = 0;
36  other.a = nullptr;
37  }

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

◆ ~DynArray()

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

Definition at line 46 of file DynArray.h.

46  {
47  for (auto i = 0U; i < s; ++i)
48  a[i].~T();
49  }

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

Member Function Documentation

◆ back() [1/2]

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

Definition at line 55 of file DynArray.h.

55 { return a[s - 1]; }

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

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

◆ back() [2/2]

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

Definition at line 65 of file DynArray.h.

65 { return a[s - 1]; }

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

◆ begin() [1/2]

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

Definition at line 52 of file DynArray.h.

52 { return a; }

References DynArray< T >::a.

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

◆ begin() [2/2]

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

Definition at line 58 of file DynArray.h.

58 { return a; }

References DynArray< T >::a.

◆ 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.

61 { return 0 == s; }

References DynArray< T >::s.

◆ end() [1/2]

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

Definition at line 53 of file DynArray.h.

53 { return a + s; }

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

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

◆ end() [2/2]

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

Definition at line 59 of file DynArray.h.

59 { return a + s; }

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

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

◆ front() [1/2]

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

Definition at line 54 of file DynArray.h.

54 { return a[0]; }

References DynArray< T >::a.

◆ front() [2/2]

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

Definition at line 64 of file DynArray.h.

64 { return a[0]; }

References DynArray< T >::a.

◆ operator=() [1/2]

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

Definition at line 38 of file DynArray.h.

38  {
39  a = other.a;
40  s = other.s;
41  other.s = 0;
42  other.a = nullptr;
43  return *this;
44  }

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

◆ operator=() [2/2]

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

◆ operator[]() [1/2]

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

Definition at line 51 of file DynArray.h.

51 { return a[i]; }

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

◆ operator[]() [2/2]

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

Definition at line 57 of file DynArray.h.

57 { return a[i]; }

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

◆ pop_back()

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

Definition at line 67 of file DynArray.h.

67  {
68  back().~T();
69  --s;
70  }

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

◆ push_back() [1/2]

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

Definition at line 75 of file DynArray.h.

75  {
76  new ((begin() + s)) T(t);
77  ++s;
78  }

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

◆ push_back() [2/2]

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

Definition at line 71 of file DynArray.h.

71  {
72  new ((begin() + s)) T(t);
73  ++s;
74  }

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

◆ size()

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

Definition at line 60 of file DynArray.h.

60 { return s; }

References DynArray< T >::s.

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

Member Data Documentation

◆ a

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

◆ s

template<typename T>
unsigned int DynArray< T >::s = 0
mps_fire.i
i
Definition: mps_fire.py:428
DynArray::a
T * a
Definition: DynArray.h:7
DynArray::begin
T * begin()
Definition: DynArray.h:52
DynArray::back
T & back()
Definition: DynArray.h:55
DynArray::s
unsigned int s
Definition: DynArray.h:8
trackingPlots.other
other
Definition: trackingPlots.py:1464
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
T
long double T
Definition: Basic3DVectorLD.h:48
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644