]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/fl/garbagec.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas (@Lithuania)
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __GARBAGEC_G__
13 #define __GARBAGEC_G__
16 #pragma interface "garbagec.h"
24 wxList mRefs
; // references to other nodes
27 inline void* gc_node_to_obj( wxNode
* pGCNode
)
29 return ( (GCItem
*) (pGCNode
->Data()) )->mpObj
;
32 // class implements extremely slow, but probably one of the most simple GC algorithms
34 class GarbageCollector
41 wxNode
* FindItemNode( void* pForObj
);
42 void ResolveReferences();
44 wxNode
* FindReferenceFreeItemNode();
45 void RemoveReferencesToNode( wxNode
* pItemNode
);
46 void DestroyItemList( wxList
& lst
);
52 virtual ~GarbageCollector();
54 // prepare data for GC alg.
56 virtual void AddObject( void* pObj
, int refCnt
= 1 );
57 virtual void AddDependency( void* pObj
, void* pDependsOnObj
);
61 virtual void ArrangeCollection();
63 // access results of the alg.
65 wxList
& GetRegularObjects();
66 wxList
& GetCycledObjects();
68 // removes all data from GC
73 #endif /* __GARBAGEC_G__ */