CMS 3D CMS Logo

ESProxyFactoryProducer Class Reference

#include <FWCore/Framework/interface/ESProxyFactoryProducer.h>


Detailed Description

Description: An EventSetup algorithmic Provider that manages Factories of Proxies

Usage: This class is used when the algorithms in the EventSetup that are to be run on demand are encapsulated in edm::eventsetup::Proxy's. This 'design pattern' is more flexible than having the algorithm embedded directly in the Provider (see ESProducer for such an implemenation).

Users inherit from this class and then call the 'registerFactory' method in their class' constructor in order to get their Proxies registered. For most users, the already available templated Factory classes should suffice and therefore they should not need to create their own Factories.

Example: register one Factory that creates a proxy that takes no arguments

   class FooProxy : public edm::eventsetup::DataProxy { ... };
   class FooProd : public edm::ESProxyFactoryProducer { ... };

   FooProd::FooProd(const edm::ParameterSet&) {
      typedef edm::eventsetup::ProxyFactoryTemplate<FooProxy> > TYPE;
      registerFactory(std::auto_ptr<TYPE>(new TYPE());
   };

Example: register one Factory that creates a proxy that takes one argument

class BarProxy : public edm::eventsetup::DataProxy { ...
   BarProxy(const edm::ParameterSet&) ;
   ... };
class BarProd : public edm::ESProxyFactoryProducer { ... };

BarProd::BarProd(const edm::ParameterSet& iPS) {
   typedef edm::eventsetup::ProxyArgumentFactoryTemplate<FooProxy, edm::ParmeterSet> TYPE;
   registerFactory(std::auto_ptr<TYPE>(new TYPE(iPS));
};