SmartSoft Component-Developer API
Public Member Functions | Protected Member Functions | Friends | List of all members
Smart::InputSubject< InputType > Class Template Reference

This template class implements the Subject (also called Model) part of the Observer design pattern for implementing delegation of handling incoming data. More...

#include <smartIInputHandler_T.h>

Public Member Functions

virtual ~InputSubject ()=default
 Default destructor. More...
 

Protected Member Functions

virtual void attach (IInputHandler< InputType > *handler, const unsigned int &prescaleFactor=1)
 Attach an IInputHandler<InputType> instance. More...
 
virtual void detach (IInputHandler< InputType > *handler)
 Detach an IInputHandler<InputType> instance. More...
 
virtual bool notify_input (const InputType &input)
 Notifies all attached IInputHandler instances about incoming data. More...
 

Friends

class IInputHandler< InputType >
 allows calling protected attach() and detach() methods More...
 

Detailed Description

template<class InputType>
class Smart::InputSubject< InputType >

This template class implements the Subject (also called Model) part of the Observer design pattern for implementing delegation of handling incoming data.

All Communication-Patterns that internally receive input data (e.g. IPushClient, or IQueryServer) can implement this interface to allow the definition of upcall-handlers for handling input-data.

Constructor & Destructor Documentation

◆ ~InputSubject()

template<class InputType>
virtual Smart::InputSubject< InputType >::~InputSubject ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ attach()

template<class InputType>
virtual void Smart::InputSubject< InputType >::attach ( IInputHandler< InputType > *  handler,
const unsigned int &  prescaleFactor = 1 
)
inlineprotectedvirtual

Attach an IInputHandler<InputType> instance.

This method should be called from within the constructor of an IInputHandler instance. This is possible because the IInputHandler is defined as a friend class of IInputSubject.

Parameters
handlerthe InputHandler pointer
prescaleFactordivides the input-update frequency by this factor

◆ detach()

template<class InputType>
virtual void Smart::InputSubject< InputType >::detach ( IInputHandler< InputType > *  handler)
inlineprotectedvirtual

Detach an IInputHandler<InputType> instance.

This method should be called from within the destructor of an IInputHandler instance. This is possible because the IInputHandler is defined as a friend class of IInputSubject.

Parameters
handlerthe InputHandler pointer

◆ notify_input()

template<class InputType>
virtual bool Smart::InputSubject< InputType >::notify_input ( const InputType &  input)
inlineprotectedvirtual

Notifies all attached IInputHandler instances about incoming data.

An instance of IInputSubject should call this method each time new data arrives. This method then delegates the input-data-handling to all attached IInputHandler instances.

Parameters
inputthe input-data reference

Friends And Related Function Documentation

◆ IInputHandler< InputType >

template<class InputType>
friend class IInputHandler< InputType >
friend

allows calling protected attach() and detach() methods


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