00001 /* 00002 FALCON - The Falcon Programming Language. 00003 FILE: garbageable.h 00004 00005 Garbageable interface definition 00006 ------------------------------------------------------------------- 00007 Author: Giancarlo Niccolai 00008 Begin: ven dic 3 2004 00009 00010 ------------------------------------------------------------------- 00011 (C) Copyright 2004: the FALCON developers (see list in AUTHORS file) 00012 00013 See LICENSE file for licensing details. 00014 */ 00015 00024 #ifndef flc_garbageable_H 00025 #define flc_garbageable_H 00026 00027 #include <falcon/setup.h> 00028 #include <falcon/types.h> 00029 #include <falcon/gcalloc.h> 00030 00031 namespace Falcon { 00032 00033 class FALCON_DYN_CLASS GarbageableBase: public GCAlloc 00034 { 00035 protected: 00036 GarbageableBase *m_garbage_next; 00037 GarbageableBase *m_garbage_prev; 00038 mutable uint32 m_gcStatus; 00039 00040 public: 00041 GarbageableBase() {} 00042 00045 GarbageableBase( const GarbageableBase &other ); 00046 00047 virtual ~GarbageableBase(); 00048 00057 virtual bool finalize(); 00058 00065 virtual uint32 occupation(); 00066 00067 void mark( uint32 gen ) const { 00068 m_gcStatus = gen; 00069 } 00070 00072 uint32 mark() const { 00073 return m_gcStatus; 00074 } 00075 00076 GarbageableBase *nextGarbage() const { return m_garbage_next; } 00077 GarbageableBase *prevGarbage() const { return m_garbage_prev; } 00078 void nextGarbage( GarbageableBase *next ) { m_garbage_next = next; } 00079 void prevGarbage( GarbageableBase *prev ) { m_garbage_prev = prev; } 00080 }; 00081 00082 00083 class FALCON_DYN_CLASS Garbageable: public GarbageableBase 00084 { 00085 public: 00086 Garbageable(); 00087 00090 Garbageable( const Garbageable &other ); 00091 00092 virtual ~Garbageable(); 00093 00100 virtual void gcMark( uint32 mk ); 00101 }; 00102 00103 } 00104 00105 #endif 00106 00107 /* end of garbageable.h */