CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/FWCore/Framework/src/CPCSentry.h

Go to the documentation of this file.
00001 #ifndef FWCore_Framework_CPCSentry_h
00002 #define FWCore_Framework_CPCSentry_h
00003 
00004 // class CPCSentry uses RAII to make sure that the
00005 // CurrentProcessingContext pointer it is guarding is set to the right
00006 // value, and cleared at the right time.
00007 
00008 namespace edm
00009 {
00010   class CurrentProcessingContext;
00011   namespace detail
00012   {
00013 
00014     class CPCSentry
00015     {
00016     public:
00017       CPCSentry(CurrentProcessingContext const*& c,
00018                 CurrentProcessingContext const* value) :
00019         referenced_(&c)
00020       {
00021         c = value;      
00022       }
00023 
00024       ~CPCSentry() { *referenced_ = 0; }
00025 
00026     private:
00027       CurrentProcessingContext const** referenced_;
00028     };
00029   }
00030 }
00031 
00032 
00033 #endif // FWCore_Framework_CPCSentry_h