]>
git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/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__
20 wxList mRefs
; // references to other nodes
23 inline void* gc_node_to_obj( wxNode
* pGCNode
)
25 return ( (GCItem
*) (pGCNode
->Data()) )->mpObj
;
28 // class implements extreamly slow, but probably one of the most simple GC alogrithms
30 class GarbageCollector
37 wxNode
* FindItemNode( void* pForObj
);
38 void ResolveReferences();
40 wxNode
* FindRefernceFreeItemNode();
41 void RemoveReferencesToNode( wxNode
* pItemNode
);
42 void DestroyItemList( wxList
& lst
);
48 virtual ~GarbageCollector();
50 // prepare data for GC alg.
52 virtual void AddObject( void* pObj
, int refCnt
= 1 );
53 virtual void AddDependency( void* pObj
, void* pDepnedsOnObj
);
57 virtual void ArrangeCollection();
59 // acces results of the alg.
61 wxList
& GetRegularObjects();
62 wxList
& GetCycledObjects();
64 // removes all date form GC