CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/Skeletons/scripts/mkTemplates/ESProducer/esproducer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    prodname
00004 // Class:      prodname
00005 // 
00013 //
00014 // Original Author:  John Doe
00015 //         Created:  day-mon-xx
00016 // RCS(Id)
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include "boost/shared_ptr.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/ModuleFactory.h"
00027 #include "FWCore/Framework/interface/ESProducer.h"
00028 
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 
00031 @perl if( 1 lt scalar( @::datatypes ) ) {$result="#include \"FWCore/Framework/interface/ESProducts.h\""; } @\perl
00032 
00033 
00034 //
00035 // class declaration
00036 //
00037 
00038 class prodname : public edm::ESProducer {
00039    public:
00040       prodname(const edm::ParameterSet&);
00041       ~prodname();
00042 
00043       typedef @perl if( 1 eq scalar( @::datatypes ) ) { $result="boost::shared_ptr<$::datatypes[0]>"; } else { $result="edm::ESProducts<"; $line = 0; foreach $type ( @::datatypes ) { if ($line) { $result = "$result, "; } $result= "$result boost::shared_ptr<$type> ";  $line =1;} $result="$result>"; }  @\perl ReturnType;
00044 
00045       ReturnType produce(const recordname&);
00046    private:
00047       // ----------member data ---------------------------
00048 };
00049 
00050 //
00051 // constants, enums and typedefs
00052 //
00053 
00054 //
00055 // static data member definitions
00056 //
00057 
00058 //
00059 // constructors and destructor
00060 //
00061 prodname::prodname(const edm::ParameterSet& iConfig)
00062 {
00063    //the following line is needed to tell the framework what
00064    // data is being produced
00065    setWhatProduced(this);
00066 
00067    //now do what ever other initialization is needed
00068 }
00069 
00070 
00071 prodname::~prodname()
00072 {
00073  
00074    // do anything here that needs to be done at desctruction time
00075    // (e.g. close files, deallocate resources etc.)
00076 
00077 }
00078 
00079 
00080 //
00081 // member functions
00082 //
00083 
00084 // ------------ method called to produce the data  ------------
00085 prodname::ReturnType
00086 prodname::produce(const recordname& iRecord)
00087 {
00088    using namespace edm::es;
00089 @perl $result=""; foreach $type (@::datatypes) {$result ="$result   boost::shared_ptr<$type> p$type ;\n";} @\perl
00090 
00091    return @perl if( 1 eq scalar( @::datatypes ) ) { $result="p$::datatypes[0]" } else { $result="products("; $line = 0; foreach $type ( @::datatypes ) { if ($line) { $result = "$result,"; } $result= "$result p$type"; $line +=1; } $result="$result)"; }  @\perl ;
00092 }
00093 
00094 //define this as a plug-in
00095 DEFINE_FWK_EVENTSETUP_MODULE(prodname);