CMS 3D CMS Logo

DTCache.h
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
15 //
16 //--------------------------------------------------
17 #ifndef DT_CACHE_H
18 #define DT_CACHE_H
19 
20 #include <vector>
21 
22 template <class T, class Coll = std::vector<T>>
23 class DTCache {
24 public:
25  typedef T my_type;
26  typedef Coll my_collection;
27  typedef typename my_collection::iterator iterator;
28  typedef typename my_collection::const_iterator const_iterator;
29 
30 public:
32  DTCache() {}
33 
35  virtual ~DTCache() {}
36 
38  const_iterator begin() const { return _cache.begin(); }
39 
41  const_iterator end() const { return _cache.end(); }
42 
44  int size() const { return _cache.size(); }
45 
47  void clearCache() { _cache.clear(); }
48 
50  virtual void reconstruct() {}
51 
52 protected:
53  my_collection _cache;
54 };
55 #endif
virtual ~DTCache()
Destructor.
Definition: DTCache.h:35
my_collection::iterator iterator
Definition: DTCache.h:27
my_collection _cache
Definition: DTCache.h:53
Coll my_collection
Definition: DTCache.h:26
my_collection::const_iterator const_iterator
Definition: DTCache.h:28
DTCache()
Constructor.
Definition: DTCache.h:32
T my_type
Definition: DTCache.h:25
const_iterator begin() const
Get first cache element.
Definition: DTCache.h:38
virtual void reconstruct()
Virtual reconstruct member.
Definition: DTCache.h:50
long double T
const_iterator end() const
Get last cache element.
Definition: DTCache.h:41
void clearCache()
Clear cache vector.
Definition: DTCache.h:47
int size() const
Get cache vector&#39;s size.
Definition: DTCache.h:44