CMS 3D CMS Logo

ModuleDescription.cc

Go to the documentation of this file.
00001 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00002 
00003 #include "FWCore/Utilities/interface/Digest.h"
00004 
00005 #include <ostream>
00006 #include <sstream>
00007 
00008 /*----------------------------------------------------------------------
00009 
00010 $Id: ModuleDescription.cc,v 1.2 2007/06/28 23:30:50 wmtan Exp $
00011 
00012 ----------------------------------------------------------------------*/
00013 
00014 namespace edm {
00015 
00016   ModuleDescription::ModuleDescription() :
00017     parameterSetID_(),
00018     moduleName_(),
00019     moduleLabel_(),
00020     processConfiguration_()
00021   { }
00022 
00023   bool
00024   ModuleDescription::operator<(ModuleDescription const& rh) const {
00025     if (moduleLabel() < rh.moduleLabel()) return true;
00026     if (rh.moduleLabel() < moduleLabel()) return false;
00027     if (processName() < rh.processName()) return true;
00028     if (rh.processName() < processName()) return false;
00029     if (moduleName() < rh.moduleName()) return true;
00030     if (rh.moduleName() < moduleName()) return false;
00031     if (parameterSetID() < rh.parameterSetID()) return true;
00032     if (rh.parameterSetID() < parameterSetID()) return false;
00033     if (releaseVersion() < rh.releaseVersion()) return true;
00034     if (rh.releaseVersion() < releaseVersion()) return false;
00035     if (passID() < rh.passID()) return true;
00036     return false;
00037   } 
00038 
00039   bool
00040   ModuleDescription::operator==(ModuleDescription const& rh) const {
00041     return !((*this) < rh || rh < (*this));
00042   }
00043 
00044   bool
00045   ModuleDescription::operator!=(ModuleDescription const& rh) const {
00046     return !((*this) == rh);
00047   }
00048 
00049   void
00050   ModuleDescription::write(std::ostream& os) const {
00051     os  << "Module type=" << moduleName() << ", "
00052         << "Module label=" << moduleLabel() << ", "
00053         << "Parameter Set ID=" << parameterSetID() << ", "
00054         << "Process name=" << processName() << ", "
00055         << "Release Version=" << releaseVersion() << ", "
00056         << "Pass ID=" << passID() << ", "
00057         << "Main Parameter Set ID=" << mainParameterSetID();
00058   }
00059 
00060   ModuleDescriptionID
00061   ModuleDescription::id() const
00062   {
00063     // This implementation is ripe for optimization.
00064     // We do not use operator<< because it does not write out everything.
00065     std::ostringstream oss;
00066     oss << parameterSetID() << ' ' 
00067         << moduleName() << ' '
00068         << moduleLabel() << ' '
00069         << mainParameterSetID() << ' '
00070         << releaseVersion() << ' '
00071         << processName() << ' '
00072         << passID();
00073     std::string stringrep = oss.str();
00074     cms::Digest md5alg(stringrep);
00075     return ModuleDescriptionID(md5alg.digest().toString());
00076   }
00077 
00078 }

Generated on Tue Jun 9 17:31:37 2009 for CMSSW by  doxygen 1.5.4