SmartSoft Component-Developer API
Public Types | Public Member Functions | List of all members
Smart::IQueryServerHandler< RequestType, AnswerType > Class Template Referenceabstract

Handler Class for QueryServer for incoming requests. More...

#include <smartIQueryServerPattern_T.h>

Inheritance diagram for Smart::IQueryServerHandler< RequestType, AnswerType >:
Smart::IActiveQueryServerHandler< RequestType, AnswerType >

Public Types

using IQueryServer = IQueryServerPattern< RequestType, AnswerType >
 

Public Member Functions

virtual ~IQueryServerHandler ()=default
 Default destructor. More...
 
virtual void handleQuery (IQueryServer &server, const QueryIdPtr &id, const RequestType &request)=0
 Handler method for an incoming query request. More...
 

Detailed Description

template<class RequestType, class AnswerType>
class Smart::IQueryServerHandler< RequestType, AnswerType >

Handler Class for QueryServer for incoming requests.

Used by the QueryServer to handle incoming queries. The user should implement the handleQuery() method by subclassing and providing a pointer to an IQueryServerPattern to this handler.

Member Typedef Documentation

◆ IQueryServer

template<class RequestType , class AnswerType >
using Smart::IQueryServerHandler< RequestType, AnswerType >::IQueryServer = IQueryServerPattern<RequestType,AnswerType>

Constructor & Destructor Documentation

◆ ~IQueryServerHandler()

template<class RequestType , class AnswerType >
virtual Smart::IQueryServerHandler< RequestType, AnswerType >::~IQueryServerHandler ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ handleQuery()

template<class RequestType , class AnswerType >
virtual void Smart::IQueryServerHandler< RequestType, AnswerType >::handleQuery ( IQueryServer server,
const QueryIdPtr id,
const RequestType &  request 
)
pure virtual

Handler method for an incoming query request.

This method is called by the query-server every time a new query request is received. It must be provided by the component developer to handle incoming requests. Since the method is executed by the communication thread, it must be very fast and non-blocking. Within this handler, use the provided server pointer to provide an answer like this: "server->answer(...)".

Usually the request and the id will be inserted into a queue and another working thread processes the request and provides the result. The ThreadedQueryHandler decorator provides such a processing pattern.

Parameters
servera reference to the related query server pattern for calling the answer(...) method from within the handler
idid of new query
requestthe request itself

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