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

This template class implements the Observer part of the Observer design pattern for implementing a generic data-input-handler (i.e. More...

#include <smartIInputHandler_T.h>

Inheritance diagram for Smart::IInputHandler< InputType >:
Smart::InputTaskTrigger< InputType >

Public Member Functions

 IInputHandler (InputSubject< InputType > *subject, const unsigned int &prescaleFactor=1)
 The default constructor. More...
 
virtual ~IInputHandler ()
 The default destructor. More...
 
virtual void handle_input (const InputType &input)=0
 This is the main input-handler method that will be automatically called from the given subject each time the subject receives input-data. More...
 

Protected Member Functions

void attach_self (const unsigned int &prescale=1)
 calls subject->attach(this); More...
 
void detach_self ()
 calls subject->detach(this); More...
 

Protected Attributes

InputSubject< InputType > * subject
 this is the subject-pointer (can be used in derived classes) More...
 

Friends

template<class InnerType >
class IActiveQueueInputHandlerDecorator
 allows acessing protected members More...
 

Detailed Description

template<class InputType>
class Smart::IInputHandler< InputType >

This template class implements the Observer part of the Observer design pattern for implementing a generic data-input-handler (i.e.

input-data-upcall handler).

This class implements the Observer part of the Observer design pattern. All the communication-patterns that receive input-data can implement the counterpart IInputSubject which can be used by this handler for receiving the input-data. Therefore the abstract method handle_input() needs to be implemented in derived classes.

Constructor & Destructor Documentation

◆ IInputHandler()

template<class InputType>
Smart::IInputHandler< InputType >::IInputHandler ( InputSubject< InputType > *  subject,
const unsigned int &  prescaleFactor = 1 
)
inline

The default constructor.

This constructor will call subject->attach(this) to start observing the given subject.

Parameters
subjectthe subject (also called model) that this handler is going to observe
prescaleFactoroptionally divides the input-update frequency by this factor

◆ ~IInputHandler()

template<class InputType>
virtual Smart::IInputHandler< InputType >::~IInputHandler ( )
inlinevirtual

The default destructor.

This destructor will call subject->detach(this) to stop observing the given subject.

Member Function Documentation

◆ attach_self()

template<class InputType >
void Smart::IInputHandler< InputType >::attach_self ( const unsigned int &  prescale = 1)
inlineprotected

calls subject->attach(this);

This method encapsulates the attachment of itself to the IInputSubject. This is useful as this method can be called from within the IActiveQueueInputHandlerDecorator.

Parameters
prescaleoptionally divides the input-update frequency by this factor

◆ detach_self()

template<class InputType >
void Smart::IInputHandler< InputType >::detach_self ( )
inlineprotected

calls subject->detach(this);

This method encapsulates the detachment of itself from the IInputSubject. This is useful as this method can be called from within the IActiveQueueInputHandlerDecorator.

◆ handle_input()

template<class InputType>
virtual void Smart::IInputHandler< InputType >::handle_input ( const InputType &  input)
pure virtual

This is the main input-handler method that will be automatically called from the given subject each time the subject receives input-data.

This method should be implemented in derived classes to provide a data-handling procedure.

Parameters
inputthe input-data reference

Implemented in Smart::IEventHandler< EventType >, and Smart::InputTaskTrigger< InputType >.

Friends And Related Function Documentation

◆ IActiveQueueInputHandlerDecorator

template<class InputType>
template<class InnerType >
friend class IActiveQueueInputHandlerDecorator
friend

allows acessing protected members

Member Data Documentation

◆ subject

template<class InputType>
InputSubject<InputType>* Smart::IInputHandler< InputType >::subject
protected

this is the subject-pointer (can be used in derived classes)


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