Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::ObjectRef< T > Class Template Referencefinal

Object references may or may not hold an object instance. Their value is set by a provider based on some defined interest which was given during construction. More...

#include <object_ref.h>

Inheritance diagram for sen::ObjectRef< T >:

Public Types

using Callback = std::function<void()>

Public Member Functions

 ObjectRef ()=default
 ~ObjectRef () override=default
bool valid () const noexcept
 True if the reference holds a valid pointer to an instance.
 operator bool () const noexcept
 True if the reference holds a valid pointer to an instance.
T * operator-> () noexcept
 Access the internal instance.
const T * operator-> () const noexcept
 Access the internal instance.
T & get () noexcept
 Access the internal instance.
const T & get () const noexcept
 Access the internal instance.
Callback onAdded (Callback &&function) noexcept
 Installs a function to be called when objects are added / discovered. Replaces any previously-installed function.
Callback onRemoved (Callback &&function) noexcept
 Installs a function to be called when objects are added / discovered. Replaces any previously-installed function.
virtual kernel::impl::RemoteParticipant * isRemoteParticipant () noexcept
virtual kernel::impl::LocalParticipant * isLocalParticipant () noexcept

Protected Member Functions

void onObjectsAdded (const ObjectAdditionList &additions) override
 Called when objects are been added to a source.
void onObjectsRemoved (const ObjectRemovalList &removals) override
 Called when objects will be removed from a source.

Detailed Description

template<typename T>
class sen::ObjectRef< T >

Object references may or may not hold an object instance. Their value is set by a provider based on some defined interest which was given during construction.

Methods of this class are thread-safe.

Member Typedef Documentation

◆ Callback

template<typename T>
using sen::ObjectRef< T >::Callback = std::function<void()>

Constructor & Destructor Documentation

◆ ObjectRef()

template<typename T>
sen::ObjectRef< T >::ObjectRef ( )
default

◆ ~ObjectRef()

template<typename T>
sen::ObjectRef< T >::~ObjectRef ( )
overridedefault

Member Function Documentation

◆ valid()

template<typename T>
bool sen::ObjectRef< T >::valid ( ) const
inlinenodiscardnoexcept

True if the reference holds a valid pointer to an instance.

◆ operator bool()

template<typename T>
sen::ObjectRef< T >::operator bool ( ) const
inlinenodiscardnoexcept

True if the reference holds a valid pointer to an instance.

◆ operator->() [1/2]

template<typename T>
T * sen::ObjectRef< T >::operator-> ( )
inlinenodiscardnoexcept

Access the internal instance.

◆ operator->() [2/2]

template<typename T>
const T * sen::ObjectRef< T >::operator-> ( ) const
inlinenodiscardnoexcept

Access the internal instance.

◆ get() [1/2]

template<typename T>
T & sen::ObjectRef< T >::get ( )
inlinenodiscardnoexcept

Access the internal instance.

◆ get() [2/2]

template<typename T>
const T & sen::ObjectRef< T >::get ( ) const
inlinenodiscardnoexcept

Access the internal instance.

◆ onAdded()

template<typename T>
Callback sen::ObjectRef< T >::onAdded ( Callback && function)
inlinenoexcept

Installs a function to be called when objects are added / discovered. Replaces any previously-installed function.

◆ onRemoved()

template<typename T>
Callback sen::ObjectRef< T >::onRemoved ( Callback && function)
inlinenoexcept

Installs a function to be called when objects are added / discovered. Replaces any previously-installed function.

◆ onObjectsAdded()

template<typename T>
void sen::ObjectRef< T >::onObjectsAdded ( const ObjectAdditionList & additions)
inlineoverrideprotectedvirtual

Called when objects are been added to a source.

Implements sen::ObjectProviderListener.

◆ onObjectsRemoved()

template<typename T>
void sen::ObjectRef< T >::onObjectsRemoved ( const ObjectRemovalList & removals)
inlineoverrideprotectedvirtual

Called when objects will be removed from a source.

Implements sen::ObjectProviderListener.

◆ isRemoteParticipant()

virtual kernel::impl::RemoteParticipant * sen::ObjectProviderListener::isRemoteParticipant ( )
nodiscardvirtualnoexceptinherited

◆ isLocalParticipant()

virtual kernel::impl::LocalParticipant * sen::ObjectProviderListener::isLocalParticipant ( )
nodiscardvirtualnoexceptinherited

The documentation for this class was generated from the following file: