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 13 of file DynArray.h.

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

Definition at line 12 of file DynArray.h.

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

Definition at line 10 of file DynArray.h.

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

Definition at line 11 of file DynArray.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file DynArray.h.

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

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

Definition at line 17 of file DynArray.h.

17 : 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 19 of file DynArray.h.

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

19  : a((T*)(storage)), s(isize){
20  for (auto i=0U; i<s; ++i) new((begin()+i)) T();
21  }
T * a
Definition: DynArray.h:7
T * begin()
Definition: DynArray.h:36
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 22 of file DynArray.h.

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

22  : a((T*)(storage)), s(isize){
23  for (auto i=0U; i<s; ++i) new((begin()+i)) T(it);
24  }
T * a
Definition: DynArray.h:7
T * begin()
Definition: DynArray.h:36
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 29 of file DynArray.h.

References trackingPlots::other.

29 { a=other.a; s=other.s; other.s=0; other.a=nullptr;}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
DynArray< T >::~DynArray ( )
inline

Definition at line 33 of file DynArray.h.

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

33 { for (auto i=0U; i<s; ++i) a[i].~T(); }
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 39 of file DynArray.h.

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

39 { 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 49 of file DynArray.h.

49 { 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 36 of file DynArray.h.

References DynArray< T >::a.

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

36 { return a;}
T * a
Definition: DynArray.h:7
template<typename T>
T const* DynArray< T >::begin ( void  ) const
inline

Definition at line 42 of file DynArray.h.

References DynArray< T >::a.

42 { 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 45 of file DynArray.h.

References DynArray< T >::s.

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

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

Definition at line 37 of file DynArray.h.

References DynArray< T >::s.

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

37 { 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 43 of file DynArray.h.

References DynArray< T >::s.

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

43 { 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 38 of file DynArray.h.

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

Definition at line 48 of file DynArray.h.

48 { 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 30 of file DynArray.h.

References trackingPlots::other.

30 { a=other.a; s=other.s; other.s=0; other.a=nullptr; return *this;}
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 35 of file DynArray.h.

References mps_fire::i.

35 { 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 41 of file DynArray.h.

References mps_fire::i.

41 { return a[i];}
T * a
Definition: DynArray.h:7
template<typename T>
void DynArray< T >::pop_back ( )
inline

Definition at line 51 of file DynArray.h.

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

51 {back().~T(); --s;}
T & back()
Definition: DynArray.h:39
unsigned int s
Definition: DynArray.h:8
template<typename T>
void DynArray< T >::push_back ( T const &  t)
inline

Definition at line 52 of file DynArray.h.

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

52 {new((begin()+s)) T(t);++s;}
T * begin()
Definition: DynArray.h:36
unsigned int s
Definition: DynArray.h:8
long double T
template<typename T>
void DynArray< T >::push_back ( T &&  t)
inline

Definition at line 53 of file DynArray.h.

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

53 {new((begin()+s)) T(t);++s;}
T * begin()
Definition: DynArray.h:36
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