CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions
edm::eventsetup::ComponentMaker< T, TComponent > Class Template Reference

#include <ComponentMaker.h>

Inheritance diagram for edm::eventsetup::ComponentMaker< T, TComponent >:
edm::eventsetup::ComponentMakerBase< T > edm::eventsetup::ComponentMakerBaseHelper

Public Types

typedef T::base_type base_type
 
- Public Types inherited from edm::eventsetup::ComponentMakerBase< T >
typedef T::base_type base_type
 

Public Member Functions

std::shared_ptr< base_typeaddTo (EventSetupsController &esController, EventSetupProvider &iProvider, ParameterSet &iConfiguration, bool replaceExisting) const override
 
 ComponentMaker ()
 
 ComponentMaker (const ComponentMaker &)=delete
 
const ComponentMakeroperator= (const ComponentMaker &)=delete
 
- Public Member Functions inherited from edm::eventsetup::ComponentMakerBaseHelper
virtual ~ComponentMakerBaseHelper ()
 

Private Member Functions

void setDescription (ESProductResolverProvider *iProv, const ComponentDescription &iDesc) const
 
void setDescription (void *, const ComponentDescription &) const
 
void setDescriptionForFinder (EventSetupRecordIntervalFinder *iFinder, const ComponentDescription &iDesc) const
 
void setDescriptionForFinder (void *, const ComponentDescription &) const
 
void setPostConstruction (ESProductResolverProvider *iProv, const edm::ParameterSet &iPSet) const
 
void setPostConstruction (void *, const edm::ParameterSet &) const
 

Additional Inherited Members

- Protected Member Functions inherited from edm::eventsetup::ComponentMakerBaseHelper
ComponentDescription createComponentDescription (ParameterSet const &iConfiguration) const
 

Detailed Description

template<class T, class TComponent>
class edm::eventsetup::ComponentMaker< T, TComponent >

Definition at line 61 of file ComponentMaker.h.

Member Typedef Documentation

◆ base_type

template<class T, class TComponent>
typedef T::base_type edm::eventsetup::ComponentMaker< T, TComponent >::base_type

Definition at line 66 of file ComponentMaker.h.

Constructor & Destructor Documentation

◆ ComponentMaker() [1/2]

template<class T, class TComponent>
edm::eventsetup::ComponentMaker< T, TComponent >::ComponentMaker ( )
inline

Definition at line 63 of file ComponentMaker.h.

63 {}

◆ ComponentMaker() [2/2]

template<class T, class TComponent>
edm::eventsetup::ComponentMaker< T, TComponent >::ComponentMaker ( const ComponentMaker< T, TComponent > &  )
delete

Member Function Documentation

◆ addTo()

template<class T , class TComponent >
std::shared_ptr< typename ComponentMaker< T, TComponent >::base_type > ComponentMaker::addTo ( EventSetupsController esController,
EventSetupProvider iProvider,
ParameterSet iConfiguration,
bool  replaceExisting 
) const
overridevirtual

Implements edm::eventsetup::ComponentMakerBase< T >.

Definition at line 96 of file ComponentMaker.h.

