DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ContainerHelpers.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_DETAIL_CONTAINERHELPERS_H
14 #define DD4HEP_DETAIL_CONTAINERHELPERS_H
15 
16 // Framework include files
17 #include <DD4hep/Primitives.h>
18 
19 // C/C++ include files
20 #include <map>
21 #include <set>
22 #include <list>
23 #include <vector>
24 #include <string>
25 
27 
34 namespace dd4hep {
35 
36  template <typename Q, typename T>
37  void insert_item(std::vector<T>& c, Q, const T& d) {
38  c.emplace_back(d);
39  }
40  template <typename Q, typename T>
41  void insert_item(std::vector<Q>& c, Q de, const T&) {
42  c.emplace_back(de);
43  }
44 
45  template <typename Q, typename T>
46  void insert_item(std::list<T>& c, Q, const T& d) {
47  c.emplace_back(d);
48  }
49  template <typename Q, typename T>
50  void insert_item(std::list<Q>& c, Q de, const T&) {
51  c.emplace_back(de);
52  }
53 
54  template <typename Q, typename T>
55  void insert_item(std::set<T>& c, Q, const T& d) {
56  c.insert(d);
57  }
58  template <typename Q, typename T>
59  void insert_item(std::set<Q>& c, Q de, const T&) {
60  c.insert(de);
61  }
62 
63  template <typename Q, typename T>
64  void insert_item(std::map<Q,T>& c, Q de, const T& d) {
65  c.emplace(de,d);
66  }
67  template <typename Q, typename T>
68  void insert_item(std::map<T,Q>& c, Q de, const T& d) {
69  c.emplace(d,de);
70  }
71 
72  template <typename Q, typename T>
73  void insert_item(std::vector<std::pair<Q,T> >& c, Q de, const T& d) {
74  c.emplace_back(de,d);
75  }
76  template <typename Q, typename T>
77  void insert_item(std::vector<std::pair<std::string,T> >& c, Q de, const T& d) {
78  c.emplace_back(de.path(),d);
79  }
80 
81  template <typename Q, typename T>
82  void insert_item(std::list<std::pair<Q,T> >& c, Q de, const T& d) {
83  c.emplace_back(de,d);
84  }
85  template <typename Q, typename T>
86  void insert_item(std::list<std::pair<std::string,T> >& c, Q de, const T& d) {
87  c.emplace_back(de.path(),d);
88  }
89 
90  template <typename Q, typename T>
91  void insert_item(std::set<std::pair<Q,T> >& c, Q de, const T& d) {
92  c.emplace(de,d);
93  }
94  template <typename Q, typename T>
95  void insert_item(std::set<std::pair<std::string,T> >& c, Q de, const T& d) {
96  c.emplace(de.path(),d);
97  }
98 
99  template <typename Q, typename T>
100  void insert_item(std::multimap<Q,T>& c, Q de, const T& d) {
101  c.emplace(de,d);
102  }
103  template <typename Q, typename T>
104  void insert_item(std::map<std::string,T>& c, Q de, const T& d) {
105  c.emplace(de.path(),d);
106  }
107  template <typename Q, typename T>
108  void insert_item(std::multimap<std::string,T>& c, Q de, const T& d) {
109  c.emplace(de.path(),d);
110  }
111 } // End namespace dd4hep
112 #endif // DD4HEP_DETAIL_CONTAINERHELPERS_H
dd4hep::insert_item
void insert_item(std::vector< T > &c, Q, const T &d)
Definition: ContainerHelpers.h:37
Primitives.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28