CMS 3D CMS Logo

EZArrayFL.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_EZArrayFL_H
2 #define GEOMETRY_CALOGEOMETRY_EZArrayFL_H 1
3 
5 
19 template <class T>
20 class EZArrayFL {
21 public:
23  typedef typename MgrType::iterator iterator;
25  typedef typename MgrType::reference reference;
27  typedef typename MgrType::size_type size_type;
28  typedef typename MgrType::value_type value_type;
29 
30  EZArrayFL() : m_begin(), m_mgr() {}
31 
32  EZArrayFL(MgrType* mgr) : m_begin(), m_mgr(mgr) {}
33 
35  : m_begin(0 == finis - start ? iterator() : mgr->assign()), m_mgr(mgr) {
36  assert((finis - start) == m_mgr->subSize());
37  iterator i(begin());
38  for (const_iterator ic(start); ic != finis; ++ic) {
39  (*i) = (*ic);
40  }
41  }
42 
43  void resize() { assign(); }
44 
45  void assign(const T& t = T()) {
46  assert(iterator() == m_begin);
47  m_begin = m_mgr->assign(t);
48  }
49 
50  const_iterator begin() const { return m_begin; }
51  const_iterator end() const { return m_begin + m_mgr->subSize(); }
52 
53  reference operator[](const unsigned int i) {
54  if (iterator() == m_begin)
55  assign();
56  return *(m_begin + i);
57  }
58 
59  const_reference operator[](const unsigned int i) const { return *(m_begin + i); }
60 
61  bool uninitialized() const { return (iterator() == m_begin); }
62 
63  bool empty() const { return (0 == size()); }
64 
65  size_type size() const { return m_mgr->subSize(); }
66 
67  size_type capacity() const { return size(); }
68 
69 protected:
70 private:
71  //EZArrayFL( const EZArrayFL& ) ; //stop
72  //EZArrayFL& operator=( const EZArrayFL& ) ; //stop
75 };
76 
77 #endif
VecType::const_reference const_reference
Definition: EZMgrFL.h:14
Definition: start.py:1
size_type size() const
Definition: EZArrayFL.h:65
EZArrayFL(MgrType *mgr, const_iterator start, const_iterator finis)
Definition: EZArrayFL.h:34
size_type subSize() const
Definition: EZMgrFL.h:40
EZArrayFL(MgrType *mgr)
Definition: EZArrayFL.h:32
VecType::size_type size_type
Definition: EZMgrFL.h:16
MgrType::size_type size_type
Definition: EZArrayFL.h:27
EZMgrFL< T > MgrType
Definition: EZArrayFL.h:22
MgrType * m_mgr
Definition: EZArrayFL.h:74
assert(be >=bs)
VecType::value_type value_type
Definition: EZMgrFL.h:15
MgrType::const_reference const_reference
Definition: EZArrayFL.h:26
const_iterator end() const
Definition: EZArrayFL.h:51
MgrType::iterator iterator
Definition: EZArrayFL.h:23
const_reference operator[](const unsigned int i) const
Definition: EZArrayFL.h:59
const_iterator begin() const
Definition: EZArrayFL.h:50
void resize()
Definition: EZArrayFL.h:43
MgrType::reference reference
Definition: EZArrayFL.h:25
EZArrayFL()
Definition: EZArrayFL.h:30
VecType::iterator iterator
Definition: EZMgrFL.h:11
Definition: EZMgrFL.h:8
void assign(const T &t=T())
Definition: EZArrayFL.h:45
MgrType::const_iterator const_iterator
Definition: EZArrayFL.h:24
iterator assign(const T &t=T())
Definition: EZMgrFL.h:28
iterator m_begin
Definition: EZArrayFL.h:73
MgrType::value_type value_type
Definition: EZArrayFL.h:28
VecType::reference reference
Definition: EZMgrFL.h:13
size_type capacity() const
Definition: EZArrayFL.h:67
VecType::const_iterator const_iterator
Definition: EZMgrFL.h:12
long double T
bool empty() const
Definition: EZArrayFL.h:63
bool uninitialized() const
Definition: EZArrayFL.h:61
reference operator[](const unsigned int i)
Definition: EZArrayFL.h:53