100  {
101  // This adds components to the EventSetupProvider for the process. It might
102  // make a new component then add it or reuse a component from an earlier
103  // SubProcess or the top level process and add that.
104 
105  {
106  auto modtype = iConfiguration.getParameter<std::string>("@module_type");
107  auto moduleLabel = iConfiguration.getParameter<std::string>("@module_label");
108  try {
110  ConfigurationDescriptions descriptions(T::baseType(), modtype);
111  fillDetails::fillIfExists<TComponent>(descriptions);
112  fillDetails::prevalidateIfExists<TComponent>(descriptions);
113  descriptions.validate(iConfiguration, moduleLabel);
114  iConfiguration.registerIt();
115  });
116  } catch (cms::Exception& iException) {
117  iException.addContext(fmt::format(
118  "Validating configuration of {} of type {} with label: '{}'", T::baseType(), modtype, moduleLabel));
119  throw;
120  }
121  }
122 
123  if (!replaceExisting) {
124  std::shared_ptr<typename T::base_type> alreadyMadeComponent =
125  T::getComponentAndRegisterProcess(esController, iConfiguration);
126 
127  if (alreadyMadeComponent) {
128  // This is for the case when a component is shared between
129  // a SubProcess and a previous SubProcess or the top level process
130  // because the component has an identical configuration to a component
131  // from the top level process or earlier SubProcess.
132  std::shared_ptr<TComponent> component(
133  std::static_pointer_cast<TComponent, typename T::base_type>(alreadyMadeComponent));
134  T::addTo(iProvider, component, iConfiguration, true);
135  return component;
136  }
137  }
138 
139  std::shared_ptr<TComponent> component = std::make_shared<TComponent>(iConfiguration);
140  ComponentDescription description = this->createComponentDescription(iConfiguration);
141 
142  this->setDescription(component.get(), description);
143  this->setDescriptionForFinder(component.get(), description);
144  this->setPostConstruction(component.get(), iConfiguration);
145 
146  if (replaceExisting) {
147  // This case is for ESProducers where in the first pass
148  // the algorithm thought the component could be shared
149  // across SubProcess's because there was an ESProducer
150  // from a previous process with an identical configuration.
151  // But in a later check it was determined that sharing was not
152  // possible because other components associated with the
153  // same record or records that record depends on had
154  // differing configurations.
155  T::replaceExisting(iProvider, component);
156  } else {
157  // This is for the case when a new component is being constructed.
158  // All components for the top level process fall in this category.
159  // Or it could be a SubProcess where neither the top level process
160  // nor any prior SubProcess had a component with exactly the same configuration.
161  T::addTo(iProvider, component, iConfiguration, false);
162  T::putComponent(esController, iConfiguration, component);
163  }
164  return component;
165  }
ComponentDescription createComponentDescription(ParameterSet const &iConfiguration) const
void setDescription(ESProductResolverProvider *iProv, const ComponentDescription &iDesc) const
void setPostConstruction(ESProductResolverProvider *iProv, const edm::ParameterSet &iPSet) const
void addContext(std::string const &context)
Definition: Exception.cc:169
void setDescriptionForFinder(EventSetupRecordIntervalFinder *iFinder, const ComponentDescription &iDesc) const
auto wrap(F iFunc) -> decltype(iFunc())

◆ operator=()

template<class T, class TComponent>
const ComponentMaker& edm::eventsetup::ComponentMaker< T, TComponent >::operator= ( const ComponentMaker< T, TComponent > &  )
delete

◆ setDescription() [1/2]

template<class T, class TComponent>
void edm::eventsetup::ComponentMaker< T, TComponent >::setDescription ( ESProductResolverProvider iProv,
const ComponentDescription iDesc 
) const
inlineprivate

Definition at line 78 of file ComponentMaker.h.

78  {
79  iProv->setDescription(iDesc);
80  }

◆ setDescription() [2/2]

template<class T, class TComponent>
void edm::eventsetup::ComponentMaker< T, TComponent >::setDescription ( void *  ,
const ComponentDescription  
) const
inlineprivate

Definition at line 89 of file ComponentMaker.h.

89 {}

◆ setDescriptionForFinder() [1/2]

template<class T, class TComponent>
void edm::eventsetup::ComponentMaker< T, TComponent >::setDescriptionForFinder ( EventSetupRecordIntervalFinder iFinder,
const ComponentDescription iDesc 
) const
inlineprivate

Definition at line 81 of file ComponentMaker.h.

81  {
82  iFinder->setDescriptionForFinder(iDesc);
83  }

◆ setDescriptionForFinder() [2/2]

template<class T, class TComponent>
void edm::eventsetup::ComponentMaker< T, TComponent >::setDescriptionForFinder ( void *  ,
const ComponentDescription  
) const
inlineprivate

Definition at line 90 of file ComponentMaker.h.

90 {}

◆ setPostConstruction() [1/2]

template<class T, class TComponent>
void edm::eventsetup::ComponentMaker< T, TComponent >::setPostConstruction ( ESProductResolverProvider iProv,
const edm::ParameterSet iPSet 
) const
inlineprivate

Definition at line 84 of file ComponentMaker.h.

84  {
85  //The 'appendToDataLabel' parameter was added very late in the development cycle and since
86  // the ParameterSet is not sent to the base class we must set the value after construction
87  iProv->setAppendToDataLabel(iPSet);
88  }

◆ setPostConstruction() [2/2]

template<class T, class TComponent>
void edm::eventsetup::ComponentMaker< T, TComponent >::setPostConstruction ( void *  ,
const edm::ParameterSet  
) const
inlineprivate

Definition at line 91 of file ComponentMaker.h.

91 {}