Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::ObjectSource Class Referenceabstract

Allows adding and receiving objects. More...

#include <object_source.h>

Inheritance diagram for sen::ObjectSource:

Public Types

using NativeObjectPtr = std::shared_ptr<NativeObject>

Public Member Functions

 ObjectSource (const ObjectOwnerId &id)
 ~ObjectSource () override=default
virtual bool add (const Span< NativeObjectPtr > &instances)=0
 Registers an object (including its type). It does nothing if the object is already registered. Returns false if one or more objects could not be added. This method is thread-safe.
bool add (NativeObjectPtr instance)
 Registers an object (including its type). It does nothing if the objects are already present. Returns false if the objects could not be added. This method is thread-safe.
template<typename T>
bool add (const std::vector< std::shared_ptr< T > > &instances)
 Convenience helper.
virtual void remove (const Span< NativeObjectPtr > &instances)=0
 Unregisters an object and notifies any registered listeners. Ignores objects that are not present. This method is thread-safe.
void remove (NativeObjectPtr instance)
 Unregisters an object. Does nothing if the object is not present. This method is thread-safe.
template<typename T>
void remove (const std::vector< std::shared_ptr< T > > &instances)
 Convenience helper.
void addSubscriber (std::shared_ptr< Interest > interest, ObjectProviderListener *listener, bool notifyAboutExisting) override
 Add a subscriber to the filter on a specific interest.
void removeSubscriber (std::shared_ptr< Interest > interest, ObjectProviderListener *listener, bool notifyAboutExisting) override
 Removes a previously-added subscriber on a specific interest.
void removeSubscriber (ObjectProviderListener *listener, bool notifyAboutExisting) override
std::shared_ptr< ObjectProvidergetOrCreateNamedProvider (const std::string &name, std::shared_ptr< Interest > interest)
 Creates a uniquely named provider for objects determined on a given interest. Returns any provider with the same name and interest.
void removeNamedProvider (std::string_view name)
 Deletes any provider with this name. Does nothing if none found.

Protected Member Functions

virtual void flushOutputs ()=0
virtual void drainInputs ()=0
void evaluate (const ObjectSet &objects)
const ObjectOwnerId & getOwnerId () const noexcept
virtual void subscriberAdded (std::shared_ptr< Interest > interest, ObjectProviderListener *listener, bool notifyAboutExisting)
virtual void subscriberRemoved (std::shared_ptr< Interest > interest, ObjectProviderListener *listener, bool notifyAboutExisting)
virtual void subscriberRemoved (ObjectProviderListener *listener, bool notifyAboutExisting)
virtual void objectsAdded (std::shared_ptr< Interest > interest, ObjectAdditionList additions)
virtual void objectsRemoved (std::shared_ptr< Interest > interest, ObjectRemovalList removals)

Friends

class kernel::impl::Runner

Detailed Description

Allows adding and receiving objects.

Member Typedef Documentation

◆ NativeObjectPtr

Constructor & Destructor Documentation

◆ ObjectSource()

sen::ObjectSource::ObjectSource ( const ObjectOwnerId & id)
inlineexplicit

◆ ~ObjectSource()

sen::ObjectSource::~ObjectSource ( )
overridedefault

Member Function Documentation

◆ add() [1/3]

virtual bool sen::ObjectSource::add ( const Span< NativeObjectPtr > & instances)
pure virtual

Registers an object (including its type). It does nothing if the object is already registered. Returns false if one or more objects could not be added. This method is thread-safe.

◆ add() [2/3]

bool sen::ObjectSource::add ( NativeObjectPtr instance)
inline

Registers an object (including its type). It does nothing if the objects are already present. Returns false if the objects could not be added. This method is thread-safe.

◆ add() [3/3]

template<typename T>
bool sen::ObjectSource::add ( const std::vector< std::shared_ptr< T > > & instances)
inline

Convenience helper.

◆ remove() [1/3]

virtual void sen::ObjectSource::remove ( const Span< NativeObjectPtr > & instances)
pure virtual

Unregisters an object and notifies any registered listeners. Ignores objects that are not present. This method is thread-safe.

◆ remove() [2/3]

void sen::ObjectSource::remove ( NativeObjectPtr instance)
inline

Unregisters an object. Does nothing if the object is not present. This method is thread-safe.

◆ remove() [3/3]

template<typename T>
void sen::ObjectSource::remove ( const std::vector< std::shared_ptr< T > > & instances)
inline

Convenience helper.

◆ flushOutputs()

virtual void sen::ObjectSource::flushOutputs ( )
protectedpure virtual

◆ drainInputs()

virtual void sen::ObjectSource::drainInputs ( )
protectedpure virtual

◆ addSubscriber()

void sen::ObjectFilter::addSubscriber ( std::shared_ptr< Interest > interest,
ObjectProviderListener * listener,
bool notifyAboutExisting )
overridevirtualinherited

Add a subscriber to the filter on a specific interest.

Implements sen::ObjectFilterBase.

◆ removeSubscriber() [1/2]

void sen::ObjectFilter::removeSubscriber ( std::shared_ptr< Interest > interest,
ObjectProviderListener * listener,
bool notifyAboutExisting )
overridevirtualinherited

Removes a previously-added subscriber on a specific interest.

Implements sen::ObjectFilterBase.

◆ removeSubscriber() [2/2]

void sen::ObjectFilter::removeSubscriber ( ObjectProviderListener * listener,
bool notifyAboutExisting )
overridevirtualinherited

Implements sen::ObjectFilterBase.

◆ getOrCreateNamedProvider()

std::shared_ptr< ObjectProvider > sen::ObjectFilter::getOrCreateNamedProvider ( const std::string & name,
std::shared_ptr< Interest > interest )
inherited

Creates a uniquely named provider for objects determined on a given interest. Returns any provider with the same name and interest.

◆ removeNamedProvider()

void sen::ObjectFilter::removeNamedProvider ( std::string_view name)
inherited

Deletes any provider with this name. Does nothing if none found.

◆ evaluate()

void sen::ObjectFilter::evaluate ( const ObjectSet & objects)
protectedinherited

◆ getOwnerId()

const ObjectOwnerId & sen::ObjectFilter::getOwnerId ( ) const
nodiscardprotectednoexceptinherited

◆ subscriberAdded()

virtual void sen::ObjectFilter::subscriberAdded ( std::shared_ptr< Interest > interest,
ObjectProviderListener * listener,
bool notifyAboutExisting )
protectedvirtualinherited

◆ subscriberRemoved() [1/2]

virtual void sen::ObjectFilter::subscriberRemoved ( std::shared_ptr< Interest > interest,
ObjectProviderListener * listener,
bool notifyAboutExisting )
protectedvirtualinherited

◆ subscriberRemoved() [2/2]

virtual void sen::ObjectFilter::subscriberRemoved ( ObjectProviderListener * listener,
bool notifyAboutExisting )
protectedvirtualinherited

◆ objectsAdded()

virtual void sen::ObjectFilter::objectsAdded ( std::shared_ptr< Interest > interest,
ObjectAdditionList additions )
protectedvirtualinherited

◆ objectsRemoved()

virtual void sen::ObjectFilter::objectsRemoved ( std::shared_ptr< Interest > interest,
ObjectRemovalList removals )
protectedvirtualinherited

◆ kernel::impl::Runner

friend class kernel::impl::Runner
friend

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