CVC3  2.4.1
cdflags.h
Go to the documentation of this file.
1 /*****************************************************************************/
2 /*!
3  *\file cdflags.h
4  *\brief Context Dependent Vector of Flags
5  *
6  * Author: Clark Barrett
7  *
8  * Created: Thu Jan 26 16:37:46 2006
9  *
10  * <hr>
11  *
12  * License to use, copy, modify, sell and/or distribute this software
13  * and its documentation for any purpose is hereby granted without
14  * royalty, subject to the terms and conditions defined in the \ref
15  * LICENSE file provided with this distribution.
16  *
17  * <hr>
18  *
19  */
20 /*****************************************************************************/
21 
22 #ifndef _cvc3__include__cdflags_h_
23 #define _cvc3__include__cdflags_h_
24 
25 #include "context.h"
26 #include "os.h"
27 
28 namespace CVC3 {
29 
30 ///////////////////////////////////////////////////////////////////////////////
31 // //
32 // Class: CDFlags (Context Dependent Vector of Flags) //
33 // Author: Clark Barrett //
34 // Created: Thu Jan 26 16:37:46 2006 //
35 // //
36 ///////////////////////////////////////////////////////////////////////////////
37 class CVC_DLL CDFlags :public ContextObj {
38  unsigned d_flags;
39 
41  { return new(cmm) CDFlags(*this); }
42  virtual void restoreData(ContextObj* data)
43  { d_flags = ((CDFlags*)data)->d_flags; }
44  virtual void setNull(void) { FatalAssert(false, "Should never be called"); }
45 
46  void update(unsigned mask, int scope, bool setMask);
47 
48  // Disable copy constructor and operator=
49  // If you need these, use smartcdo instead
50  CDFlags(const CDFlags& cdflags): ContextObj(cdflags), d_flags(cdflags.d_flags) { }
51  CDFlags& operator=(const CDFlags& cdflags) { return *this; }
52 
53 public:
54  CDFlags(Context* context) : ContextObj(context), d_flags(0)
55  { IF_DEBUG(setName("CDFlags");) }
56  ~CDFlags() {}
57  void set(unsigned mask, int scope=-1) { update(mask, scope, true); }
58  void clear(unsigned mask, int scope=-1) { update(mask, scope, false); }
59  bool get(unsigned mask) const { return (d_flags & mask) != 0; }
60 };
61 
62 }
63 
64 #endif