CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DataFormats/Common/interface/ProductData.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_ProductData_h
00002 #define DataFormats_Common_ProductData_h
00003 
00004 /*----------------------------------------------------------------------
00005 
00006 ProductData: A collection of information related to a single EDProduct. This
00007 is the storage unit of such information.
00008 
00009 ----------------------------------------------------------------------*/
00010 
00011 #include "DataFormats/Provenance/interface/Provenance.h"
00012 #include "boost/shared_ptr.hpp"
00013 
00014 namespace edm {
00015   class ConstBranchDescription;
00016   class WrapperOwningHolder;
00017   struct ProductData {
00018     ProductData();
00019 
00020     explicit ProductData(boost::shared_ptr<ConstBranchDescription> bd);
00021 
00022     // For use by FWLite
00023     ProductData(void const* product, Provenance const& prov);
00024 
00025     WrapperInterfaceBase const* getInterface() const {
00026       return prov_.product().getInterface();
00027     }
00028 
00029     boost::shared_ptr<ConstBranchDescription> const& branchDescription() const {
00030       return prov_.constBranchDescriptionPtr();
00031     }
00032 
00033     void swap(ProductData& other) {
00034        std::swap(wrapper_, other.wrapper_);
00035        prov_.swap(other.prov_);
00036     }
00037 
00038     void resetBranchDescription(boost::shared_ptr<ConstBranchDescription> bd);
00039 
00040     void resetProductData() {
00041       wrapper_.reset();
00042       prov_.resetProductProvenance();
00043     }
00044 
00045     // "non-const data" (updated every event)
00046     mutable boost::shared_ptr<void const> wrapper_;
00047     mutable Provenance prov_;
00048   };
00049 
00050   // Free swap function
00051   inline void swap(ProductData& a, ProductData& b) {
00052     a.swap(b);
00053   }
00054 }
00055 #endif