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

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

Definition at line 14 of file DynArray.h.

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

Definition at line 13 of file DynArray.h.

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

Definition at line 11 of file DynArray.h.

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

Definition at line 12 of file DynArray.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file DynArray.h.

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

16 {}
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
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
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(), DynArray< T >::DynArray(), mps_fire::i, DynArray< T >::operator=(), 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
template<typename T>
DynArray< T >::DynArray ( DynArray< T > const &  )
delete
template<typename T>
DynArray< T >::DynArray ( DynArray< T > &&  other)
inline

Definition at line 32 of file DynArray.h.

References trackingPlots::other.

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
template<typename T>
DynArray< T >::~DynArray ( )
inline

Definition at line 46 of file DynArray.h.

References 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

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

Definition at line 55 of file DynArray.h.

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

55 { return a[s - 1]; }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
T const& DynArray< T >::back ( ) const
inline

Definition at line 65 of file DynArray.h.

65 { return a[s - 1]; }
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
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
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
template<typename T>
T const* DynArray< T >::data ( ) const
inline
template<typename T>
bool DynArray< T >::empty ( ) const
inline

Definition at line 61 of file DynArray.h.

References DynArray< T >::s.

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().

61 { return 0 == s; }
unsigned int s
Definition: DynArray.h:8
template<typename T>
T* DynArray< T >::end ( void  )
inline

Definition at line 53 of file DynArray.h.

References 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
template<typename T>
T const* DynArray< T >::end ( void  ) const
inline

Definition at line 59 of file DynArray.h.

References 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
template<typename T>
T& DynArray< T >::front ( )
inline

Definition at line 54 of file DynArray.h.

54 { return a[0]; }
T * a
Definition: DynArray.h:7
template<typename T>
T const& DynArray< T >::front ( ) const
inline

Definition at line 64 of file DynArray.h.

64 { return a[0]; }
T * a
Definition: DynArray.h:7
template<typename T>
DynArray& DynArray< T >::operator= ( DynArray< T > const &  )
delete

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

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

Definition at line 38 of file DynArray.h.

References trackingPlots::other.

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
template<typename T>
T& DynArray< T >::operator[] ( unsigned int  i)
inline

Definition at line 51 of file DynArray.h.

References mps_fire::i.

51 { return a[i]; }
T * a
Definition: DynArray.h:7
template<typename T>
T const& DynArray< T >::operator[] ( unsigned int  i) const
inline

Definition at line 57 of file DynArray.h.

References mps_fire::i.

57 { return a[i]; }
T * a
Definition: DynArray.h:7
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
template<typename T>
void DynArray< T >::push_back ( T const &  t)
inline

Definition at line 71 of file DynArray.h.

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

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
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 OrderedSet::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
template<typename T>
unsigned int DynArray< T >::size ( void  ) const
inline

Member Data Documentation

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

Definition at line 7 of file DynArray.h.

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

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