Template Class WeakReference

Class Documentation

template<typename T>
class WeakReference

The WeakReference class enables you to maintain a weak reference to a DDS reference type.

The existence of a weak link will not prevent the garbage collection of the reference type.

Public Types

typedef T ReferenceType

Public Functions

WeakReference()

Creates a weak reference without an referenced dds object.

WeakReference(const T &t)

Creates a weak reference for the reference type passed as argument.

Template Parameters:

t – dds object the new weak reference will refer to

bool expired()

Checks whether the underlying reference has been deleted.

Returns:

true if the underlying reference has expired, false otherwise

T lock()

Gives access to the underlying shared reference.

If the reference has expired the returned object will be referencing ‘dds::core::null’.

Returns:

referenced dds object