Files
wxWidgets/contrib/include/wx/fl/garbagec.h
Julian Smart 9a713b1149 Applied patch [ 623736 ] Build and use FL as DLL
This patch allows FL to be build as a DLL with the VC
project files, I was only able to at chief it with the VC
projects because the make file for building libs doesn't
have any rule to build DLLs (at least I didn't see how to
do it).

However the FL demo applications can be build using FL
in DLL form with MSVC project files and VC make files
(as mentioned before the FL DLL it self can only be build
using VC projects).

This patch includes 2 files; 1 to change current FL files
to work in DLL form and 1 extra include file that needs to
be added in the FL include directory.

Small note: if you want to use FL as a DLL you need to
use wxWin as a DLL.

Thanks,
Hans.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2002-10-24 11:21:47 +00:00

94 lines
2.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: garbagec.h
// Purpose: GarbageCollector class.
// Author: Aleksandras Gluchovas (@Lithuania)
// Modified by:
// Created: ??/10/98
// RCS-ID: $Id$
// Copyright: (c) Aleksandras Gluchovas
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GARBAGEC_G__
#define __GARBAGEC_G__
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "garbagec.h"
#endif
#include "wx/list.h"
#include "wx/fl/fldefs.h"
struct GCItem
{
void* mpObj;
wxList mRefs; // references to other nodes
};
inline void* gc_node_to_obj( wxNode* pGCNode )
{
return ( (GCItem*) (pGCNode->Data()) )->mpObj;
}
/*
This class implements an extremely slow but simple garbage collection algorithm.
*/
class WXFL_DECLSPEC GarbageCollector
{
protected:
wxList mAllNodes;
wxList mRegularLst;
wxList mCycledLst;
// Internal method for finding a node.
wxNode* FindItemNode( void* pForObj );
// Internal method for resolving references.
void ResolveReferences();
// Internal method for findind and freeing a node.
wxNode* FindReferenceFreeItemNode();
// Remove references to this node.
void RemoveReferencesToNode( wxNode* pItemNode );
// Destroys a list of items.
void DestroyItemList( wxList& lst );
public:
// Default constructor.
GarbageCollector() {}
// Destructor.
virtual ~GarbageCollector();
// Prepare data for garbage collection.
virtual void AddObject( void* pObj, int refCnt = 1 );
// Prepare data for garbage collection.
virtual void AddDependency( void* pObj, void* pDependsOnObj );
// Executes garbage collection algorithm.
virtual void ArrangeCollection();
// Accesses the results of the algorithm.
wxList& GetRegularObjects();
// Get cycled objects.
wxList& GetCycledObjects();
// Removes all data from the garbage collector.
void Reset();
};
#endif /* __GARBAGEC_G__ */