From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/classNLMISC_1_1CRefPtr.html | 626 +++++++++++++++++++++++++++ 1 file changed, 626 insertions(+) create mode 100644 docs/doxygen/nel/classNLMISC_1_1CRefPtr.html (limited to 'docs/doxygen/nel/classNLMISC_1_1CRefPtr.html') diff --git a/docs/doxygen/nel/classNLMISC_1_1CRefPtr.html b/docs/doxygen/nel/classNLMISC_1_1CRefPtr.html new file mode 100644 index 00000000..5da4465b --- /dev/null +++ b/docs/doxygen/nel/classNLMISC_1_1CRefPtr.html @@ -0,0 +1,626 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

NLMISC::CRefPtr Class Template Reference

CRefPtr: an handle on a ptr. +More... +

+#include <smart_ptr.h> +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Methods

 CRefPtr ()
 Init a NULL Ptr. More...

 CRefPtr (T *v)
 Attach a ptr to a RefPtr. More...

 CRefPtr (const CRefPtr &copy)
 Copy constructor. More...

 ~CRefPtr (void)
 Release the RefPtr. More...

 operator T * () const
 Cast operator. Check if the object has been deleted somewhere, and return NULL if this is the case. More...

T & operator * (void) const
 Indirection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. More...

T * operator-> (void) const
 Selection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. More...

CRefPtr & operator= (T *v)
 operator=. Giving a NULL pointer is a valid operation. More...

CRefPtr & operator= (const CRefPtr &copy)
 operator=. Giving a NULL pointer is a valid operation. More...

void kill ()
 kill/delete the object pointed by the pointer, and inform the other RefPtr of this. More...


Private Methods

void unRef () const

Private Attributes

CRefCount::CPtrInfopinfo
T * Ptr
+


Detailed Description

+

template<class T>
+ class NLMISC::CRefPtr< T >

+ +CRefPtr: an handle on a ptr. +

+T Must derive from CRefCount. If you use CRefPtr, you can kill the object simply by calling delete (T*)RefPtr, or the kill() method. All other CRefPtr which point to it can know if it has been deleted. (but you must be sure that this ptr is not handle by a SmartPtr, of course...) +

+SmartPtr are compatible with RefPtr. A ptr may be link to a CRefPtr and a CSmartPtr. As example, when the CSmartPtr will destroy him, CRefPtr will be informed... Sample:

        void    foo()
+        {
+                A                               *p;
+                CSmartPtr<A>    sp;
+                CRefPtr<A>              rp;
+
+                p= new A;
+                sp= p;          // OK. p is now owned by sp and will be deleted by sp.
+                rp= p;          // OK. rp handle p.
+                sp= NULL;       // Destruction. p deleted. rp automatically informed.
+                if(rp==NULL)
+                        thisIsGood();   // rp==NULL.
+        }
+
+

+PERFORMANCE WARNING! operator=() are about 10 times slower than normal pointers. So use them wisely. For local use, prefer cast the refptr to a normal Ptr. Also, an object used with a CRefPtr will allocate a small PtrInfo (one only per object, not per ptr).

+See also:
+CSmartPtr
+

+ +

+Definition at line 244 of file smart_ptr.h.


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + +
+template<class T>
NLMISC::CRefPtr< T >::CRefPtr   [inline]
+
+ + + + + +
+   + + +

+Init a NULL Ptr. +

+ +

+Definition at line 150 of file smart_ptr_inline.h. +

+References pinfo, Ptr, and REF_TRACE.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
NLMISC::CRefPtr< T >::CRefPtr T *   v [inline]
+
+ + + + + +
+   + + +

+Attach a ptr to a RefPtr. +

+ +

+Definition at line 157 of file smart_ptr_inline.h. +

+References pinfo, Ptr, REF_TRACE, and v.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
NLMISC::CRefPtr< T >::CRefPtr const CRefPtr< T > &   copy [inline]
+
+ + + + + +
+   + + +

+Copy constructor. +

+ +

+Definition at line 174 of file smart_ptr_inline.h. +

+References pinfo, Ptr, and REF_TRACE.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
NLMISC::CRefPtr< T >::~CRefPtr void   [inline]
+
+ + + + + +
+   + + +

+Release the RefPtr. +

+ +

+Definition at line 182 of file smart_ptr_inline.h. +

+References pinfo, Ptr, REF_TRACE, and unRef.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + +
+template<class T>
void NLMISC::CRefPtr< T >::kill  
+
+ + + + + +
+   + + +

+kill/delete the object pointed by the pointer, and inform the other RefPtr of this. +

+"rp.kill()" and "delete (T*)rp" do the same thing, except that rp NULLity is updated with kill(). RefPtr which point to the same object could know if the object is valid, by just testing it ( by an implicit call to the cast operator to T*). But any calls to operator->() or operator *() will have unpredictible effects (may crash... :) ). +

+Definition at line 238 of file smart_ptr_inline.h. +

+References pinfo, Ptr, REF_TRACE, and unRef.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
T & NLMISC::CRefPtr< T >::operator * void   const [inline]
+
+ + + + + +
+   + + +

+Indirection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. +

+ +

+Definition at line 269 of file smart_ptr_inline.h. +

+References REF_TRACE.

+

+ + + + +
+ + + + + + + + + + + + +
+template<class T>
NLMISC::CRefPtr< T >::operator T *   const [inline]
+
+ + + + + +
+   + + +

+Cast operator. Check if the object has been deleted somewhere, and return NULL if this is the case. +

+ +

+Definition at line 257 of file smart_ptr_inline.h. +

+References pinfo, Ptr, and REF_TRACE.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
T * NLMISC::CRefPtr< T >::operator-> void   const [inline]
+
+ + + + + +
+   + + +

+Selection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. +

+ +

+Definition at line 274 of file smart_ptr_inline.h. +

+References Ptr, and REF_TRACE.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
CRefPtr< T > & NLMISC::CRefPtr< T >::operator= const CRefPtr< T > &   copy
+
+ + + + + +
+   + + +

+operator=. Giving a NULL pointer is a valid operation. +

+ +

+Definition at line 220 of file smart_ptr_inline.h. +

+References pinfo, Ptr, REF_TRACE, and unRef.

+

+ + + + +
+ + + + + + + + + + + + + +
+template<class T>
CRefPtr< T > & NLMISC::CRefPtr< T >::operator= T *   v
+
+ + + + + +
+   + + +

+operator=. Giving a NULL pointer is a valid operation. +

+ +

+Definition at line 193 of file smart_ptr_inline.h. +

+References pinfo, Ptr, REF_TRACE, unRef, and v.

+

+ + + + +
+ + + + + + + + + + + + +
+template<class T>
SMART_INLINE void NLMISC::CRefPtr< T >::unRef   const [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 118 of file smart_ptr_inline.h. +

+References pinfo, and SMART_INLINE. +

+Referenced by kill, operator=, and ~CRefPtr.

+


Member Data Documentation

+

+ + + + +
+ + + + + +
+template<class T>
CRefCount::CPtrInfo* NLMISC::CRefPtr::pinfo [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 247 of file smart_ptr.h. +

+Referenced by CRefPtr, kill, operator T *, operator=, unRef, and ~CRefPtr.

+

+ + + + +
+ + + + + +
+template<class T>
T* NLMISC::CRefPtr::Ptr [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 248 of file smart_ptr.h. +

+Referenced by CRefPtr, kill, operator T *, operator->, operator=, and ~CRefPtr.

+


The documentation for this class was generated from the following files: + + + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1