CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/FWCore/Utilities/interface/EDGetToken.h

Go to the documentation of this file.
00001 #ifndef FWCore_Utilities_EDGetToken_h
00002 #define FWCore_Utilities_EDGetToken_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     FWCore/Utilities
00006 // Class  :     EDGetToken
00007 // 
00020 //
00021 // Original Author:  Chris Jones
00022 //         Created:  Wed, 03 Apr 2013 17:54:11 GMT
00023 // $Id: EDGetToken.h,v 1.3 2013/06/04 15:07:14 wdd Exp $
00024 //
00025 
00026 // system include files
00027 
00028 // user include files
00029 
00030 // forward declarations
00031 namespace edm {
00032   class EDConsumerBase;
00033   template <typename T> class EDGetTokenT;
00034   
00035   class EDGetToken
00036   {
00037     friend class EDConsumerBase;
00038     
00039   public:
00040     
00041     EDGetToken() : m_value{s_uninitializedValue} {}
00042 
00043     template<typename T>
00044     EDGetToken(EDGetTokenT<T> iOther): m_value{iOther.m_value} {}
00045 
00046     // ---------- const member functions ---------------------
00047     unsigned int index() const {return m_value & s_indexMask;}
00048     bool willSkipCurrentProcess() const { return 0 != (m_value & s_skipMask); }
00049     bool isUnitialized() const { return m_value == s_uninitializedValue; }
00050 
00051   private:
00052 
00053     static const unsigned int s_uninitializedValue = 0xFFFFFFFF;
00054     static const unsigned int s_indexMask = 0x7FFFFFFF;
00055     static const unsigned int s_skipMask = 1U << 31;
00056 
00057     explicit EDGetToken(unsigned int iValue, bool skipCurrentProcess) : m_value{(iValue & s_indexMask) | (skipCurrentProcess ? s_skipMask : 0)} { }
00058 
00059     // ---------- member data --------------------------------
00060     unsigned int m_value;
00061   };
00062 
00063   template<typename T>
00064   class EDGetTokenT
00065   {
00066     friend class EDConsumerBase;
00067     friend class EDGetToken;
00068 
00069   public:
00070 
00071     EDGetTokenT() : m_value{s_uninitializedValue} {}
00072   
00073     // ---------- const member functions ---------------------
00074     unsigned int index() const {return m_value & s_indexMask;}
00075     bool willSkipCurrentProcess() const { return 0 != (m_value & s_skipMask); }
00076     bool isUnitialized() const { return m_value == s_uninitializedValue; }
00077 
00078   private:
00079 
00080     static const unsigned int s_uninitializedValue = 0xFFFFFFFF;
00081     static const unsigned int s_indexMask = 0x7FFFFFFF;
00082     static const unsigned int s_skipMask = 1U << 31;
00083 
00084     explicit EDGetTokenT(unsigned int iValue, bool skipCurrentProcess) : m_value{(iValue & s_indexMask) | (skipCurrentProcess ? s_skipMask : 0)} { }
00085 
00086     // ---------- member data --------------------------------
00087     unsigned int m_value;
00088   };
00089 }
00090 
00091 #endif