Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-24 04:44:52

0001 #ifndef FWCore_Framework_ProductResolverIndexAndSkipBit_h
0002 #define FWCore_Framework_ProductResolverIndexAndSkipBit_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     edm::ProductResolverIndexAndSkipBit
0007 //
0008 /**\class edm::ProductResolverIndexAndSkipBit
0009 
0010  Description:  This class holds a ProductIndexHolder and a boolean value
0011     to indicate whether the skipCurrentProcess option was set. Internally
0012     it bit packs them in an unsigned int. There is a little extra complexity
0013     in the implementation to hide the fact that some special values of
0014     ProductResolverIndex use the same bit we use for skipCurrentProcess.
0015 
0016  Usage:
0017     EDConsumerBase use this and pass a container of them to the Workers
0018     to let them know what data will be consumed.
0019 */
0020 //
0021 // Original Author:  W. David Dagenhart
0022 //         Created:  3 October 2013
0023 
0024 #include "FWCore/Utilities/interface/ProductResolverIndex.h"
0025 
0026 namespace edm {
0027 
0028   class ProductResolverIndexAndSkipBit {
0029   public:
0030     ProductResolverIndexAndSkipBit(ProductResolverIndex productResolverIndex, bool skipCurrentProcess)
0031         : value_(skipCurrentProcess ? s_skipMask | productResolverIndex : ~s_skipMask & productResolverIndex) {}
0032     ProductResolverIndex productResolverIndex() const {
0033       bool specialIndexValue = (value_ & ProductResolverIndexValuesBit) != 0;
0034       return specialIndexValue ? value_ | s_skipMask : value_ & ~s_skipMask;
0035     }
0036     bool skipCurrentProcess() const { return (value_ & s_skipMask) != 0; }
0037 
0038     bool operator==(ProductResolverIndexAndSkipBit const& r) const { return value_ == r.value_; }
0039 
0040   private:
0041     static const unsigned int s_skipMask = 1U << 31;
0042 
0043     unsigned int value_;
0044   };
0045 }  // namespace edm
0046 #endif