CMS 3D CMS Logo

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 <cassert>
6 
7 template <class T>
8 class EZMgrFL {
9 public:
10  typedef std::vector<T> VecType;
11  typedef typename VecType::iterator iterator;
12  typedef typename VecType::const_iterator const_iterator;
13  typedef typename VecType::reference reference;
14  typedef typename VecType::const_reference const_reference;
15  typedef typename VecType::value_type value_type;
16  typedef typename VecType::size_type size_type;
17 
19  m_vec.resize(0);
20  assert(subSize > 0);
21  assert(vecSize > 0);
22  assert(0 == m_vec.capacity());
23  }
24 
25  virtual ~EZMgrFL<T>() {}
26 
27  iterator reserve() { return assign(); }
28  iterator resize() { return assign(); }
29 
30  iterator assign(const T& t = T()) {
31  assert((m_vec.size() + m_subSize) <= m_vecSize);
32  if (0 == m_vec.capacity()) {
33  m_vec.reserve(m_vecSize);
34  assert(m_vecSize == m_vec.capacity());
35  }
36  for (size_type i(0); i != m_subSize; ++i) {
37  m_vec.emplace_back(t);
38  }
39  return (m_vec.end() - m_subSize);
40  }
41 
42  size_type subSize() const { return m_subSize; }
43  size_type size() const { return m_vec.size(); }
44 
45  size_type vecSize() const { return m_vec.size(); }
46 
47  EZMgrFL() = delete;
48  EZMgrFL(const EZMgrFL&) = delete;
49  EZMgrFL& operator=(const EZMgrFL&) = delete;
50 
51 private:
55 };
56 
57 #endif
VecType::const_reference const_reference
Definition: EZMgrFL.h:14
size_type subSize() const
Definition: EZMgrFL.h:42
VecType::size_type size_type
Definition: EZMgrFL.h:16
EZMgrFL()=delete
EZMgrFL & operator=(const EZMgrFL &)=delete
assert(be >=bs)
VecType::value_type value_type
Definition: EZMgrFL.h:15
uint16_t size_type
size_type size() const
Definition: EZMgrFL.h:43
VecType::iterator iterator
Definition: EZMgrFL.h:11
Definition: EZMgrFL.h:8
const size_type m_subSize
Definition: EZMgrFL.h:53
std::vector< T > VecType
Definition: EZMgrFL.h:10
iterator assign(const T &t=T())
Definition: EZMgrFL.h:30
const size_type m_vecSize
Definition: EZMgrFL.h:52
size_type vecSize() const
Definition: EZMgrFL.h:45
VecType m_vec
Definition: EZMgrFL.h:54
VecType::reference reference
Definition: EZMgrFL.h:13
iterator reserve()
Definition: EZMgrFL.h:27
VecType::const_iterator const_iterator
Definition: EZMgrFL.h:12
long double T
iterator resize()
Definition: EZMgrFL.h:28