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

A list of objects that is managed by some source based on user-expressed interests. More...

#include <object_list.h>

Inheritance diagram for sen::ObjectList< T >:

Classes

struct  Iterators

Public Types

enum class  SearchMode { includeSubClasses , ignoreSubClasses }
 How to search for objects. More...
using TypedObjectList = std::list<T*>
using UntypedObjectList = std::list<std::shared_ptr<Object>>
using Callback = std::function<void(const Iterators& iterators)>

Public Member Functions

 ObjectList (std::size_t sizeHint=defaultListSizeHint)
 The sizeHint reserves space the internal containers to prevent memory reallocation in the initial iterations. Passes the remaining arguments to the imp::Subscriber constructor.
 ObjectList (ObjectProvider &provider, std::size_t sizeHint)
 Automatically adds itself as a listener to the provider.
 ~ObjectList () override=default
Callback onAdded (Callback &&function) noexcept
 Installs a function to be called when objects are added / discovered. This function will be called during drainInputs(). Replaces any previously-installed function.
Callback onRemoved (Callback &&function) noexcept
 Installs a function to be called when objects are added / discovered. This function will be called during drainInputs(). Replaces any previously-installed function.
const std::list< T * > & getObjects () const noexcept
 Gets the list of currently-registered objects.
const std::list< std::shared_ptr< Object > > & getUntypedObjects () const noexcept
 Gets the list of currently-registered objects.
virtual kernel::impl::RemoteParticipant * isRemoteParticipant () noexcept
virtual kernel::impl::LocalParticipant * isLocalParticipant () noexcept

Static Public Attributes

static constexpr std::size_t defaultListSizeHint = 10U

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::ObjectList< T >

A list of objects that is managed by some source based on user-expressed interests.


Class Documentation

◆ sen::ObjectList::Iterators

struct sen::ObjectList::Iterators
template<typename T>
struct sen::ObjectList< T >::Iterators
Class Members
iterator typedBegin
iterator typedEnd
iterator untypedBegin
iterator untypedEnd

Member Typedef Documentation

◆ TypedObjectList

template<typename T>
using sen::ObjectList< T >::TypedObjectList = std::list<T*>

◆ UntypedObjectList

template<typename T>
using sen::ObjectList< T >::UntypedObjectList = std::list<std::shared_ptr<Object>>

◆ Callback

template<typename T>
using sen::ObjectList< T >::Callback = std::function<void(const Iterators& iterators)>

Member Enumeration Documentation

◆ SearchMode

template<typename T>
enum class sen::ObjectList::SearchMode
strong

How to search for objects.

Enumerator
includeSubClasses 
ignoreSubClasses 

Constructor & Destructor Documentation

◆ ObjectList() [1/2]

template<typename T>
sen::ObjectList< T >::ObjectList ( std::size_t sizeHint = defaultListSizeHint)
inlineexplicit

The sizeHint reserves space the internal containers to prevent memory reallocation in the initial iterations. Passes the remaining arguments to the imp::Subscriber constructor.

◆ ObjectList() [2/2]

template<typename T>
sen::ObjectList< T >::ObjectList ( ObjectProvider & provider,
std::size_t sizeHint )
inline

Automatically adds itself as a listener to the provider.

◆ ~ObjectList()

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

Member Function Documentation

◆ onAdded()

template<typename T>
ObjectList< T >::Callback sen::ObjectList< T >::onAdded ( Callback && function)
inlinenodiscardnoexcept

Installs a function to be called when objects are added / discovered. This function will be called during drainInputs(). Replaces any previously-installed function.

◆ onRemoved()

template<typename T>
Callback sen::ObjectList< T >::onRemoved ( Callback && function)
inlinenodiscardnoexcept

Installs a function to be called when objects are added / discovered. This function will be called during drainInputs(). Replaces any previously-installed function.

◆ getObjects()

template<typename T>
const std::list< T * > & sen::ObjectList< T >::getObjects ( ) const
inlinenodiscardnoexcept

Gets the list of currently-registered objects.

◆ getUntypedObjects()

template<typename T>
const std::list< std::shared_ptr< Object > > & sen::ObjectList< T >::getUntypedObjects ( ) const
inlinenodiscardnoexcept

Gets the list of currently-registered objects.

◆ onObjectsAdded()

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

Called when objects are been added to a source.

Implements sen::ObjectProviderListener.

◆ onObjectsRemoved()

template<typename T>
void sen::ObjectList< 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

Member Data Documentation

◆ defaultListSizeHint

template<typename T>
std::size_t sen::ObjectList< T >::defaultListSizeHint = 10U
staticconstexpr

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