00001 #ifndef Framework_ConstProductRegistry_h 00002 #define Framework_ConstProductRegistry_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Framework 00006 // Class : ConstProductRegistry 00007 // 00016 // 00017 // Original Author: Chris Jones 00018 // Created: Thu Sep 22 18:01:21 CEST 2005 00019 // $Id: ConstProductRegistry.h,v 1.9 2012/09/27 15:21:21 eulisse Exp $ 00020 // 00021 00022 // system include files 00023 #include <vector> 00024 #include <string> 00025 00026 // user include files 00027 #include "FWCore/Framework/src/SignallingProductRegistry.h" 00028 #include "FWCore/ServiceRegistry/interface/connect_but_block_self.h" 00029 00030 // forward declarations 00031 namespace edm { 00032 class ConstProductRegistry 00033 { 00034 00035 public: 00036 typedef ProductRegistry::ProductList ProductList; 00037 00038 ConstProductRegistry(SignallingProductRegistry& iReg) : reg_(&iReg) { } 00039 00040 // ---------- const member functions --------------------- 00041 ProductRegistry const& productRegistry() const {return *reg_;} 00042 00043 ProductList const& productList() const {return reg_->productList();} 00044 00045 // Return all the branch names currently known to *this. This 00046 // does a return-by-value of the vector so that it may be used in 00047 // a colon-initialization list. 00048 std::vector<std::string> allBranchNames() const {return reg_->allBranchNames();} 00049 00050 // Return pointers to (const) BranchDescriptions for all the 00051 // BranchDescriptions known to *this. This does a 00052 // return-by-value of the vector so that it may be used in a 00053 // colon-initialization list. 00054 std::vector<BranchDescription const*> allBranchDescriptions() const {return reg_->allBranchDescriptions();} 00055 00056 bool anyProductProduced() const {return reg_->anyProductProduced();} 00057 00058 template< class T> 00059 void watchProductAdditions(const T& iFunc) 00060 { 00061 serviceregistry::connect_but_block_self(reg_->productAddedSignal_, 00062 iFunc); 00063 } 00064 template< class T, class TMethod> 00065 void watchProductAdditions(T const& iObj, TMethod iMethod) 00066 { 00067 serviceregistry::connect_but_block_self(reg_->productAddedSignal_, 00068 boost::bind(iMethod, iObj,_1)); 00069 } 00070 00071 private: 00072 // stop default 00073 ConstProductRegistry(const ConstProductRegistry&); 00074 00075 // stop default 00076 const ConstProductRegistry& operator=(const ConstProductRegistry&); 00077 00078 // ---------- member data -------------------------------- 00079 SignallingProductRegistry* reg_; 00080 }; 00081 } 00082 00083 #endif