CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EZArrayVL.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_EZArrayVL_H
2 #define GEOMETRY_CALOGEOMETRY_EZArrayVL_H 1
3 
5 
6 template < class T >
7 class EZArrayVL
8 {
9  public:
10 
12  typedef typename MgrType::iterator iterator ;
14  typedef typename MgrType::reference reference ;
16  typedef typename MgrType::size_type size_type ;
17  typedef typename MgrType::value_type value_type ;
18 
19  EZArrayVL< T >( const MgrType* mgr ,
20  size_type size = 0 ,
21  const T& t = T() ) :
22  m_begin ( 0 ) ,
23  m_size ( size ) ,
24  m_mgr ( mgr ) {}
25 
26  EZArrayVL< T >( const MgrType* mgr ,
28  const_iterator finis ) :
29  m_begin ( 0==finis-start ? (iterator)0 : mgr->assign( finis - start ) ) ,
30  m_size ( finis - start ) ,
31  m_mgr ( mgr )
32  {
33  assert( ( finis - start ) > 0 ) ;
34  iterator i ( begin() ) ;
35  for( const_iterator ic ( start ) ; ic != finis ; ++ic )
36  {
37  (*i) = (*ic) ;
38  }
39  }
40 
41  virtual ~EZArrayVL< T >() {}
42 
43  virtual void resize( size_type size ) { m_mgr->assign( size ) ; }
44 
45  virtual void assign( size_type size,
46  const T& t = T() ) const
47  {
48  assert( (iterator)0 == m_begin ) ;
49  m_size = size ;
50  m_begin = m_mgr->assign( size, t ) ;
51  }
52 
53  const_iterator begin() const { return m_begin ; }
54  const_iterator end() const { return m_size + m_begin ; }
55 
56  reference operator[]( const unsigned int i )
57  {
58  if( (iterator)0 == m_begin ) assign( m_size ) ;
59  return *( m_begin + i ) ;
60  }
61 
62  const_reference operator[]( const unsigned int i ) const
63  {
64  return *( m_begin + i ) ;
65  }
66 
67  bool uninitialized() const { return ( 0 == m_begin ) ; }
68 
69  bool empty() const { return ( 0 == size() ) ; }
70 
71  size_type size() const { return ( m_end - m_begin ) ; }
72 
73  size_type capacity() const { return size() ; }
74 
75  protected:
76 
77  private:
78 
79  EZArrayVL< T >() ; //stop
80  //EZArrayVL( const EZArrayVL& ) ; //stop
81  //EZArrayVL& operator=( const EZArrayVL& ) ; //stop
82  mutable iterator m_begin ;
84  const MgrType* m_mgr ;
85 };
86 
87 #endif
int i
Definition: DBlmapReader.cc:9
MgrType::const_reference const_reference
Definition: EZArrayVL.h:15
const_reference operator[](const unsigned int i) const
Definition: EZArrayVL.h:62
MgrType::value_type value_type
Definition: EZArrayVL.h:17
assert(m_qm.get())
MgrType::const_iterator const_iterator
Definition: EZArrayVL.h:13
iterator assign(size_type size, const T &t=T()) const
Definition: EZMgrVL.h:31
const_iterator end() const
Definition: EZArrayVL.h:54
MgrType::iterator iterator
Definition: EZArrayVL.h:12
VecType::const_iterator const_iterator
Definition: EZMgrVL.h:14
const MgrType * m_mgr
Definition: EZArrayVL.h:84
EZMgrVL< T > MgrType
Definition: EZArrayVL.h:11
VecType::reference reference
Definition: EZMgrVL.h:15
const_iterator begin() const
Definition: EZArrayVL.h:53
VecType::iterator iterator
Definition: EZMgrVL.h:13
MgrType::size_type size_type
Definition: EZArrayVL.h:16
VecType::size_type size_type
Definition: EZMgrVL.h:18
bool uninitialized() const
Definition: EZArrayVL.h:67
size_type m_size
Definition: EZArrayVL.h:83
virtual void assign(size_type size, const T &t=T()) const
Definition: EZArrayVL.h:45
VecType::const_reference const_reference
Definition: EZMgrVL.h:16
MgrType::reference reference
Definition: EZArrayVL.h:14
bool empty() const
Definition: EZArrayVL.h:69
virtual void resize(size_type size)
Definition: EZArrayVL.h:43
Definition: EZMgrVL.h:8
size_type capacity() const
Definition: EZArrayVL.h:73
VecType::value_type value_type
Definition: EZMgrVL.h:17
reference operator[](const unsigned int i)
Definition: EZArrayVL.h:56
size_type size() const
Definition: EZArrayVL.h:71
long double T
iterator m_begin
Definition: EZArrayVL.h:82