CMS 3D CMS Logo

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