29 namespace eventsetup {
50 for (
auto const& it : proxies) {
54 assert(perRecordInfo.
nDataKeys_ == proxies.size());
56 for (
auto const& it : proxies) {
57 if (appendToDataLabel.empty()) {
61 auto lengthDataLabel = std::strlen(it.first.name().value());
62 assert(std::strncmp(it.first.name().value(),
64 lengthDataLabel) == 0);
71 for (
auto const& it : proxies) {
79 auto iterEnd = iter + perRecordInfo.
nDataKeys_;
80 for (; iter != iterEnd; ++iter) {
81 if (*iter == dataKey) {
99 std::vector<DataKey>::iterator dataKeysIter,
101 : dataKeysIter_(dataKeysIter), dataProxiesIter_(dataProxiesIter) {}
120 assert(keyedProxiesCollection_.empty());
121 perRecordInfos_.emplace_back(iKey);
125 auto lb = std::lower_bound(perRecordInfos_.begin(), perRecordInfos_.end(),
PerRecordInfo(iKey));
126 return (lb != perRecordInfos_.end() && iKey == lb->recordKey_);
130 std::set<EventSetupRecordKey> returnValue;
131 for (
auto const& it : perRecordInfos_) {
132 returnValue.insert(returnValue.end(), it.recordKey_);
138 std::set<EventSetupRecordKey>& recordsNotAllowingConcurrentIOVs)
const {
139 for (
auto const& it : perRecordInfos_) {
142 recordsNotAllowingConcurrentIOVs.insert(recordsNotAllowingConcurrentIOVs.end(),
key);
148 std::sort(perRecordInfos_.begin(), perRecordInfos_.end());
149 perRecordInfos_.erase(
std::unique(perRecordInfos_.begin(), perRecordInfos_.end()), perRecordInfos_.end());
153 unsigned int nConcurrentIOVs) {
154 if (keyedProxiesCollection_.empty()) {
155 sortEventSetupRecordKeys();
157 assert(nConcurrentIOVs > 0
U);
158 auto lb = std::lower_bound(perRecordInfos_.begin(), perRecordInfos_.end(),
PerRecordInfo(key));
159 assert(lb != perRecordInfos_.end() && key == lb->recordKey_);
160 if (lb->nIOVs_ == 0) {
161 lb->nIOVs_ = nConcurrentIOVs;
162 auto recordIndex =
std::distance(perRecordInfos_.begin(), lb);
163 lb->indexToKeyedProxies_ = keyedProxiesCollection_.size();
164 for (
unsigned int i = 0;
i < nConcurrentIOVs; ++
i) {
165 keyedProxiesCollection_.emplace_back(
this, recordIndex);
172 auto lb = std::lower_bound(perRecordInfos_.begin(), perRecordInfos_.end(),
PerRecordInfo(iRecordKey));
173 assert(lb != perRecordInfos_.end() && iRecordKey == lb->recordKey_);
174 assert(iovIndex < lb->
nIOVs_);
175 return keyedProxiesCollection_[lb->indexToKeyedProxies_ + iovIndex];
183 assert(oldValue.empty());
186 if (iToAppend.
exists(kParamName)) {
192 unsigned int iovIndex) {
197 std::vector<std::pair<DataKey, std::shared_ptr<DataProxy>>> keyedProxiesVector =
202 for (
auto keyedProxy : keyedProxies) {
203 keyedProxy.dataProxy_->setProviderDescription(&
description());
204 if (mustChangeLabels) {
210 DataKey newKey(keyedProxy.dataKey_.type(), temp.c_str());
211 swap(keyedProxy.dataKey_, newKey);
226 for (
auto&
v : iDesc) {
227 if (
v.second.isLabelUnused(kAppendToDataLabel)) {
T getParameter(std::string const &) const
PerRecordInfo(const EventSetupRecordKey &)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
unsigned int indexToDataKeys_
ParameterSetDescription * defaultDescription()
Returns 0 if no default has been assigned.
unsigned int size() const
EventSetupRecordKey const & recordKey() const
virtual KeyedProxiesVector registerProxies(const EventSetupRecordKey &, unsigned int iovIndex)=0
void sortEventSetupRecordKeys()
unsigned int dataProxiesIndex_
def unique(seq, keepstr=True)
KeyedProxies & keyedProxies(const EventSetupRecordKey &iRecordKey, unsigned int iovIndex)
const ComponentDescription & description() const
void swap(DataKey &a, DataKey &b)
bool isLabelUnused(std::string const &label) const
static const std::string kAppendToDataLabel("appendToDataLabel")
virtual void updateLookup(ESRecordsToProxyIndices const &)
bool allowConcurrentIOVs(EventSetupRecordKey const &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool contains(DataKey const &dataKey) const
edm::propagate_const< DataProxyContainer * > dataProxyContainer_
static void prevalidate(ConfigurationDescriptions &)
bool isUsingRecord(const EventSetupRecordKey &) const
void setAppendToDataLabel(const edm::ParameterSet &)
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
void insert(std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>> &&, std::string const &appendToDataLabel)
KeyedProxies & keyedProxies(const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
DataProxyContainer dataProxyContainer_
void createKeyedProxies(EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
unsigned int recordIndex_
Iterator(std::vector< DataKey >::iterator dataKeysIter, std::vector< edm::propagate_const< std::shared_ptr< DataProxy >>>::iterator dataProxiesIter)
constexpr auto kInvalidIndex
std::set< EventSetupRecordKey > usingRecords() const
virtual ~DataProxyProvider() noexcept(false)
void usingRecordWithKey(const EventSetupRecordKey &)
std::string appendToDataLabel_
KeyedProxies(DataProxyContainer *, unsigned int recordIndex)
bool unInitialized() const