/
ESRecordsToProxyIndices.h
81 lines (65 loc) · 3.04 KB
/
ESRecordsToProxyIndices.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef FWCore_Framework_ESRecordsToProxyIndices_h
#define FWCore_Framework_ESRecordsToProxyIndices_h
// -*- C++ -*-
//
// Package: Framework
// Class : ESRecordsToProxyIndices
//
/**\class ESRecordsToProxyIndices ESRecordsToProxyIndices.h FWCore/Framework/interface/ESRecordsToProxyIndices.h
Description: Key used to identify data within a EventSetupRecord
Usage:
<usage>
*/
//
// Author: Chris Jones
// Created: Tues Feb 12 14:31:03 EST 2019
//
// system include files
#include <limits>
#include <vector>
// user include files
#include "FWCore/Framework/interface/DataKey.h"
#include "FWCore/Framework/interface/EventSetupRecordKey.h"
#include "FWCore/Framework/interface/ESTagGetter.h"
#include "FWCore/Utilities/interface/ESIndices.h"
// forward declarations
namespace edm::eventsetup {
struct ComponentDescription;
class ESRecordsToProxyIndices {
public:
ESRecordsToProxyIndices(std::vector<EventSetupRecordKey> iRecords);
// ---------- const member functions ---------------------
///If the index is not found, returns missingProxyIndex()
ESProxyIndex indexInRecord(EventSetupRecordKey const& iRK, DataKey const& iDK) const noexcept;
ComponentDescription const* component(EventSetupRecordKey const& iRK, DataKey const& iDK) const noexcept;
///Returns ESTagGetter for all products matching the type iTT for record iRK
ESTagGetter makeTagGetter(EventSetupRecordKey const& iRK, TypeTag const& iTT) const;
static constexpr ESProxyIndex missingProxyIndex() noexcept { return ESProxyIndex{std::numeric_limits<int>::max()}; }
static constexpr ESRecordIndex missingRecordIndex() noexcept {
return ESRecordIndex{std::numeric_limits<int>::max()};
}
ESRecordIndex recordIndexFor(EventSetupRecordKey const& iRK) const noexcept;
std::pair<std::vector<DataKey>::const_iterator, std::vector<DataKey>::const_iterator> keysForRecord(
EventSetupRecordKey const& iRK) const noexcept;
///The sorted list of keys
std::vector<EventSetupRecordKey> recordKeys() const noexcept { return recordKeys_; }
// ---------- member functions ---------------------------
///This should be called for all records in the list passed to the constructor and
/// in the same order as the list.
unsigned int dataKeysInRecord(unsigned int iRecordIndex,
EventSetupRecordKey const& iRecord,
std::vector<DataKey> const& iDataKeys,
std::vector<ComponentDescription const*> const& iComponents);
private:
// ---------- member data --------------------------------
std::vector<EventSetupRecordKey> recordKeys_;
//for each item in recordKeys_ this holds the index to the first
// DataKey for that item in dataKeys_
// recordOffset_ is 1 size larger than recordKeys_ with the
// last entry being dataKeys_.size()
std::vector<unsigned int> recordOffsets_;
std::vector<DataKey> dataKeys_;
std::vector<ComponentDescription const*> components_;
};
} // namespace edm::eventsetup
#endif