From 0e497a9db63c011d6a444f61291b670c382cd69b Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 12 Jun 2009 20:29:59 +0000 Subject: [PATCH] Update docs to mention wxRefCounter class git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/overviews/refcount.h | 9 ++++---- interface/wx/object.h | 36 ++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/docs/doxygen/overviews/refcount.h b/docs/doxygen/overviews/refcount.h index 75454a80c3..d8525b710d 100644 --- a/docs/doxygen/overviews/refcount.h +++ b/docs/doxygen/overviews/refcount.h @@ -99,11 +99,12 @@ will result in an assert failure in debug builds. @section overview_refcount_object Making Your Own Reference Counted Class -Reference counting can be implemented easily using wxObject and wxObjectRefData -classes. Alternatively, you can also use the wxObjectDataPtr template. +Reference counting can be implemented easily using wxObject or using +the intermediate wxRefCounter class directly. +Alternatively, you can also use the wxObjectDataPtr template. -First, derive a new class from wxObjectRefData and put there the -memory-consuming data. +First, derive a new class from wxRefCounter (or wxObjectRefData when +using a wxObject derived class) and put the memory-consuming data in it. Then derive a new class from wxObject and implement there the public interface which will be seen by the user of your class. You'll probably want to add a diff --git a/interface/wx/object.h b/interface/wx/object.h index 72efca8132..43beb09c31 100644 --- a/interface/wx/object.h +++ b/interface/wx/object.h @@ -1,15 +1,14 @@ ///////////////////////////////////////////////////////////////////////////// // Name: object.h -// Purpose: interface of wxObjectRefData +// Purpose: interface of wxRefCounter // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -/** - @class wxObjectRefData +/** @class wxObjectRefData - This class is used to store reference-counted data. + This class is just a typedef to wxRefCounter and is used by wxObject. Derive classes from this to store your own data. When retrieving information from a wxObject's reference data, you will need to cast to your own derived class. @@ -131,32 +130,45 @@ } @endcode - + @library{wxbase} @category{rtti} @see wxObject, wxObjectDataPtr, @ref overview_refcount */ -class wxObjectRefData +typedef wxRefCounter wxObjectRefData; + + +/** + @class wxRefCounter + + This class is used to manage reference-counting. + + @library{wxbase} + @category{rtti} + + @see wxObject, wxObjectRefData, wxObjectDataPtr, @ref overview_refcount +*/ +class wxRefCounter { protected: /** Destructor. - It's declared @c protected so that wxObjectRefData instances + It's declared @c protected so that wxRefCounter instances will never be destroyed directly but only as result of a DecRef() call. */ - virtual ~wxObjectRefData(); + virtual ~wxRefCounter(); public: /** Default constructor. Initialises the internal reference count to 1. */ - wxObjectRefData(); + wxRefCounter(); /** Decrements the reference count associated with this shared data and, if - it reaches zero, destroys this instance of wxObjectRefData releasing its + it reaches zero, destroys this instance of wxRefCounter releasing its memory. Please note that after calling this function, the caller should @@ -198,14 +210,14 @@ public: wxObject can be used to implement @ref overview_refcount "reference counted" objects, such as wxPen, wxBitmap and others (see @ref overview_refcount_list "this list"). - See wxObjectRefData and @ref overview_refcount for more info about + See wxRefCounter and @ref overview_refcount for more info about reference counting. @library{wxbase} @category{rtti} @see wxClassInfo, @ref overview_debugging, @ref overview_refcount, - wxObjectRefData, wxObjectDataPtr + wxObjectDataRef, wxObjectDataPtr */ class wxObject { -- 2.47.2