Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:32

0001 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0002 
0003 #include <ostream>
0004 #include <sstream>
0005 #include <limits>
0006 #include <atomic>
0007 
0008 static std::atomic<unsigned int> s_id{0};
0009 
0010 /*----------------------------------------------------------------------
0011 
0012 ----------------------------------------------------------------------*/
0013 
0014 namespace edm {
0015 
0016   ModuleDescription::ModuleDescription()
0017       : parameterSetID_(), moduleName_(), moduleLabel_(), processConfigurationPtr_(nullptr), id_(invalidID()) {}
0018 
0019   ModuleDescription::ModuleDescription(ParameterSetID const& pid,
0020                                        std::string const& modName,
0021                                        std::string const& modLabel)
0022       : ModuleDescription{pid, modName, modLabel, nullptr, invalidID()} {}
0023 
0024   ModuleDescription::ModuleDescription(ParameterSetID const& pid,
0025                                        std::string const& modName,
0026                                        std::string const& modLabel,
0027                                        ProcessConfiguration const* procConfig,
0028                                        unsigned int iID)
0029       : parameterSetID_(pid),
0030         moduleName_(modName),
0031         moduleLabel_(modLabel),
0032         processConfigurationPtr_(procConfig),
0033         id_(iID) {}
0034 
0035   ModuleDescription::ModuleDescription(std::string const& modName, std::string const& modLabel)
0036       : ModuleDescription{ParameterSetID(), modName, modLabel, nullptr, invalidID()} {}
0037 
0038   ModuleDescription::ModuleDescription(std::string const& modName,
0039                                        std::string const& modLabel,
0040                                        ProcessConfiguration const* procConfig)
0041       : ModuleDescription{ParameterSetID(), modName, modLabel, procConfig, invalidID()} {}
0042 
0043   ModuleDescription::~ModuleDescription() {}
0044 
0045   ProcessConfiguration const& ModuleDescription::processConfiguration() const { return *processConfigurationPtr_; }
0046 
0047   std::string const& ModuleDescription::processName() const { return processConfiguration().processName(); }
0048 
0049   std::string const& ModuleDescription::releaseVersion() const { return processConfiguration().releaseVersion(); }
0050 
0051   std::string const& ModuleDescription::passID() const { return processConfiguration().passID(); }
0052 
0053   ParameterSetID const& ModuleDescription::mainParameterSetID() const {
0054     return processConfiguration().parameterSetID();
0055   }
0056 
0057   bool ModuleDescription::operator<(ModuleDescription const& rh) const {
0058     if (moduleLabel() < rh.moduleLabel())
0059       return true;
0060     if (rh.moduleLabel() < moduleLabel())
0061       return false;
0062     if (processName() < rh.processName())
0063       return true;
0064     if (rh.processName() < processName())
0065       return false;
0066     if (moduleName() < rh.moduleName())
0067       return true;
0068     if (rh.moduleName() < moduleName())
0069       return false;
0070     if (parameterSetID() < rh.parameterSetID())
0071       return true;
0072     if (rh.parameterSetID() < parameterSetID())
0073       return false;
0074     if (releaseVersion() < rh.releaseVersion())
0075       return true;
0076     if (rh.releaseVersion() < releaseVersion())
0077       return false;
0078     if (passID() < rh.passID())
0079       return true;
0080     return false;
0081   }
0082 
0083   bool ModuleDescription::operator==(ModuleDescription const& rh) const { return !((*this) < rh || rh < (*this)); }
0084 
0085   bool ModuleDescription::operator!=(ModuleDescription const& rh) const { return !((*this) == rh); }
0086 
0087   unsigned int ModuleDescription::getUniqueID() { return s_id++; }
0088 
0089   void ModuleDescription::write(std::ostream& os) const {
0090     os << "Module type=" << moduleName() << ", "
0091        << "Module label=" << moduleLabel() << ", "
0092        << "Parameter Set ID=" << parameterSetID();
0093     //<< "Parameter Set ID=" << parameterSetID() << ", "
0094     //<< "Process name=" << processName() << ", "
0095     //<< "Release Version=" << releaseVersion() << ", "
0096     //<< "Pass ID=" << passID() << ", "
0097     //<< "Main Parameter Set ID=" << mainParameterSetID();
0098   }
0099 }  // namespace edm