File indexing completed on 2023-03-17 11:03:38
0001 #include "FWCore/ServiceRegistry/interface/ESParentContext.h"
0002 #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
0003 #include "FWCore/ServiceRegistry/interface/ESModuleCallingContext.h"
0004
0005 #include "FWCore/Utilities/interface/EDMException.h"
0006
0007 #include <ostream>
0008
0009 namespace edm {
0010
0011 ESParentContext::ESParentContext() : type_(Type::kInvalid) { parent_.esmodule = nullptr; }
0012
0013 ESParentContext::ESParentContext(ModuleCallingContext const* module) noexcept : type_(Type::kModule) {
0014 parent_.module = module;
0015 }
0016
0017 ESParentContext::ESParentContext(ESModuleCallingContext const* module) noexcept : type_(Type::kESModule) {
0018 parent_.esmodule = module;
0019 }
0020
0021 ModuleCallingContext const* ESParentContext::moduleCallingContext() const {
0022 if (type_ != Type::kModule) {
0023 throw Exception(errors::LogicError)
0024 << "ESParentContext::moduleCallingContext called for incorrect type of context";
0025 }
0026 return parent_.module;
0027 }
0028
0029 ESModuleCallingContext const* ESParentContext::esmoduleCallingContext() const {
0030 if (type_ != Type::kESModule) {
0031 throw Exception(errors::LogicError)
0032 << "ESParentContext::esmoduleCallingContext called for incorrect type of context";
0033 }
0034 return parent_.esmodule;
0035 }
0036 }