CVC3

cdflags.h

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*!
00003  *\file cdflags.h
00004  *\brief Context Dependent Vector of Flags
00005  *
00006  * Author: Clark Barrett
00007  *
00008  * Created: Thu Jan 26 16:37:46 2006
00009  *
00010  * <hr>
00011  *
00012  * License to use, copy, modify, sell and/or distribute this software
00013  * and its documentation for any purpose is hereby granted without
00014  * royalty, subject to the terms and conditions defined in the \ref
00015  * LICENSE file provided with this distribution.
00016  * 
00017  * <hr>
00018  * 
00019  */
00020 /*****************************************************************************/
00021 
00022 #ifndef _cvc3__include__cdflags_h_
00023 #define _cvc3__include__cdflags_h_
00024 
00025 #include "context.h"
00026 #include "os.h"
00027 
00028 namespace CVC3 {
00029 
00030 ///////////////////////////////////////////////////////////////////////////////
00031 //                                                                           //
00032 // Class: CDFlags (Context Dependent Vector of Flags)          //
00033 // Author: Clark Barrett                                                     //
00034 // Created: Thu Jan 26 16:37:46 2006               //
00035 //                                                                           //
00036 ///////////////////////////////////////////////////////////////////////////////
00037 class CVC_DLL CDFlags :public ContextObj {
00038   unsigned d_flags;
00039 
00040   virtual ContextObj* makeCopy(ContextMemoryManager* cmm)
00041     { return new(cmm) CDFlags(*this); }
00042   virtual void restoreData(ContextObj* data)
00043     { d_flags = ((CDFlags*)data)->d_flags; }
00044   virtual void setNull(void) { FatalAssert(false, "Should never be called"); }
00045 
00046   void update(unsigned mask, int scope, bool setMask);
00047 
00048   // Disable copy constructor and operator=
00049   // If you need these, use smartcdo instead
00050   CDFlags(const CDFlags& cdflags): ContextObj(cdflags), d_flags(cdflags.d_flags) { }
00051   CDFlags& operator=(const CDFlags& cdflags) { return *this; }
00052 
00053 public:
00054   CDFlags(Context* context) : ContextObj(context), d_flags(0)
00055     { IF_DEBUG(setName("CDFlags");) }
00056   ~CDFlags() {}
00057   void set(unsigned mask, int scope=-1) { update(mask, scope, true); }
00058   void clear(unsigned mask, int scope=-1) { update(mask, scope, false); }
00059   bool get(unsigned mask) const { return (d_flags & mask) != 0; }
00060 };
00061 
00062 }
00063 
00064 #endif