Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion FWCore/Framework/interface/EDAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "FWCore/Framework/interface/SharedResourcesAcquirer.h"
#include "FWCore/Concurrency/interface/SerialTaskQueue.h"
#include "FWCore/Concurrency/interface/WaitingTaskHolder.h"
#include "FWCore/Utilities/interface/deprecated_macro.h"

#include <string>

Expand All @@ -25,7 +26,7 @@ namespace edm {
class ModuleHolderT;
}

class EDAnalyzer : public EDConsumerBase {
class CMS_DEPRECATED EDAnalyzer : public EDConsumerBase {
public:
template <typename T>
friend class maker::ModuleHolderT;
Expand Down
3 changes: 2 additions & 1 deletion FWCore/Framework/interface/EDFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ These products should be informational products about the filter decision.
#include "FWCore/Concurrency/interface/WaitingTaskHolder.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "FWCore/Utilities/interface/deprecated_macro.h"

#include <string>
#include <vector>
Expand All @@ -35,7 +36,7 @@ namespace edm {
class ActivityRegistry;
class ThinnedAssociationsHelper;

class EDFilter : public ProducerBase, public EDConsumerBase {
class CMS_DEPRECATED EDFilter : public ProducerBase, public EDConsumerBase {
public:
template <typename T>
friend class maker::ModuleHolderT;
Expand Down
3 changes: 2 additions & 1 deletion FWCore/Framework/interface/EDProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ EDProducts into an Event.
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "FWCore/Concurrency/interface/WaitingTaskHolder.h"
#include "FWCore/Utilities/interface/deprecated_macro.h"

#include <string>
#include <vector>
Expand All @@ -32,7 +33,7 @@ namespace edm {
class ModuleHolderT;
}

class EDProducer : public ProducerBase, public EDConsumerBase {
class CMS_DEPRECATED EDProducer : public ProducerBase, public EDConsumerBase {
public:
template <typename T>
friend class maker::ModuleHolderT;
Expand Down
10 changes: 6 additions & 4 deletions FWCore/Framework/interface/EventSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "FWCore/Framework/interface/data_default_record_trait.h"
#include "FWCore/Utilities/interface/Transition.h"
#include "FWCore/Utilities/interface/ESIndices.h"
#include "FWCore/Utilities/interface/deprecated_macro.h"

// forward declarations

Expand Down Expand Up @@ -124,18 +125,19 @@ namespace edm {

/** can directly access data if data_default_record_trait<> is defined for this data type **/
template <typename T>
bool getData(T& iHolder) const {
return getData(std::string{}, iHolder);
CMS_DEPRECATED bool getData(T& iHolder) const {
auto const& rec = this->get<eventsetup::default_record_t<T>>();
return rec.get(std::string{}, iHolder);
}

template <typename T>
bool getData(const std::string& iLabel, T& iHolder) const {
CMS_DEPRECATED bool getData(const std::string& iLabel, T& iHolder) const {
auto const& rec = this->get<eventsetup::default_record_t<T>>();
return rec.get(iLabel, iHolder);
}

template <typename T>
bool getData(const ESInputTag& iTag, T& iHolder) const {
CMS_DEPRECATED bool getData(const ESInputTag& iTag, T& iHolder) const {
auto const& rec = this->get<eventsetup::default_record_t<T>>();
return rec.get(iTag, iHolder);
}
Expand Down
50 changes: 28 additions & 22 deletions FWCore/Framework/interface/EventSetupRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "FWCore/Utilities/interface/ESInputTag.h"
#include "FWCore/Utilities/interface/ESIndices.h"
#include "FWCore/Utilities/interface/Likely.h"
#include "FWCore/Utilities/interface/deprecated_macro.h"

// system include files
#include <exception>
Expand Down Expand Up @@ -108,37 +109,22 @@ namespace edm {
}

template <typename HolderT>
bool get(HolderT& iHolder) const {
return get("", iHolder);
CMS_DEPRECATED bool get(HolderT& iHolder) const {
return deprecated_get("", iHolder);
}

template <typename HolderT>
bool get(char const* iName, HolderT& iHolder) const {
if UNLIKELY (requireTokens_) {
throwCalledGetWithoutToken(heterocontainer::className<typename HolderT::value_type>(), iName);
}
typename HolderT::value_type const* value = nullptr;
ComponentDescription const* desc = nullptr;
std::shared_ptr<ESHandleExceptionFactory> whyFailedFactory;
impl_->getImplementation(
value, iName, desc, iHolder.transientAccessOnly, whyFailedFactory, *context_, eventSetupImpl_);

if (value) {
iHolder = HolderT(value, desc);
return true;
} else {
iHolder = HolderT(std::move(whyFailedFactory));
return false;
}
CMS_DEPRECATED bool get(char const* iName, HolderT& iHolder) const {
return deprecated_get(iName, iHolder);
}

template <typename HolderT>
bool get(std::string const& iName, HolderT& iHolder) const {
return get(iName.c_str(), iHolder);
CMS_DEPRECATED bool get(std::string const& iName, HolderT& iHolder) const {
return deprecated_get(iName.c_str(), iHolder);
}

template <typename HolderT>
bool get(ESInputTag const& iTag, HolderT& iHolder) const {
CMS_DEPRECATED bool get(ESInputTag const& iTag, HolderT& iHolder) const {
if UNLIKELY (requireTokens_) {
throwCalledGetWithoutToken(heterocontainer::className<typename HolderT::value_type>(), iTag.data().c_str());
}
Expand Down Expand Up @@ -258,6 +244,26 @@ namespace edm {
bool requireTokens() const { return requireTokens_; }

private:
template <typename HolderT>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the old get call renamed. I did this to avoid having multiple "deprecated" messages happening in the case someone called a deprecated function that then called the deprecated get. In that case you'd get one warning at the callers site and a second one in EventSetupRecord.h itself. Moving the implementation to a private function that isn't annotated avoids that.

bool deprecated_get(char const* iName, HolderT& iHolder) const {
if UNLIKELY (requireTokens_) {
throwCalledGetWithoutToken(heterocontainer::className<typename HolderT::value_type>(), iName);
}
typename HolderT::value_type const* value = nullptr;
ComponentDescription const* desc = nullptr;
std::shared_ptr<ESHandleExceptionFactory> whyFailedFactory;
impl_->getImplementation(
value, iName, desc, iHolder.transientAccessOnly, whyFailedFactory, *context_, eventSetupImpl_);

if (value) {
iHolder = HolderT(value, desc);
return true;
} else {
iHolder = HolderT(std::move(whyFailedFactory));
return false;
}
}

template <template <typename> typename H, typename T, typename R>
H<T> invalidTokenHandle(ESGetToken<T, R> const& iToken) const {
auto const key = this->key();
Expand Down
8 changes: 8 additions & 0 deletions FWCore/Utilities/interface/deprecated_macro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef FWCore_Utilites_deprecated_macro_h
#define FWCore_Utilites_deprecated_macro_h
#if !defined USE_CMS_DEPRECATED
#define CMS_DEPRECATED
#else
#define CMS_DEPRECATED [[deprecated]]
#endif
#endif