CatapultServer  v0.5.0.1 (Elephant)
catapult::observers::FunctionalNotificationObserverT< TNotification > Class Template Reference

A notification observer implementation that wraps a function. More...

Inheritance diagram for catapult::observers::FunctionalNotificationObserverT< TNotification >:
Collaboration diagram for catapult::observers::FunctionalNotificationObserverT< TNotification >:

Public Member Functions

 FunctionalNotificationObserverT (const std::string &name, const FunctionType &func)
 Creates a functional notification observer around func with name. More...
 
const std::string & name () const override
 Gets the observer name. More...
 
void notify (const TNotification &notification, ObserverContext &context) const override
 Notifies the observer with a notification to process and an observer context. More...
 
- Public Member Functions inherited from catapult::observers::NotificationObserverT< TNotification >
virtual ~NotificationObserverT ()=default
 

Private Types

using FunctionType = consumer< const TNotification &, ObserverContext & >
 

Private Attributes

std::string m_name
 
FunctionType m_func
 

Additional Inherited Members

- Public Types inherited from catapult::observers::NotificationObserverT< TNotification >
using NotificationType = TNotification
 Notification type. More...
 

Detailed Description

template<typename TNotification>
class catapult::observers::FunctionalNotificationObserverT< TNotification >

A notification observer implementation that wraps a function.

Member Typedef Documentation

◆ FunctionType

template<typename TNotification >
using catapult::observers::FunctionalNotificationObserverT< TNotification >::FunctionType = consumer<const TNotification&, ObserverContext&>
private

Constructor & Destructor Documentation

◆ FunctionalNotificationObserverT()

template<typename TNotification >
catapult::observers::FunctionalNotificationObserverT< TNotification >::FunctionalNotificationObserverT ( const std::string &  name,
const FunctionType func 
)
inlineexplicit

Creates a functional notification observer around func with name.

Member Function Documentation

◆ name()

template<typename TNotification >
const std::string& catapult::observers::FunctionalNotificationObserverT< TNotification >::name ( ) const
inlineoverridevirtual

◆ notify()

template<typename TNotification >
void catapult::observers::FunctionalNotificationObserverT< TNotification >::notify ( const TNotification &  notification,
ObserverContext context 
) const
inlineoverridevirtual

Notifies the observer with a notification to process and an observer context.

Implements catapult::observers::NotificationObserverT< TNotification >.

Member Data Documentation

◆ m_func

template<typename TNotification >
FunctionType catapult::observers::FunctionalNotificationObserverT< TNotification >::m_func
private

◆ m_name

template<typename TNotification >
std::string catapult::observers::FunctionalNotificationObserverT< TNotification >::m_name
private

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