Skip to content

Commit

Permalink
Renamed DataProxy to ESProductResolver
Browse files Browse the repository at this point in the history
- changed to match Principal system naming
- changed all related use of 'proxy' to 'resolver'
  • Loading branch information
Dr15Jones committed Jun 29, 2023
1 parent 62b1516 commit 3175b93
Show file tree
Hide file tree
Showing 107 changed files with 1,651 additions and 1,651 deletions.
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/Callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
/**\class edm::eventsetup::Callback
Description: Functional object used as the 'callback' for the CallbackProxy
Description: Functional object used as the 'callback' for the CallbackESProductResolver
Usage: Produces data objects for ESProducers in EventSetup system
Expand Down
20 changes: 10 additions & 10 deletions FWCore/Framework/interface/CallbackBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
/**\class edm::eventsetup::CallbackBase
Description: Functional object used as the 'callback' for the CallbackProxy
Description: Functional object used as the 'callback' for the CallbackESProductResolver
Usage: Produces data objects for ESProducers in EventSetup system
Expand Down Expand Up @@ -128,8 +128,8 @@ namespace edm {
convertException::wrap([this, &serviceToken, &record, &eventSetupImpl, &produceFunctor] {
ESModuleCallingContext const& context = callingContext_;
auto proxies = getTokenIndices();
if (postMayGetProxies_) {
proxies = &((*postMayGetProxies_).front());
if (postMayGetResolvers_) {
proxies = &((*postMayGetResolvers_).front());
}
TRecord rec;
ESParentContext pc{&context};
Expand Down Expand Up @@ -186,7 +186,7 @@ namespace edm {
}
if (handleMayGet(iRecord, iEventSetupImpl)) {
prefetchNeededDataAsync(
runModuleTaskHolder, iEventSetupImpl, &((*postMayGetProxies_).front()), weakToken.lock());
runModuleTaskHolder, iEventSetupImpl, &((*postMayGetResolvers_).front()), weakToken.lock());
} else {
runModuleTaskHolder.doneWaiting(std::exception_ptr{});
}
Expand Down Expand Up @@ -222,9 +222,9 @@ namespace edm {
}

unsigned int transitionID() const { return id_; }
ESProxyIndex const* getTokenIndices() const { return producer_->getTokenIndices(id_); }
ESResolverIndex const* getTokenIndices() const { return producer_->getTokenIndices(id_); }

std::optional<std::vector<ESProxyIndex>> const& postMayGetProxies() const { return postMayGetProxies_; }
std::optional<std::vector<ESResolverIndex>> const& postMayGetResolvers() const { return postMayGetResolvers_; }
T* producer() { return producer_.get(); }
ESModuleCallingContext& callingContext() { return callingContext_; }
WaitingTaskList& taskList() { return taskList_; }
Expand All @@ -243,7 +243,7 @@ namespace edm {

void prefetchNeededDataAsync(WaitingTaskHolder task,
EventSetupImpl const* iImpl,
ESProxyIndex const* proxies,
ESResolverIndex const* proxies,
ServiceToken const& token) const {
auto recs = producer_->getTokenRecordIndices(id_);
auto n = producer_->numberOfTokenIndices(id_);
Expand All @@ -260,12 +260,12 @@ namespace edm {
TRecord rec;
ESParentContext pc{&callingContext_};
rec.setImpl(iRecord, transitionID(), getTokenIndices(), iEventSetupImpl, &pc);
postMayGetProxies_ = producer_->updateFromMayConsumes(id_, rec);
return static_cast<bool>(postMayGetProxies_);
postMayGetResolvers_ = producer_->updateFromMayConsumes(id_, rec);
return static_cast<bool>(postMayGetResolvers_);
}

std::array<void*, produce::size<TReturn>::value> proxyData_;
std::optional<std::vector<ESProxyIndex>> postMayGetProxies_;
std::optional<std::vector<ESResolverIndex>> postMayGetResolvers_;
propagate_const<T*> producer_;
ESModuleCallingContext callingContext_;
WaitingTaskList taskList_;
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/interface/CallbackExternalWork.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
/**\class edm::eventsetup::CallbackExternalWork
Description: Functional object used as the 'callback' for the CallbackProxy
Description: Functional object used as the 'callback' for the CallbackProductResolver
Usage: Produces data objects for ESProducers in EventSetup system
Expand Down Expand Up @@ -173,8 +173,8 @@ namespace edm {
convertException::wrap([this, &holder, &serviceToken, &record, &eventSetupImpl] {
ESModuleCallingContext const& context = Base::callingContext();
auto proxies = Base::getTokenIndices();
if (Base::postMayGetProxies()) {
proxies = &((*Base::postMayGetProxies()).front());
if (Base::postMayGetResolvers()) {
proxies = &((*Base::postMayGetResolvers()).front());
}
TRecord rec;
edm::ESParentContext pc{&context};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef Framework_CallbackProxy_h
#define Framework_CallbackProxy_h
#ifndef Framework_CallbackProductResolver_h
#define Framework_CallbackProductResolver_h
// -*- C++ -*-
//
// Package: Framework
// Class : CallbackProxy
// Class : CallbackProductResolver
//
/**\class CallbackProxy CallbackProxy.h FWCore/Framework/interface/CallbackProxy.h
/**\class CallbackProductResolver CallbackProductResolver.h FWCore/Framework/interface/CallbackProductResolver.h
Description: A DataProxy which performs a callback when data is requested
Description: A ESProductResolver which performs a callback when data is requested
Usage:
This class is primarily used by ESProducer to allow the EventSetup system
Expand All @@ -24,7 +24,7 @@
#include <memory>

// user include files
#include "FWCore/Framework/interface/DataProxy.h"
#include "FWCore/Framework/interface/ESProductResolver.h"
#include "FWCore/Framework/interface/EventSetupRecord.h"
#include "FWCore/Concurrency/interface/WaitingTaskList.h"
#include "FWCore/Concurrency/interface/WaitingTaskHolder.h"
Expand All @@ -36,20 +36,20 @@
namespace edm::eventsetup {

template <class CallbackT, class RecordT, class DataT>
class CallbackProxy final : public DataProxy {
class CallbackProductResolver final : public ESProductResolver {
public:
using smart_pointer_traits = produce::smart_pointer_traits<DataT>;
using ValueType = typename smart_pointer_traits::type;
using RecordType = RecordT;

CallbackProxy(std::shared_ptr<CallbackT>& iCallback) : callback_{iCallback} {
CallbackProductResolver(std::shared_ptr<CallbackT>& iCallback) : callback_{iCallback} {
//The callback fills the data directly. This is done so that the callback does not have to
// hold onto a temporary copy of the result of the callback since the callback is allowed
// to return multiple items where only one item is needed by this Proxy
// to return multiple items where only one item is needed by this ProductResolver
iCallback->holdOntoPointer(&data_);
}

~CallbackProxy() final {
~CallbackProductResolver() final {
DataT* dummy(nullptr);
callback_->holdOntoPointer(dummy);
}
Expand All @@ -72,8 +72,8 @@ namespace edm::eventsetup {
}

// Delete copy operations
CallbackProxy(const CallbackProxy&) = delete;
const CallbackProxy& operator=(const CallbackProxy&) = delete;
CallbackProductResolver(const CallbackProductResolver&) = delete;
const CallbackProductResolver& operator=(const CallbackProductResolver&) = delete;

private:
DataT data_{};
Expand Down
8 changes: 4 additions & 4 deletions FWCore/Framework/interface/ComponentMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

// user include files
#include "FWCore/Framework/interface/ComponentDescription.h"
#include "FWCore/Framework/interface/DataProxyProvider.h"
#include "FWCore/Framework/interface/ESProductResolverProvider.h"
#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescriptionFiller.h"
#include "FWCore/Utilities/interface/ConvertException.h"
Expand All @@ -37,7 +37,7 @@ namespace edm {
namespace eventsetup {
class EventSetupProvider;
class EventSetupsController;
class DataProxyProvider;
class ESProductResolverProvider;

class ComponentMakerBaseHelper {
public:
Expand Down Expand Up @@ -75,13 +75,13 @@ namespace edm {

// ---------- member functions ---------------------------
private:
void setDescription(DataProxyProvider* iProv, const ComponentDescription& iDesc) const {
void setDescription(ESProductResolverProvider* iProv, const ComponentDescription& iDesc) const {
iProv->setDescription(iDesc);
}
void setDescriptionForFinder(EventSetupRecordIntervalFinder* iFinder, const ComponentDescription& iDesc) const {
iFinder->setDescriptionForFinder(iDesc);
}
void setPostConstruction(DataProxyProvider* iProv, const edm::ParameterSet& iPSet) const {
void setPostConstruction(ESProductResolverProvider* iProv, const edm::ParameterSet& iPSet) const {
//The 'appendToDataLabel' parameter was added very late in the development cycle and since
// the ParameterSet is not sent to the base class we must set the value after construction
iProv->setAppendToDataLabel(iPSet);
Expand Down
16 changes: 8 additions & 8 deletions FWCore/Framework/interface/EDConsumerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace edm {
class WillGetIfMatch;

namespace eventsetup {
class ESRecordsToProxyIndices;
class ESRecordsToProductResolverIndices;
}

class EDConsumerBase {
Expand Down Expand Up @@ -101,7 +101,7 @@ namespace edm {

// ---------- member functions ---------------------------
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
void updateLookup(eventsetup::ESRecordsToProxyIndices const&);
void updateLookup(eventsetup::ESRecordsToProductResolverIndices const&);
void selectInputProcessBlocks(ProductRegistry const& productRegistry,
ProcessBlockHelperBase const& processBlockHelperBase) {
doSelectInputProcessBlocks(productRegistry, processBlockHelperBase);
Expand All @@ -121,7 +121,7 @@ namespace edm {

std::vector<ConsumesInfo> consumesInfo() const;

ESProxyIndex const* esGetTokenIndices(edm::Transition iTrans) const {
ESResolverIndex const* esGetTokenIndices(edm::Transition iTrans) const {
if (iTrans < edm::Transition::NumberOfEventSetupTransitions) {
auto const& v = esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)];
if (v.empty()) {
Expand All @@ -132,7 +132,7 @@ namespace edm {
return nullptr;
}

std::vector<ESProxyIndex> const& esGetTokenIndicesVector(edm::Transition iTrans) const {
std::vector<ESResolverIndex> const& esGetTokenIndicesVector(edm::Transition iTrans) const {
assert(iTrans < edm::Transition::NumberOfEventSetupTransitions);
return esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)];
}
Expand Down Expand Up @@ -229,7 +229,7 @@ namespace edm {

private:
virtual void extendUpdateLookup(BranchType iBranchType, ProductResolverIndexHelper const&);
virtual void registerLateConsumes(eventsetup::ESRecordsToProxyIndices const&) {}
virtual void registerLateConsumes(eventsetup::ESRecordsToProductResolverIndices const&) {}
unsigned int recordConsumes(BranchType iBranch, TypeToGet const& iType, edm::InputTag const& iTag, bool iAlwaysGets);
ESTokenIndex recordESConsumes(Transition,
eventsetup::EventSetupRecordKey const&,
Expand Down Expand Up @@ -298,9 +298,9 @@ namespace edm {
// esItemsToGetFromTransition_. This is something for future
// development and might require a change to SoATuple to support
// inserts in the middle of the data structure.
enum { kESLookupInfo, kESProxyIndex };
edm::SoATuple<ESTokenLookupInfo, ESProxyIndex> m_esTokenInfo;
std::array<std::vector<ESProxyIndex>, static_cast<unsigned int>(edm::Transition::NumberOfEventSetupTransitions)>
enum { kESLookupInfo, kESResolverIndex };
edm::SoATuple<ESTokenLookupInfo, ESResolverIndex> m_esTokenInfo;
std::array<std::vector<ESResolverIndex>, static_cast<unsigned int>(edm::Transition::NumberOfEventSetupTransitions)>
esItemsToGetFromTransition_;
std::array<std::vector<ESRecordIndex>, static_cast<unsigned int>(edm::Transition::NumberOfEventSetupTransitions)>
esRecordsToGetFromTransition_;
Expand Down
32 changes: 16 additions & 16 deletions FWCore/Framework/interface/ESProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Inheriting from this class is the simplest way to create an algorithm which gets called when a new
data item is needed for the EventSetup. This class is designed to call a member method of inheriting
classes each time the algorithm needs to be run. (A more flexible system in which the algorithms can be
set at run-time instead of compile time can be obtained by inheriting from ESProxyFactoryProducer instead.)
set at run-time instead of compile time can be obtained by inheriting from ESProductResolverFactoryProducer instead.)
If only one algorithm is being encapsulated then the user needs to
1) add a method name 'produce' to the class. The 'produce' takes as its argument a const reference
Expand Down Expand Up @@ -77,10 +77,10 @@ Example: two algorithms each creating only one objects
#include "FWCore/Framework/interface/ESConsumesCollector.h"
#include "FWCore/Framework/interface/es_impl/MayConsumeChooserBase.h"
#include "FWCore/Framework/interface/es_impl/ReturnArgumentTypes.h"
#include "FWCore/Framework/interface/ESProxyFactoryProducer.h"
#include "FWCore/Framework/interface/ProxyArgumentFactoryTemplate.h"
#include "FWCore/Framework/interface/ESProductResolverFactoryProducer.h"
#include "FWCore/Framework/interface/ESProductResolverArgumentFactoryTemplate.h"

#include "FWCore/Framework/interface/CallbackProxy.h"
#include "FWCore/Framework/interface/CallbackProductResolver.h"
#include "FWCore/Framework/interface/Callback.h"
#include "FWCore/Framework/interface/produce_helpers.h"
#include "FWCore/Framework/interface/eventsetup_dependsOn.h"
Expand All @@ -91,7 +91,7 @@ Example: two algorithms each creating only one objects
// forward declarations
namespace edm {
namespace eventsetup {
class ESRecordsToProxyIndices;
class ESRecordsToProductResolverIndices;
//used by ESProducer to create the proper Decorator based on the
// argument type passed. The default it to just 'pass through'
// the argument as the decorator itself
Expand All @@ -101,7 +101,7 @@ namespace edm {
}
} // namespace eventsetup

class ESProducer : public ESProxyFactoryProducer {
class ESProducer : public ESProductResolverFactoryProducer {
public:
ESProducer();
~ESProducer() noexcept(false) override;
Expand All @@ -110,12 +110,12 @@ namespace edm {
ESProducer(ESProducer&&) = delete;
ESProducer& operator=(ESProducer&&) = delete;

void updateLookup(eventsetup::ESRecordsToProxyIndices const&) final;
ESProxyIndex const* getTokenIndices(unsigned int iIndex) const {
void updateLookup(eventsetup::ESRecordsToProductResolverIndices const&) final;
ESResolverIndex const* getTokenIndices(unsigned int iIndex) const {
if (itemsToGetFromRecords_.empty()) {
return nullptr;
}
return (itemsToGetFromRecords_[iIndex].empty()) ? static_cast<ESProxyIndex const*>(nullptr)
return (itemsToGetFromRecords_[iIndex].empty()) ? static_cast<ESResolverIndex const*>(nullptr)
: &(itemsToGetFromRecords_[iIndex].front());
}
ESRecordIndex const* getTokenRecordIndices(unsigned int iIndex) const {
Expand All @@ -135,11 +135,11 @@ namespace edm {
bool hasMayConsumes() const noexcept { return hasMayConsumes_; }

template <typename Record>
std::optional<std::vector<ESProxyIndex>> updateFromMayConsumes(unsigned int iIndex, const Record& iRecord) const {
std::optional<std::vector<ESResolverIndex>> updateFromMayConsumes(unsigned int iIndex, const Record& iRecord) const {
if (not hasMayConsumes()) {
return {};
}
std::vector<ESProxyIndex> ret = itemsToGetFromRecords_[iIndex];
std::vector<ESResolverIndex> ret = itemsToGetFromRecords_[iIndex];
auto const info = consumesInfos_[iIndex].get();
for (size_t i = 0; i < info->size(); ++i) {
auto chooserBase = (*info)[i].chooser_.get();
Expand Down Expand Up @@ -272,8 +272,8 @@ namespace edm {
const TProduct*,
const TRecord*,
const es::Label& iLabel) {
using ProxyType = eventsetup::CallbackProxy<CallbackT, TRecord, TProduct>;
using FactoryType = eventsetup::ProxyArgumentFactoryTemplate<ProxyType, CallbackT>;
using ResolverType = eventsetup::CallbackProductResolver<CallbackT, TRecord, TProduct>;
using FactoryType = eventsetup::ESProductResolverArgumentFactoryTemplate<ResolverType, CallbackT>;
registerFactory(std::make_unique<FactoryType>(std::move(iCallback)), iLabel.default_);
}

Expand All @@ -288,13 +288,13 @@ namespace edm {
IIndex,
" was never assigned a name in the 'setWhatProduced' method");
}
using ProxyType = eventsetup::CallbackProxy<CallbackT, TRecord, es::L<TProduct, IIndex>>;
using FactoryType = eventsetup::ProxyArgumentFactoryTemplate<ProxyType, CallbackT>;
using ResolverType = eventsetup::CallbackProductResolver<CallbackT, TRecord, es::L<TProduct, IIndex>>;
using FactoryType = eventsetup::ESProductResolverArgumentFactoryTemplate<ResolverType, CallbackT>;
registerFactory(std::make_unique<FactoryType>(std::move(iCallback)), iLabel.labels_[IIndex]);
}

std::vector<std::unique_ptr<ESConsumesInfo>> consumesInfos_;
std::vector<std::vector<ESProxyIndex>> itemsToGetFromRecords_;
std::vector<std::vector<ESResolverIndex>> itemsToGetFromRecords_;
//need another structure to say which record to get the data from in
// order to make prefetching work
std::vector<std::vector<ESRecordIndex>> recordsUsedDuringGet_;
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/ESProducerLooper.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace edm {

//use this to 'snoop' on what records are being used by the Producer
void registerFactoryWithKey(const eventsetup::EventSetupRecordKey& iRecord,
std::unique_ptr<eventsetup::ProxyFactoryBase> iFactory,
std::unique_ptr<eventsetup::ESProductResolverFactoryBase> iFactory,
const std::string& iLabel = std::string()) override;

private:
Expand Down
Loading

0 comments on commit 3175b93

Please sign in to comment.