CMS 3D CMS Logo

FillView.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_FillView_h
2 #define DataFormats_Common_FillView_h
3 
4 /*----------------------------------------------------------------------
5 
6 Several fillView function templates, to provide View support for
7 Standard Library containers.
8 
9 ----------------------------------------------------------------------*/
10 
11 #include <vector>
12 #include <list>
13 #include <deque>
14 #include <set>
17 
18 namespace edm {
19 
20  class ProductID;
21 
22  namespace detail {
23 
24  template <class COLLECTION>
25  void reallyFillView(COLLECTION const& coll,
26  ProductID const& id,
27  std::vector<void const*>& ptrs,
29  typedef COLLECTION product_type;
30  typedef typename GetProduct<product_type>::element_type element_type;
31  typedef typename product_type::const_iterator iter;
32  typedef typename product_type::size_type size_type;
33 
34  ptrs.reserve(ptrs.size() + coll.size());
35  helpers.reserve(ptrs.size() + coll.size());
36  size_type key = 0;
37  for (iter i = coll.begin(), e = coll.end(); i != e; ++i, ++key) {
38  element_type const* address = GetProduct<product_type>::address(i);
39  ptrs.push_back(address);
40  helpers.emplace_back(id, key);
41  }
42  }
43  } // namespace detail
44  template <class T, class A>
45  void fillView(std::vector<T, A> const& obj,
46  ProductID const& id,
47  std::vector<void const*>& ptrs,
50  }
51 
52  template <class T, class A>
53  void fillView(std::list<T, A> const& obj,
54  ProductID const& id,
55  std::vector<void const*>& ptrs,
58  }
59 
60  template <class T, class A>
61  void fillView(std::deque<T, A> const& obj,
62  ProductID const& id,
63  std::vector<void const*>& ptrs,
66  }
67 
68  template <class T, class A, class Comp>
69  void fillView(std::set<T, A, Comp> const& obj,
70  ProductID const& id,
71  std::vector<void const*>& ptrs,
74  }
75 
76 } // namespace edm
77 
78 #endif
edm::FillViewHelperVector
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
Definition: FillViewHelperVector.h:30
mps_fire.i
i
Definition: mps_fire.py:428
edm::detail::reallyFillView
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, FillViewHelperVector &helpers)
Definition: FillView.h:25
edm
HLT enums.
Definition: AlignableModifier.h:19
detail
Definition: ConvertingESProducerWithDependenciesT.h:23
GetProduct.h
FillViewHelperVector.h
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::detail::GetProduct::address
static const element_type * address(const iter &i)
Definition: GetProduct.h:36
helpers
Definition: makeCompositeCandidate.h:8
edm::detail::GetProduct::element_type
COLLECTION::value_type element_type
Definition: GetProduct.h:34
edm::fillView
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
Definition: AssociationVector.h:290
crabWrapper.key
key
Definition: crabWrapper.py:19
edm::ProductID
Definition: ProductID.h:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37