00001 // Author : Samvel Khalatian (samvel at fnal dot gov) 00002 // Created: 05/31/07 00003 // License: GPL 00004 00005 #include <ostream> 00006 00007 #include "CalibTracker/SiStripRunSummary/interface/Flag.h" 00008 00009 // --[ FLAG ]------------------------------------------------------------------ 00010 // --[ PUBLIC ]-- 00011 bool Flag::setState( const State &reSTATE) { 00012 // 1. reSTATE may be any value of: 0, 1, 2, 3...(2^n-1) where n is the nearest 00013 // larger binary power. 00014 // 00015 // oHackObj.setState( Flag::State( 3)); 00016 // 00017 // 2. Change state of flag only in case a new value was submitted 00018 return ( 3 > static_cast<unsigned char>( reSTATE) && 00019 reSTATE != eState_ ? 00020 ( eState_ = reSTATE, true) : 00021 false); 00022 } 00023 00024 // --[ HELPER FUNCTIONS ]------------------------------------------------------ 00025 std::ostream &operator <<( std::ostream &roOut, const Flag &roFLAG) { 00026 roOut << static_cast<int>( roFLAG.getState()) << " : " 00027 << roFLAG.getComment(); 00028 00029 return roOut; 00030 }