A pointer class which behaves like native C++ pointers, but knows about the lifetime of the referenced objects.
More...
#include </home/werner/origo/vish/memcore/RefPtr.hpp>
List of all members.
Public Types
-
typedef Object object_t
- Exporting the type of the derived class.
-
typedef ObjectBase ObjectBase_t
- Exporting the type of the base class.
Protected Member Functions
Friends
Construction and Assignment
-
WeakPtr ()
- Default constructor, makes a NULL pointer.
-
WeakPtr (const NullPtr &)
- Explicitely construct NULL pointer.
-
WeakPtr (const ReferenceBase< ObjectBase > *Obj)
- Weak pointer from reference base of object.
-
WeakPtr (const ReferenceBase< ObjectBase > *Obj, const NotNullPtr &)
- Weak pointer from reference base of object which must not be null.
- template<class AnyObject > WeakPtr (const WeakPtr< AnyObject, ObjectBase > &Other)
- Weak pointer from pointer to another class.
-
WeakPtr (const WeakPtr &Other)
- Copy constructor.
- ~WeakPtr ()
- Default destructor, removes weak references to the object, the last one cleans up the referrer proxy object.
-
WeakPtr & assignWeak (const WeakPtr &other)
- Assign a weak pointer (explicit function call, same as assignment operator for weak pointers)
-
WeakPtr & operator= (const WeakPtr &other)
- Assignment operator (same as assignWeak() )
-
static const DynPtr
< ObjectBase, ObjectBase > & getBasePtr (const ReferenceBase< ObjectBase > *Obj)
Dereferencing operations
Detailed Description
A pointer class which behaves like native C++ pointers, but knows about the lifetime of the referenced objects.
Weak pointers become magically null if the referred object is destroyed from elsewhere.
- Note:
- Referenced objects must be derived from the ReferenceBase class template.
Via the RefPtrTypeTrait class a weak pointer may optionally be configured to return a reference to another class than the pointer object itself. This is useful to hide some complexity for the end-user.
- Examples:
-
Gear.cpp.
Constructor & Destructor Documentation
template<class AnyObject >
MemCore::WeakPtr::WeakPtr |
( |
const WeakPtr< AnyObject, ObjectBase > & |
Other | ) |
[inline] |
Weak pointer from pointer to another class.
The other class pointer must point to the same base class, such that dynamic_cast<>'s are possible.
MemCore::WeakPtr::~WeakPtr |
( |
| ) |
[inline] |
Default destructor, removes weak references to the object, the last one cleans up the referrer proxy object.
Calls wunref();
The documentation for this class was generated from the following file: