Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:12

0001 #ifndef FWCore_Utilities_RunIndex_h
0002 #define FWCore_Utilities_RunIndex_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Utilities
0006 // Class  :     edm::RunIndex
0007 //
0008 /**\class edm::RunIndex RunIndex.h "FWCore/Utilities/interface/RunIndex.h"
0009 
0010  Description: Identifies a 'slot' being used to hold an active Run
0011 
0012  Usage:
0013     Various APIs used this to access per Run information.
0014  It is important to realize that the same RunIndex may be used to refer
0015  to different Runs over the lifetime of a job. An RunIndex will only get
0016  a new Run after the previous Run using that index has finished being used.
0017 
0018 */
0019 //
0020 // Original Author:  Chris Jones
0021 //         Created:  Fri, 26 Apr 2013 19:38:56 GMT
0022 //
0023 
0024 // system include files
0025 
0026 // user include files
0027 
0028 // forward declarations
0029 namespace edm {
0030   class RunPrincipal;
0031 
0032   class RunIndex {
0033   public:
0034     ~RunIndex() = default;
0035     RunIndex() = delete;
0036     RunIndex(const RunIndex&) = default;
0037     RunIndex& operator=(const RunIndex&) = default;
0038 
0039     // ---------- const member functions ---------------------
0040     bool operator==(const RunIndex& iIndex) const { return value() == iIndex.value(); }
0041     operator unsigned int() const { return value_; }
0042 
0043     /** \return value ranging from 0 to one less than max number of simultaneous runs.
0044      */
0045     unsigned int value() const { return value_; }
0046 
0047     static RunIndex invalidRunIndex();
0048 
0049   private:
0050     ///Only the RunPrincipal is allowed to make one of these
0051     friend class RunPrincipal;
0052     explicit RunIndex(unsigned int iIndex) : value_(iIndex) {}
0053 
0054     // ---------- member data --------------------------------
0055     unsigned int value_;
0056 
0057     static const unsigned int invalidValue_;
0058   };
0059 }  // namespace edm
0060 
0061 #endif