CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/FWCore/ParameterSet/src/Registry.cc

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------
00002 // ----------------------------------------------------------------------
00003 
00004 #include "FWCore/ParameterSet/interface/Registry.h"
00005 #include "FWCore/Utilities/interface/EDMException.h"
00006 
00007 
00008 namespace edm {
00009   namespace pset {
00010     ParameterSetID
00011     getProcessParameterSetID(Registry const* reg) {
00012       ParameterSetID const& psetID = reg->extra().id();
00013       if (!psetID.isValid()) {
00014         throw edm::Exception(errors::LogicError)
00015           << "Illegal attempt to access the process top level parameter set ID\n"
00016           << "before that parameter set has been frozen and registered.\n"
00017           << "The parameter set can be changed during module validation,\n"
00018           << "which occurs concurrently with module construction.\n"
00019           << "It is illegal to access the parameter set before it is frozen.\n";
00020       }
00021       return psetID;
00022     }
00023 
00024     void fillMap(Registry* reg, regmap_type& fillme) {
00025       typedef Registry::const_iterator iter;
00026       fillme.clear();
00027       // Note: The tracked part is in the registry.
00028       for (iter i = reg->begin(), e = reg->end(); i != e; ++i) {
00029         fillme[i->first].pset() = i->second.toString();
00030       }
00031     }
00032   } // namespace pset
00033 
00034   ParameterSet const& getProcessParameterSet() {
00035     pset::Registry* reg = pset::Registry::instance();
00036     ParameterSetID id = pset::getProcessParameterSetID(reg);
00037 
00038     ParameterSet const* result;
00039     if (0==(result=reg->getMapped(id))) {
00040       throw edm::Exception(errors::EventCorruption, "Unknown ParameterSetID")
00041         << "Unable to find the ParameterSet for id: "
00042         << id
00043         << ";\nthis was supposed to be the process ParameterSet\n";
00044     }
00045     return *result;
00046   }
00047 
00048 } // namespace edm
00049