File indexing completed on 2024-04-06 12:05:24
0001 #ifndef DETECTOR_DESCRIPTION_CORE_DDSVALUES_H
0002 #define DETECTOR_DESCRIPTION_CORE_DDSVALUES_H
0003
0004 #include <algorithm>
0005 #include <map>
0006 #include <ostream>
0007 #include <utility>
0008 #include <vector>
0009
0010 #include "DetectorDescription/Core/interface/DDValue.h"
0011
0012 using DDsvalues_type = std::vector<std::pair<unsigned int, DDValue> >;
0013 using DDsvalues_Content_type = DDsvalues_type::value_type;
0014
0015 inline bool operator<(const DDsvalues_Content_type &lh, const DDsvalues_Content_type &rh) {
0016 return lh.first < rh.first;
0017 }
0018
0019 inline DDsvalues_type::const_iterator find(DDsvalues_type::const_iterator begin,
0020 DDsvalues_type::const_iterator end,
0021 unsigned int id) {
0022 static const DDValue dummy;
0023 DDsvalues_Content_type v(id, dummy);
0024 DDsvalues_type::const_iterator it = std::lower_bound(begin, end, v);
0025 if (it != end && (*it).first == id)
0026 return it;
0027 return end;
0028 }
0029
0030 inline DDsvalues_type::const_iterator find(DDsvalues_type const &sv, unsigned int id) {
0031 return find(sv.begin(), sv.end(), id);
0032 }
0033
0034 void merge(DDsvalues_type &target, DDsvalues_type const &sv, bool sortit = true);
0035
0036
0037 bool DDfetch(const DDsvalues_type *, DDValue &);
0038
0039
0040 unsigned int DDfetch(const std::vector<const DDsvalues_type *> &sp, DDValue &toFetch, std::vector<DDValue> &result);
0041
0042 std::ostream &operator<<(std::ostream &, const DDsvalues_type &);
0043 std::ostream &operator<<(std::ostream &, const std::vector<const DDsvalues_type *> &);
0044
0045 #endif