The Vish Visualization Shell 0.3
Vish
Public Types | Protected Member Functions | Friends | List of all members
MemCore::WeakPtr< Object, ObjectBase > Class Template Reference

A pointer class which behaves like native C++ pointers, but knows about the lifetime of the referenced objects. More...

#include <elementary/memcore/RefPtr.hpp>

Inheritance diagram for MemCore::WeakPtr< Object, ObjectBase >:
MemCore::DynPtr< Object, ObjectBase > MemCore::SelfPtr< Data > MemCore::SelfPtr< A > MemCore::SelfPtr< Base > MemCore::SelfPtr< DependentObject > MemCore::SelfPtr< KDTree< N, T > > MemCore::SelfPtr< MultiRange< T > > MemCore::SelfPtr< Node > MemCore::SelfPtr< OcTree< T > > MemCore::SelfPtr< QuadTree< T > > MemCore::SelfPtr< Int > MemCore::SelfPtr< CacheBase > MemCore::SelfPtr< CacheMap > MemCore::SelfPtr< Cacheable > MemCore::SelfPtr< ChunkBase > MemCore::SelfPtr< CrashHandler > MemCore::SelfPtr< Creature > MemCore::SelfPtr< InterfaceBase > MemCore::SelfPtr< InterfaceIterationParameter > MemCore::SelfPtr< ReferenceCounted > MemCore::SelfPtr< Lexicon > MemCore::SelfPtr< LoaderBase > MemCore::SelfPtr< LoaderParameters > MemCore::SelfPtr< LoaderRequest > MemCore::SelfPtr< Notifier > MemCore::SelfPtr< Provenance > MemCore::SelfPtr< Result > MemCore::SelfPtr< Cluster > MemCore::SelfPtr< SaveInterfaceCreatorBase > MemCore::SelfPtr< StringList > MemCore::SelfPtr< VerboseCatcher > MemCore::SelfPtr< Tentacle > MemCore::SelfPtr< ApplicationQuitter > MemCore::SelfPtr< Colormap > MemCore::SelfPtr< DeferredRenderer > MemCore::SelfPtr< Expectation > MemCore::SelfPtr< Framebuffer > MemCore::SelfPtr< GLContextChecker > MemCore::SelfPtr< GLFontManager > MemCore::SelfPtr< ImageTileProcessor > MemCore::SelfPtr< Interactor > MemCore::SelfPtr< MultipleStringSelection > MemCore::SelfPtr< NamedRenderExceptions > MemCore::SelfPtr< PickList > MemCore::SelfPtr< PixelBuffer > MemCore::SelfPtr< Updater > MemCore::SelfPtr< LightSource > MemCore::SelfPtr< MaxRequestExecutor > MemCore::SelfPtr< Seagrass > MemCore::SelfPtr< Shader > MemCore::SelfPtr< ShaderInjectorBase > MemCore::SelfPtr< Task > MemCore::SelfPtr< Functor > MemCore::SelfPtr< TypeSpecificGLCacheFactory > MemCore::SelfPtr< TypedSlotCreator > MemCore::SelfPtr< VAcceptInfo > MemCore::SelfPtr< VAcceptList > MemCore::SelfPtr< VAction > MemCore::SelfPtr< VActionNotifier > MemCore::SelfPtr< Renderer > MemCore::SelfPtr< VCameraSet > MemCore::SelfPtr< VConnectionValidator > MemCore::SelfPtr< Addendum > MemCore::SelfPtr< VCreatorMap > MemCore::SelfPtr< Grab > MemCore::SelfPtr< MovieManager > MemCore::SelfPtr< OutputFormat > MemCore::SelfPtr< InteractionGrabber > MemCore::SelfPtr< VLogger > MemCore::SelfPtr< VManagedObjectBase > MemCore::SelfPtr< VModule > MemCore::SelfPtr< VOperatorCache< OperatorData > > MemCore::SelfPtr< VParameterConnectionConstraint > MemCore::SelfPtr< Font > MemCore::SelfPtr< ModelViewMatrixState > MemCore::SelfPtr< VRenderInterruptor > MemCore::SelfPtr< VRenderPrecision > MemCore::SelfPtr< ID > MemCore::SelfPtr< VScriptFunctor > MemCore::SelfPtr< VScriptParameters > MemCore::SelfPtr< VScriptTypedValue > MemCore::SelfPtr< VScriptValue > MemCore::SelfPtr< VSlot > MemCore::SelfPtr< Connector > MemCore::SelfPtr< Receiver > MemCore::SelfPtr< State > MemCore::SelfPtr< VTaskMessage > MemCore::SelfPtr< VUndoAction > MemCore::SelfPtr< VUrlSystemHandler > MemCore::SelfPtr< SocketReceivers_t > MemCore::SelfPtr< VValueBase > MemCore::SelfPtr< VValueCreator > MemCore::SelfPtr< ValueNotifier > MemCore::SelfPtr< ValueNotifierList > MemCore::SelfPtr< ValuePool > MemCore::SelfPtr< ValuePoolCreator > MemCore::SelfPtr< ValuePoolProvider > MemCore::SelfPtr< ValueSet > MemCore::SelfPtr< FrameCompletion > MemCore::SelfPtr< FrameGrabber > MemCore::SelfPtr< VishSaver > MemCore::SelfPtr< CreatorBase > MemCore::SelfPtr< XBase > MemCore::SelfPtr< Object > MemCore::StrongPtr< Object > MemCore::StrongPtr< Object, StrongPtr< Object >::ObjectBase_t > MemCore::StrongPtr< RefCountable, StrongPtr< RefCountable >::ObjectBase_t > MemCore::StrongPtr< Value > MemCore::StrongPtr< ::Data > MemCore::StrongPtr< Anemone > MemCore::StrongPtr< Wizt::VCreationPreferences > MemCore::StrongPtr< VValueBase > MemCore::StrongPtr< StatusNotifier > MemCore::StrongPtr< LeftNode_t > MemCore::StrongPtr< RightNode_t > MemCore::StrongPtr< Eagle::TypedNode > MemCore::StrongPtr< Eagle::KDTree< N, T > > MemCore::StrongPtr< Eagle::Node > MemCore::StrongPtr< Node > MemCore::StrongPtr< Left_t > MemCore::StrongPtr< Middle_t > MemCore::StrongPtr< Right_t > MemCore::StrongPtr< Source_t > MemCore::StrongPtr< MemCore::Chunk< uint32_t > > MemCore::StrongPtr< MemCore::Chunk< uint64_t > > MemCore::StrongPtr< MemCore::Chunk< Eagle::Vec3Packed > > MemCore::StrongPtr< Eagle::BoundingBall > MemCore::StrongPtr< GetInput::GetData > MemCore::StrongPtr< MemCore::ChunkBase > MemCore::StrongPtr< MemCore::Cacheable > MemCore::StrongPtr< MemCore::CacheQueue > MemCore::StrongPtr< RefType > MemCore::StrongPtr< MemCore::Provenance > MemCore::StrongPtr< MemCore::Cache > MemCore::StrongPtr< MemCore::Lexicon, MemCore::Lexicon > MemCore::StrongPtr< X > MemCore::StrongPtr< MemCore::Provenance, MemCore::Provenance > MemCore::StrongPtr< Result, Result > MemCore::StrongPtr< MyPreciousDataClass > MemCore::StrongPtr< Wizt::VObject > MemCore::StrongPtr< Wizt::VAcceptList > MemCore::StrongPtr< Tentacle > MemCore::StrongPtr< Wizt::AnemoneCreatorBase > MemCore::StrongPtr< Wizt::AnemoneCreator<> > MemCore::StrongPtr< Wizt::Interactor > MemCore::StrongPtr< Wizt::AnemoneBasicCreator > MemCore::StrongPtr< MemCore::TypedChunk< Eagle::PhysicalSpace::point > > MemCore::StrongPtr< Wizt::ScriptletCreator > MemCore::StrongPtr< Wizt::Framebuffer > MemCore::StrongPtr< Wizt::DisplayList > MemCore::StrongPtr< Wizt::VRenderPrecision > MemCore::StrongPtr< Wizt::DisplayListCreator > MemCore::StrongPtr< Wizt::VertexShader > MemCore::StrongPtr< Wizt::GeometryShader > MemCore::StrongPtr< Wizt::FragmentShader > MemCore::StrongPtr< Wizt::ComputeShader > MemCore::StrongPtr< GetBody > MemCore::StrongPtr< Wizt::GlossyTexture > MemCore::StrongPtr< Wizt::HTTPServer::AcceptConnections > MemCore::StrongPtr< Wizt::VRenderContext::Font > MemCore::StrongPtr< Wizt::GLMultisampleTexture2D > MemCore::StrongPtr< Wizt::ValuePoolProvider > MemCore::StrongPtr< Wizt::GLTextureTentacle > MemCore::StrongPtr< MemCore::Chunk< Eagle::DomainVector > > MemCore::StrongPtr< Wizt::RenderBasin::Painter > MemCore::StrongPtr< Wizt::RemoteViewer::AcceptConnections > MemCore::StrongPtr< RemoteLens > MemCore::StrongPtr< MemCore::Chunk< float > > MemCore::StrongPtr< Wizt::RemoteVish::MyActionNotifier > MemCore::StrongPtr< Wizt::RemoteVish::AcceptConnections > MemCore::StrongPtr< Wizt::RequestExecutor::MaxRequestExecutor > MemCore::StrongPtr< Wizt::PixelBuffer > MemCore::StrongPtr< Wizt::SSBOManager > MemCore::StrongPtr< Wizt::TextureBase > MemCore::StrongPtr< Wizt::TransformOperator::Functor > MemCore::StrongPtr< MemCore::InterfaceBase > MemCore::StrongPtr< Wizt::VAcceptInfo > MemCore::StrongPtr< Wizt::VBO::Renderer > MemCore::StrongPtr< Wizt::VBO > MemCore::StrongPtr< Wizt::ValuePool > MemCore::StrongPtr< Wizt::VContext::Addendum > MemCore::StrongPtr< Wizt::VValueParameter< Wizt::VThreadManager > > MemCore::StrongPtr< Wizt::VSlot > MemCore::StrongPtr< Wizt::VFrameBuffer::Renderer > MemCore::StrongPtr< Wizt::ImageTileProcessor > MemCore::StrongPtr< Wizt::GLCache > MemCore::StrongPtr< Framebuffer > MemCore::StrongPtr< MemCore::StringList > MemCore::StrongPtr< Wizt::VModule > MemCore::StrongPtr< Wizt::VInteractionEvent::InteractionGrabber > MemCore::StrongPtr< Wizt::ValueSet > MemCore::StrongPtr< Wizt::VValueBase > MemCore::StrongPtr< Wizt::ValueActionBase > MemCore::StrongPtr< Wizt::Task > MemCore::StrongPtr< Wizt::VRequest::ID > MemCore::StrongPtr< Wizt::VScalarFunctor::Functor > MemCore::StrongPtr< Wizt::VScriptParameters > MemCore::StrongPtr< VScriptValue > MemCore::StrongPtr< Wizt::VParameter > MemCore::StrongPtr< Wizt::ValueNotifier > MemCore::StrongPtr< Wizt::Expectation > MemCore::StrongPtr< Wizt::VStreamLogger::Logger > MemCore::StrongPtr< Wizt::VUrlSystemHandler, Wizt::VUrlSystemHandler > MemCore::StrongPtr< SocketReceivers_t > MemCore::StrongPtr< Wizt::VUndoStack > MemCore::StrongPtr< Wizt::NamedRenderExceptions > MemCore::StrongPtr< Wizt::VRenderInterruptor > MemCore::StrongPtr< Wizt::VInputCreatorBase > MemCore::StrongPtr< Wizt::VCreatorBase > MemCore::StrongPtr< Wizt::VScriptValue > MemCore::StrongPtr< Eagle::TypedNode< Eagle::PhysicalSpace::bivector > > MemCore::StrongPtr< Eagle::TypedNode< Eagle::PhysicalSpace::rotor > > MemCore::StrongPtr< Object, ObjectBase >

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_toperator* () 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.
 
WeakPtrassignWeak (const WeakPtr &other)
 Assign a weak pointer (explicit function call, same as assignment operator for weak pointers)
 
WeakPtroperator= (const WeakPtr &other)
 Assignment operator (same as assignWeak() )
 

Additional Inherited Members

- Public Member Functions inherited from MemCore::DynPtr< Object, ObjectBase >
const DynPtrgetDynPtr () 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 DynPtrgetNullPtr () noexcept
 Associated static NullPtr - avoids creation of a temporary object when a reference is needed.
 

Detailed Description

template<class Object, class ObjectBase>
class MemCore::WeakPtr< Object, ObjectBase >

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
LocalCompoundInput.cpp.

Constructor & Destructor Documentation

◆ WeakPtr()

template<class Object , class ObjectBase >
template<class AnyObject >
MemCore::WeakPtr< Object, ObjectBase >::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.

◆ ~WeakPtr()

template<class Object , class ObjectBase >
MemCore::WeakPtr< Object, ObjectBase >::~WeakPtr ( )
inline

Default destructor, removes weak references to the object, the last one cleans up the referrer proxy object.

Calls wunref();