|
The Vish Visualization Shell 0.3
Vish
|
A pointer class which behaves like native C++ pointers, but knows about the lifetime of the referenced objects. More...
#include <elementary/memcore/RefPtr.hpp>
Public Types | |
| typedef Object | object_t |
| Exporting the type of the derived class. | |
| typedef ObjectBase | ObjectBase_t |
| Exporting the type of the base class. | |
Public Types inherited from MemCore::DynPtr< Object, ObjectBase > | |
| typedef Object | object_t |
| Type of the associated object. | |
Protected Member Functions | |
| WeakPtr (Object *that, const SelfInitialize &) | |
| Internal constructor used when initializing an object with its own self-reference. | |
Protected Member Functions inherited from MemCore::DynPtr< Object, ObjectBase > | |
| template<class AnyObject > | |
| DynPtr (const DynPtr< AnyObject, ObjectBase > &Other) noexcept | |
| Implicit type conversion within the same class hierarchy Any pointer. | |
| DynPtr (const std::nullptr_t &) noexcept | |
| Assign from nullptr. | |
Friends | |
| class | ReferenceBase< ObjectBase > |
| The base class of associated reference counted objects. | |
Dereferencing operations | |
| typedef RefPtrTypeTrait< Object, ObjectBase >::ReferencePointerType | pointer_t |
| The result type of the pointer operator, may be changed with the RefPtrTypeTrait<> class. | |
| typedef RefPtrTypeTrait< Object, ObjectBase >::ReferenceValueType | refvalue_t |
| The result of the dereferencing operator, may be changed with the RefPtrTypeTrait<> class. | |
| pointer_t | getPtrValue () const |
| The pointer value, checked for null. | |
| pointer_t | operator-> () const |
| The pointer operator. | |
| refvalue_t & | operator* () const |
| The dereferencing *-operator. | |
| size_t | operator~ () const |
| Convenience operator to easily retrieve the object count ID of the referenced object, a unique number for each instance. | |
Construction and Assignment | |
| WeakPtr () | |
| Default constructor, makes a NULL pointer. | |
| WeakPtr (const std::nullptr_t &) | |
| 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() ) | |
Additional Inherited Members | |
Public Member Functions inherited from MemCore::DynPtr< Object, ObjectBase > | |
| const DynPtr & | getDynPtr () const noexcept |
| Convenience type cast to dynamic pointer class. | |
| const type_info & | getType () const noexcept |
| Return type info of associated object, typeid(NullPtr) or typeid(void) if none. | |
| bool | isAssignable (const DynPtr< ObjectBase, ObjectBase > &Other) const noexcept |
| Check whether a given pointer to a base class may be assigned to a pointer of the derived class. | |
| operator void * () const noexcept | |
| Check if the pointer is valid. | |
| bool | operator! () const noexcept |
| Check if the pointer is invalid. | |
| void | speak (const char *s, const char *prefix="") const noexcept |
| Print some debug messages to the console. | |
Static Public Member Functions inherited from MemCore::DynPtr< Object, ObjectBase > | |
| static const DynPtr & | getNullPtr () noexcept |
| Associated static NullPtr - avoids creation of a temporary object when a reference is needed. | |
Related Symbols inherited from MemCore::DynPtr< Object, ObjectBase > | |
| void | Speak (const char *s, const char *prefix="") const |
| Verbose information printing for this pointer. | |
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.
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.
|
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.
|
inline |
Default destructor, removes weak references to the object, the last one cleans up the referrer proxy object.
Calls wunref();