00001 #ifndef wali_IMARKABLE_GUARD 00002 #define wali_IMARKABLE_GUARD 1 00003 00004 /*! 00005 * @author Nicholas Kidd 00006 */ 00007 00008 #include "wali/Common.hpp" 00009 00010 namespace wali 00011 { 00012 /*! 00013 * @class IMarkable 00014 * 00015 * IMarkable defines the Markable interface. Markable objects are things 00016 * that need to be placed in a worklist while possibly being in the 00017 * worklist, and/or objects in cyclic or DAG-like data structures that are 00018 * traversed in some fashion. 00019 * 00020 * IMarkable is implemented in the Markable class. The interface has been 00021 * extracted out for allowing "delegate" objects to delegate the mark() and 00022 * unmark() calls to the wrapped object. E.g., the Decorator Pattern. 00023 * 00024 * @see Worklist 00025 */ 00026 00027 class IMarkable 00028 { 00029 public: 00030 00031 /*! Creates a new IMarkable in the unmarked state */ 00032 IMarkable() {} 00033 00034 /*! 00035 * This copy constructor actually acts just like the default 00036 * constructor. This input IMarkable m is ignored. Any time a 00037 * IMarkable is created it is "born" in the unmarked state. 00038 * 00039 * @param m is ignored 00040 */ 00041 IMarkable( const IMarkable& m ATTR_UNUSED ) 00042 { 00043 (void) m; 00044 } 00045 00046 /*! 00047 * IMarkable::operator= has no effect b/c IMarkable has no fields. 00048 * In general though, the input <b>should be</b> ignored. 00049 * This is because IMarkable specifies that state may only 00050 * be changed via the mark and unmark operations. 00051 */ 00052 IMarkable& operator=( const IMarkable& m ATTR_UNUSED ) 00053 { 00054 (void) m; 00055 return *this; 00056 } 00057 00058 /*! Destructor does noting */ 00059 virtual ~IMarkable() {} 00060 00061 /*! Mark this */ 00062 virtual void mark() const throw() = 0; 00063 00064 /*! Unmark this */ 00065 virtual void unmark() const throw() = 0; 00066 00067 /*! 00068 * Check if this is marked. 00069 * 00070 * @return true if this is marked 00071 */ 00072 virtual bool marked() const throw() = 0; 00073 00074 }; // class IMarkable 00075 00076 } // namespace wali 00077 00078 #endif // wali_IMARKABLE_GUARD 00079