CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EZMgrFL.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_EZMGRFL_H
2 #define GEOMETRY_CALOGEOMETRY_EZMGRFL_H 1
3 
4 #include <vector>
5 #include <assert.h>
6 
7 template < class T >
8 class EZMgrFL
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 
22  m_subSize ( subSize )
23  {
24  m_vec.resize(0);
25  assert( subSize > 0 ) ;
26  assert( vecSize > 0 ) ;
27  assert( 0 == m_vec.capacity() ) ;
28  }
29 
30  virtual ~EZMgrFL< T >() {}
31 
32  iterator reserve() const { return assign() ; }
33  iterator resize() const { return assign() ; }
34 
35  iterator assign( const T& t = T() ) const
36  {
37  assert( ( m_vec.size() + m_subSize ) <= m_vecSize ) ;
38  if( 0 == m_vec.capacity() )
39  {
40  m_vec.reserve( m_vecSize ) ;
41  assert( m_vecSize == m_vec.capacity() ) ;
42  }
43  for( size_type i ( 0 ) ; i != m_subSize ; ++i )
44  {
45  m_vec.push_back( t ) ;
46  }
47  return ( m_vec.end() - m_subSize ) ;
48  }
49 
50  size_type subSize() const { return m_subSize ; }
51  size_type size() const { return m_vec.size(); }
52 
53  size_type vecSize() const { return m_vec.size() ; }
54 
55  private:
56 
57  EZMgrFL() ; //stop
58  EZMgrFL( const EZMgrFL& ) ; //stop
59  EZMgrFL& operator=( const EZMgrFL& ) ; //stop
60 
63  mutable VecType m_vec ;
64 };
65 
66 #endif
VecType::const_reference const_reference
Definition: EZMgrFL.h:16
int i
Definition: DBlmapReader.cc:9
VecType::size_type size_type
Definition: EZMgrFL.h:18
VecType::value_type value_type
Definition: EZMgrFL.h:17
uint16_t size_type
iterator resize() const
Definition: EZMgrFL.h:33
EZMgrFL & operator=(const EZMgrFL &)
Container::value_type value_type
size_type vecSize() const
Definition: EZMgrFL.h:53
iterator assign(const T &t=T()) const
Definition: EZMgrFL.h:35
VecType::iterator iterator
Definition: EZMgrFL.h:13
size_type subSize() const
Definition: EZMgrFL.h:50
Definition: EZMgrFL.h:8
const size_type m_subSize
Definition: EZMgrFL.h:62
iterator reserve() const
Definition: EZMgrFL.h:32
std::vector< T > VecType
Definition: EZMgrFL.h:12
const size_type m_vecSize
Definition: EZMgrFL.h:61
VecType m_vec
Definition: EZMgrFL.h:63
VecType::reference reference
Definition: EZMgrFL.h:15
size_type size() const
Definition: EZMgrFL.h:51
VecType::const_iterator const_iterator
Definition: EZMgrFL.h:14
long double T