CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.push_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
int i
Definition: DBlmapReader.cc:9
const size_type m_vecSize
Definition: EZMgrVL.h:52
iterator assign(size_type size, const T &t=T()) const
Definition: EZMgrVL.h:31
iterator reserve(size_type size) const
Definition: EZMgrVL.h:28
uint16_t size_type
VecType::const_iterator const_iterator
Definition: EZMgrVL.h:14
std::vector< T > VecType
Definition: EZMgrVL.h:12
VecType::reference reference
Definition: EZMgrVL.h:15
VecType::iterator iterator
Definition: EZMgrVL.h:13
VecType::size_type size_type
Definition: EZMgrVL.h:18
VecType m_vec
Definition: EZMgrVL.h:53
Container::value_type value_type
VecType::const_reference const_reference
Definition: EZMgrVL.h:16
iterator resize(size_type size) const
Definition: EZMgrVL.h:29
Definition: EZMgrVL.h:8
VecType::value_type value_type
Definition: EZMgrVL.h:17
EZMgrVL & operator=(const EZMgrVL &)
long double T
tuple size
Write out results.