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 
00027 namespace CVC3 {
00028 
00029 ///////////////////////////////////////////////////////////////////////////////
00030 //                                                                           //
00031 // Class: CDFlags (Context Dependent Vector of Flags)          //
00032 // Author: Clark Barrett                                                     //
00033 // Created: Thu Jan 26 16:37:46 2006               //
00034 //                                                                           //
00035 ///////////////////////////////////////////////////////////////////////////////
00036 class CDFlags :public ContextObj {
00037   unsigned d_flags;
00038 
00039   virtual ContextObj* makeCopy(ContextMemoryManager* cmm)
00040     { return new(cmm) CDFlags(*this); }
00041   virtual void restoreData(ContextObj* data)
00042     { d_flags = ((CDFlags*)data)->d_flags; }
00043   virtual void setNull(void) { FatalAssert(false, "Should never be called"); }
00044 
00045   void update(unsigned mask, int scope, bool setMask);
00046 
00047   // Disable copy constructor and operator=
00048   // If you need these, use smartcdo instead
00049   CDFlags(const CDFlags& cdflags): ContextObj(cdflags), d_flags(cdflags.d_flags) { }
00050   CDFlags& operator=(const CDFlags& cdflags) { return *this; }
00051 
00052 public:
00053   CDFlags(Context* context) : ContextObj(context), d_flags(0)
00054     { IF_DEBUG(setName("CDFlags")); }
00055   ~CDFlags() {}
00056   void set(unsigned mask, int scope=-1) { update(mask, scope, true); }
00057   void clear(unsigned mask, int scope=-1) { update(mask, scope, false); }
00058   bool get(unsigned mask) const { return (d_flags & mask) != 0; }
00059 };
00060 
00061 }
00062 
00063 #endif

Generated on Tue Jul 3 14:33:35 2007 for CVC3 by  doxygen 1.5.1