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 
31 
32  EZArrayFL<T>(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  virtual ~EZArrayFL<T>() {}
44 
45  void resize() { assign(); }
46 
47  void assign(const T& t = T()) {
48  assert(iterator() == m_begin);
49  m_begin = m_mgr->assign(t);
50  }
51 
52  const_iterator begin() const { return m_begin; }
53  const_iterator end() const { return m_begin + m_mgr->subSize(); }
54 
55  reference operator[](const unsigned int i) {
56  if (iterator() == m_begin)
57  assign();
58  return *(m_begin + i);
59  }
60 
61  const_reference operator[](const unsigned int i) const { return *(m_begin + i); }
62 
63  bool uninitialized() const { return (iterator() == m_begin); }
64 
65  bool empty() const { return (0 == size()); }
66 
67  size_type size() const { return m_mgr->subSize(); }
68 
69  size_type capacity() const { return size(); }
70 
71 protected:
72 private:
73  //EZArrayFL( const EZArrayFL& ) ; //stop
74  //EZArrayFL& operator=( const EZArrayFL& ) ; //stop
77 };
78 
79 #endif
VecType::const_reference const_reference
Definition: EZMgrFL.h:14
Definition: start.py:1
size_type size() const
Definition: EZArrayFL.h:67
size_type subSize() const
Definition: EZMgrFL.h:42
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:76
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:53
MgrType::iterator iterator
Definition: EZArrayFL.h:23
const_reference operator[](const unsigned int i) const
Definition: EZArrayFL.h:61
const_iterator begin() const
Definition: EZArrayFL.h:52
void resize()
Definition: EZArrayFL.h:45
MgrType::reference reference
Definition: EZArrayFL.h:25
VecType::iterator iterator
Definition: EZMgrFL.h:11
Definition: EZMgrFL.h:8
void assign(const T &t=T())
Definition: EZArrayFL.h:47
MgrType::const_iterator const_iterator
Definition: EZArrayFL.h:24
iterator assign(const T &t=T())
Definition: EZMgrFL.h:30
iterator m_begin
Definition: EZArrayFL.h:75
MgrType::value_type value_type
Definition: EZArrayFL.h:28
VecType::reference reference
Definition: EZMgrFL.h:13
size_type capacity() const
Definition: EZArrayFL.h:69
VecType::const_iterator const_iterator
Definition: EZMgrFL.h:12
long double T
bool empty() const
Definition: EZArrayFL.h:65
bool uninitialized() const
Definition: EZArrayFL.h:63
reference operator[](const unsigned int i)
Definition: EZArrayFL.h:55