CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/FWCore/Framework/interface/ESOutlet.h

Go to the documentation of this file.
00001 #ifndef Framework_ESOutlet_h
00002 #define Framework_ESOutlet_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Framework
00006 // Class  :     ESOutlet
00007 // 
00018 //
00019 // Original Author:  Chris Jones
00020 //         Created:  Fri Sep 22 15:07:28 EDT 2006
00021 // $Id: ESOutlet.h,v 1.1 2006/09/22 19:54:49 chrjones Exp $
00022 //
00023 
00024 // system include files
00025 #include <string>
00026 
00027 // user include files
00028 #include "FWCore/Utilities/interface/OutletBase.h"
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 #include "FWCore/Framework/interface/EventSetup.h"
00031 
00032 // forward declarations
00033 
00034 namespace edm {
00035   template <class T, class TRec>
00036   class ESOutlet :private OutletBase<T>
00037   {
00038     class Getter : public extensioncord::ECGetterBase<T> {
00039 public:
00040       Getter(const edm::EventSetup& iES,
00041              const std::string& iLabel = std::string()) :
00042       es_(&iES),
00043       label_(iLabel) {}
00044 private:
00045       virtual const T* getImpl() const {
00046         ESHandle<T> data;
00047         es_->template get<TRec>().get(label_,data);
00048         return &(*data);
00049       }
00050       const edm::EventSetup* es_;
00051       const std::string label_;
00052     };
00053     
00054     
00055    public:
00056       ESOutlet(const edm::EventSetup& iES,
00057                ExtensionCord<T>& iCord):
00058        OutletBase<T>(iCord),
00059        getter_(iES)  {
00060          this->setGetter(&getter_);
00061       }
00062 
00063       ESOutlet( const edm::EventSetup& iES,
00064               const std::string& iLabel,
00065               ExtensionCord<T>& iCord):
00066        getter_(iES,iLabel) {
00067          this->setGetter( &getter_);
00068       }
00069     
00070     //virtual ~ESOutlet();
00071 
00072    private:
00073       ESOutlet(const ESOutlet&); // stop default
00074 
00075       const ESOutlet& operator=(const ESOutlet&); // stop default
00076 
00077       // ---------- member data --------------------------------
00078       Getter getter_;
00079 
00080   };
00081 }
00082 
00083 #endif