SmartSoft Component-Developer API
|
The server part of the Query pattern to perform two-way (request-response) communication. More...
#include <smartIQueryServerPattern_T.h>
Public Types | |
using | IQueryServerHandlerPtr = std::shared_ptr< Smart::IQueryServerHandler< RequestType, AnswerType > > |
Public Member Functions | |
IQueryServerPattern (IComponent *component, const std::string &service, IQueryServerHandlerPtr query_handler=nullptr) | |
Default constructor. More... | |
virtual | ~IQueryServerPattern ()=default |
Destructor. More... | |
virtual StatusCode | answer (const QueryIdPtr id, const AnswerType &answer)=0 |
Provide answer to be sent back to the requestor. More... | |
Public Member Functions inherited from Smart::IServerPattern | |
IServerPattern (IComponent *component, const std::string &serviceName) | |
Constructor. More... | |
virtual | ~IServerPattern () |
Destructor. More... | |
Public Member Functions inherited from Smart::ICommunicationPattern | |
ICommunicationPattern (IComponent *component) | |
Default Constructor initializing an IShutdownObserver. More... | |
virtual | ~ICommunicationPattern ()=default |
Default Destructor. More... | |
Public Member Functions inherited from Smart::IShutdownObserver | |
IShutdownObserver (ShutdownSubject *subject=nullptr) | |
The default constructor. More... | |
virtual | ~IShutdownObserver () |
The default destructor. More... | |
Public Member Functions inherited from Smart::InputSubject< std::pair< QueryIdPtr, RequestType > > | |
virtual | ~InputSubject ()=default |
Default destructor. More... | |
Protected Member Functions | |
void | handleQuery (const QueryIdPtr id, const RequestType &request) |
please call this method in derived classes from within the middleware-specific data handler More... | |
Protected Member Functions inherited from Smart::IServerPattern | |
bool | is_shutting_down () const |
virtual void | on_shutdown () |
implements individual shutdown strategy. More... | |
virtual void | serverInitiatedDisconnect ()=0 |
implements server-initiated-disconnect (SID) More... | |
Protected Member Functions inherited from Smart::ICommunicationPattern | |
ICommunicationPattern (const ICommunicationPattern &)=delete | |
ICommunicationPattern & | operator= (const ICommunicationPattern &)=delete |
ICommunicationPattern ()=delete | |
Protected Member Functions inherited from Smart::IShutdownObserver | |
void | attach_self_to (ShutdownSubject *subject) |
call this method from within the constructor of derived classes More... | |
void | detach_self_from (ShutdownSubject *subject) |
this method is called within the destructor More... | |
Protected Member Functions inherited from Smart::InputSubject< std::pair< QueryIdPtr, RequestType > > | |
virtual void | attach (IInputHandler< std::pair< QueryIdPtr, RequestType > > *handler, const unsigned int &prescaleFactor=1) |
Attach an IInputHandler<InputType> instance. More... | |
virtual void | detach (IInputHandler< std::pair< QueryIdPtr, RequestType > > *handler) |
Detach an IInputHandler<InputType> instance. More... | |
virtual bool | notify_input (const std::pair< QueryIdPtr, RequestType > &input) |
Notifies all attached IInputHandler instances about incoming data. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Smart::IServerPattern | |
std::string | serviceName |
the current serviceName (can be used in derived classes) More... | |
Protected Attributes inherited from Smart::ICommunicationPattern | |
IComponent * | icomponent |
the internal pointer to the component (can be accessed in derived classes) More... | |
The server part of the Query pattern to perform two-way (request-response) communication.
Template parameters
using Smart::IQueryServerPattern< RequestType, AnswerType >::IQueryServerHandlerPtr = std::shared_ptr<Smart::IQueryServerHandler<RequestType,AnswerType> > |
|
inline |
Default constructor.
Note that a handler has to be supplied. Without a handler, the QueryServer could not accept a query.
component | management class of the component |
service | name of the service |
query_handler | an optional query_handler |
|
virtualdefault |
Destructor.
Properly disconnects all service requestors in case of destruction such that all pending queries are handled correctly at client side even when the service provider disappears during pending queries.
|
pure virtual |
Provide answer to be sent back to the requestor.
Member function is thread safe and thread reentrant.
id | identifies the request to which the answer belongs |
answer | is the reply itself. |
|
inlineprotected |
please call this method in derived classes from within the middleware-specific data handler