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  * Copyright (C) 2006 by the Board of Trustees of Leland Stanford
00012  * Junior University and by New York University. 
00013  *
00014  * License to use, copy, modify, sell and/or distribute this software
00015  * and its documentation for any purpose is hereby granted without
00016  * royalty, subject to the terms and conditions defined in the \ref
00017  * LICENSE file provided with this distribution.  In particular:
00018  *
00019  * - The above copyright notice and this permission notice must appear
00020  * in all copies of the software and related documentation.
00021  *
00022  * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES,
00023  * EXPRESSED OR IMPLIED.  USE IT AT YOUR OWN RISK.
00024  * 
00025  * <hr>
00026  * 
00027  */
00028 /*****************************************************************************/
00029 
00030 #ifndef _cvcl__include__cdflags_h_
00031 #define _cvcl__include__cdflags_h_
00032 
00033 #include "context.h"
00034 
00035 namespace CVCL {
00036 
00037 ///////////////////////////////////////////////////////////////////////////////
00038 //                                                                           //
00039 // Class: CDFlags (Context Dependent Vector of Flags)                        //
00040 // Author: Clark Barrett                                                     //
00041 // Created: Thu Jan 26 16:37:46 2006                                         //
00042 //                                                                           //
00043 ///////////////////////////////////////////////////////////////////////////////
00044 class CDFlags :public ContextObj {
00045   unsigned d_flags;
00046 
00047   virtual ContextObj* makeCopy(void) { return new CDFlags(*this); }
00048   virtual void restoreData(ContextObj* data)
00049     { d_flags = ((CDFlags*)data)->d_flags; }
00050   virtual void setNull(void) { FatalAssert(false, "Should never be called"); }
00051 
00052   void update(unsigned mask, int scope, bool setMask);
00053 
00054   // Disable copy constructor and operator=
00055   // If you need these, use smartcdo instead
00056   CDFlags(const CDFlags& cdflags): ContextObj(cdflags), d_flags(cdflags.d_flags) { }
00057   CDFlags& operator=(const CDFlags& cdflags) { return *this; }
00058 
00059 public:
00060   CDFlags(Context* context) : ContextObj(context), d_flags(0)
00061     { IF_DEBUG(setName("CDFlags")); }
00062   ~CDFlags() { TRACE("context verbose", "~CDFlags[", this, "]"); }
00063   void set(unsigned mask, int scope=-1) { update(mask, scope, true); }
00064   void clear(unsigned mask, int scope=-1) { update(mask, scope, false); }
00065   bool get(unsigned mask) const { return d_flags & mask; }
00066 };
00067 
00068 }
00069 
00070 #endif

Generated on Thu Apr 13 16:57:29 2006 for CVC Lite by  doxygen 1.4.4