SObjectizer 5.8
Loading...
Searching...
No Matches
so_5::abstract_sink_owner_t Class Referenceabstract

Interface for holders of message_sink instances. More...

#include <message_sink.hpp>

Inheritance diagram for so_5::abstract_sink_owner_t:
so_5::atomic_refcounted_t so_5::simple_sink_owner_t< Sink_Type >

Public Member Functions

 abstract_sink_owner_t ()=default
 
virtual ~abstract_sink_owner_t () noexcept=default
 
virtual abstract_message_sink_tsink () noexcept=0
 Get a reference to the underlying message sink.
 
virtual const abstract_message_sink_tsink () const noexcept=0
 Get a const reference to the underlying message sink.
 

Friends

class intrusive_ptr_t< abstract_sink_owner_t >
 

Additional Inherited Members

- Protected Member Functions inherited from so_5::atomic_refcounted_t
 atomic_refcounted_t (const atomic_refcounted_t &)=delete
 
atomic_refcounted_toperator= (const atomic_refcounted_t &)=delete
 
 atomic_refcounted_t () noexcept
 Default constructor.
 
 ~atomic_refcounted_t () noexcept=default
 Destructor.
 
void inc_ref_count () noexcept
 Increments reference count.
 
unsigned long dec_ref_count () noexcept
 Decrement reference count.
 

Detailed Description

Interface for holders of message_sink instances.

There is mbox_t, which is a kind of smart pointer to abstract_message_box_t. It's a very useful type that allows to hold references to message boxes safely. But mbox_t exists because all message boxes should be dynamically allocated objects. The situation with message sinks is a bit more complicated. Not all message sinks are dynamically allocated, some may be parts of other objects. But if a message sink is dynamically allocated then it's good to have something like mbox_t, but for message sinks.

The type abstract_sink_owner_t is a proxy for a real message sink object. Instances of abstract_sink_owner_t are always allocated dynamically. They can hold real message sinks as members (in this case abstract_sink_owner lives on the heap and the message sink lives inside it), or they can hold references to message sinks that live elsewhere.

The presence of abstract_sink_owner_t allows to have msink_t type, which is very similar to mbox_t.

Note that the abstract_sink_owner_t is an abstract class. The real implementations of sink owners must be derived from this class.

Note
It's expected that one abstract_sink_owner_t holds a reference to just one message sink.
Since
v.5.8.0

Definition at line 191 of file message_sink.hpp.

Constructor & Destructor Documentation

◆ abstract_sink_owner_t()

so_5::abstract_sink_owner_t::abstract_sink_owner_t ( )
default

◆ ~abstract_sink_owner_t()

virtual so_5::abstract_sink_owner_t::~abstract_sink_owner_t ( )
virtualdefaultnoexcept

Member Function Documentation

◆ sink() [1/2]

virtual const abstract_message_sink_t & so_5::abstract_sink_owner_t::sink ( ) const
nodiscardpure virtualnoexcept

Get a const reference to the underlying message sink.

Implemented in so_5::simple_sink_owner_t< Sink_Type >.

◆ sink() [2/2]

virtual abstract_message_sink_t & so_5::abstract_sink_owner_t::sink ( )
nodiscardpure virtualnoexcept

Get a reference to the underlying message sink.

Implemented in so_5::simple_sink_owner_t< Sink_Type >.

Friends And Related Symbol Documentation

◆ intrusive_ptr_t< abstract_sink_owner_t >

friend class intrusive_ptr_t< abstract_sink_owner_t >
friend

Definition at line 139 of file message_sink.hpp.


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