qxLib
Classes | Public Member Functions | List of all members
qx::subject< observer_t > Class Template Reference

Class maintains a list of its dependents, called observers, and notifies them automatically of any state changes. More...

#include <observer.h>

Inheritance diagram for qx::subject< observer_t >:
qx::base_subject

Public Member Functions

observer_token attach (observer_t *pObserver) noexcept
 Attach observer to this subject. More...
 
void notify (const notify_func &notifyFunc) const noexcept
 Notify all observers. More...
 
iterator begin ()
 Return iterator to beginning. More...
 
const_iterator begin () const
 Return iterator to beginning. More...
 
const_iterator cbegin () const
 Return const iterator to beginning. More...
 
iterator end ()
 Return iterator to end. More...
 
const_iterator end () const
 Return iterator to end. More...
 
const_iterator cend () const
 Return const iterator to end. More...
 
reverse_iterator rbegin ()
 Return reverse iterator to reverse beginning. More...
 
const_reverse_iterator rbegin () const
 Return reverse iterator to reverse beginning. More...
 
const_reverse_iterator crbegin () const
 Return const reverse iterator to reverse beginning. More...
 
reverse_iterator rend ()
 Return reverse iterator to reverse end. More...
 
const_reverse_iterator rend () const
 Return reverse iterator to reverse end. More...
 
const_reverse_iterator crend () const
 Return const reverse iterator to reverse end. More...
 
size_t get_num_observers () const noexcept
 Get number of observers attached to this subject. More...
 

Additional Inherited Members

Detailed Description

template<class observer_t>
class qx::subject< observer_t >

Class maintains a list of its dependents, called observers, and notifies them automatically of any state changes.

~

Template Parameters
observer_t- observer type
Author
Khrapov
Date
6.03.2021

Definition at line 119 of file observer.h.

Member Function Documentation

◆ attach()

template<class observer_t >
observer_token qx::subject< observer_t >::attach ( observer_t *  pObserver)
inlinenoexcept

Attach observer to this subject.

Parameters
pObserver- observer pointer
Return values
-observer_token for auto detaching observer from this subject

Definition at line 159 of file observer.inl.

◆ begin() [1/2]

template<class observer_t >
subject< observer_t >::const_iterator qx::subject< observer_t >::begin ( void  )
inline

Return iterator to beginning.

Return values
-iterator to beginning

Definition at line 182 of file observer.inl.

◆ begin() [2/2]

template<class observer_t >
const_iterator qx::subject< observer_t >::begin ( ) const

Return iterator to beginning.

Return values
-iterator to beginning

◆ cbegin()

template<class observer_t >
subject< observer_t >::const_iterator qx::subject< observer_t >::cbegin ( void  ) const
inline

Return const iterator to beginning.

Return values
-const iterator to beginning

Definition at line 194 of file observer.inl.

◆ cend()

template<class observer_t >
subject< observer_t >::const_iterator qx::subject< observer_t >::cend ( void  ) const
inline

Return const iterator to end.

Return values
-const iterator to end

Definition at line 212 of file observer.inl.

◆ crbegin()

template<class observer_t >
subject< observer_t >::const_reverse_iterator qx::subject< observer_t >::crbegin
inline

Return const reverse iterator to reverse beginning.

Return values
-const reverse iterator to reverse beginning

Definition at line 230 of file observer.inl.

◆ crend()

template<class observer_t >
subject< observer_t >::const_reverse_iterator qx::subject< observer_t >::crend
inline

Return const reverse iterator to reverse end.

Return values
-const reverse iterator to reverse end

Definition at line 248 of file observer.inl.

◆ end() [1/2]

template<class observer_t >
subject< observer_t >::const_iterator qx::subject< observer_t >::end ( void  )
inline

Return iterator to end.

Return values
-iterator to end

Definition at line 200 of file observer.inl.

◆ end() [2/2]

template<class observer_t >
const_iterator qx::subject< observer_t >::end ( ) const

Return iterator to end.

Return values
-iterator to end

◆ get_num_observers()

template<class observer_t >
size_t qx::subject< observer_t >::get_num_observers
inlinenoexcept

Get number of observers attached to this subject.

Return values
-number of observers attached to this subject

Definition at line 254 of file observer.inl.

◆ notify()

template<class observer_t >
void qx::subject< observer_t >::notify ( const notify_func &  notifyFunc) const
inlinenoexcept

Notify all observers.

Parameters
notifyFunc- callback

Definition at line 175 of file observer.inl.

◆ rbegin() [1/2]

template<class observer_t >
subject< observer_t >::const_reverse_iterator qx::subject< observer_t >::rbegin ( void  )
inline

Return reverse iterator to reverse beginning.

Return values
-reverse iterator to reverse beginning

Definition at line 218 of file observer.inl.

◆ rbegin() [2/2]

template<class observer_t >
const_reverse_iterator qx::subject< observer_t >::rbegin ( ) const

Return reverse iterator to reverse beginning.

Return values
-reverse iterator to reverse beginning

◆ rend() [1/2]

template<class observer_t >
subject< observer_t >::const_reverse_iterator qx::subject< observer_t >::rend ( void  )
inline

Return reverse iterator to reverse end.

Return values
-reverse iterator to reverse end

Definition at line 236 of file observer.inl.

◆ rend() [2/2]

template<class observer_t >
const_reverse_iterator qx::subject< observer_t >::rend ( ) const

Return reverse iterator to reverse end.

Return values
-reverse iterator to reverse end

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