CMS 3D CMS Logo

EZMgrVL.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_EZMGRVL_H
2 #define GEOMETRY_CALOGEOMETRY_EZMGRVL_H 1
3 
4 #include <vector>
5 #include <assert.h>
6 
7 template < class T >
8 class EZMgrVL
9 {
10  public:
11 
12  typedef std::vector<T> VecType ;
13  typedef typename VecType::iterator iterator ;
14  typedef typename VecType::const_iterator const_iterator ;
15  typedef typename VecType::reference reference ;
16  typedef typename VecType::const_reference const_reference ;
17  typedef typename VecType::value_type value_type ;
18  typedef typename VecType::size_type size_type ;
19 
20  EZMgrVL< T >( size_type vecSize ) : m_vecSize ( vecSize )
21  {
22  m_vec.resize(0);
23  assert( m_vec.capacity() == 0 ) ;
24  }
25 
26  virtual ~EZMgrVL< T >() {}
27 
28  iterator reserve( size_type size ) const { return assign( size ) ; }
29  iterator resize( size_type size ) const { return assign( size ) ; }
30 
31  iterator assign( size_type size, const T& t = T() ) const
32  {
33  assert( ( m_vec.size() + size ) <= m_vecSize ) ;
34  if( 0 == m_vec.capacity() )
35  {
36  m_vec.reserve( m_vecSize ) ;
37  assert( m_vecSize == m_vec.capacity() ) ;
38  }
39  for( size_type i ( 0 ) ; i != size ; ++i )
40  {
41  m_vec.emplace_back( t ) ;
42  }
43  return ( m_vec.end() - size ) ;
44  }
45 
46  private:
47 
48  EZMgrVL() ; //stop
49  EZMgrVL( const EZMgrVL& ) ; //stop
50  EZMgrVL& operator=( const EZMgrVL& ) ; //stop
51 
53  mutable VecType m_vec ;
54 };
55 
56 #endif
EZMgrVL::size_type
VecType::size_type size_type
Definition: EZMgrVL.h:18
mps_fire.i
i
Definition: mps_fire.py:355
EZMgrVL::const_iterator
VecType::const_iterator const_iterator
Definition: EZMgrVL.h:14
EZMgrVL::operator=
EZMgrVL & operator=(const EZMgrVL &)
cms::cuda::assert
assert(be >=bs)
EZMgrVL::const_reference
VecType::const_reference const_reference
Definition: EZMgrVL.h:16
EZMgrVL::reference
VecType::reference reference
Definition: EZMgrVL.h:15
EZMgrVL::value_type
VecType::value_type value_type
Definition: EZMgrVL.h:17
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
EZMgrVL::assign
iterator assign(size_type size, const T &t=T()) const
Definition: EZMgrVL.h:31
OrderedSet.t
t
Definition: OrderedSet.py:90
EZMgrVL::resize
iterator resize(size_type size) const
Definition: EZMgrVL.h:29
RecoTauValidation_cfi.reference
reference
Definition: RecoTauValidation_cfi.py:234
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
T
long double T
Definition: Basic3DVectorLD.h:48
EZMgrVL::EZMgrVL
EZMgrVL()
EZMgrVL::m_vec
VecType m_vec
Definition: EZMgrVL.h:53
EZMgrVL::iterator
VecType::iterator iterator
Definition: EZMgrVL.h:13
EZMgrVL::m_vecSize
const size_type m_vecSize
Definition: EZMgrVL.h:52
EZMgrVL
Definition: EZMgrVL.h:8
EZMgrVL::VecType
std::vector< T > VecType
Definition: EZMgrVL.h:12
EZMgrVL::reserve
iterator reserve(size_type size) const
Definition: EZMgrVL.h:28
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443