AceSmartSoft API Documentation
Public Types | Public Member Functions | List of all members
SmartACE::QueryServer< R, A > Class Template Reference

server query template. More...

#include <smartWiring.hh>

Inheritance diagram for SmartACE::QueryServer< R, A >:

Public Types

using IQueryServerBase = Smart::IQueryServerPattern< R, A >
 

Public Member Functions

 QueryServer (SmartComponent *component, const std::string &service, IQueryServerHandlerPtr query_handler=nullptr)
 Constructor. More...
 
virtual ~QueryServer ()
 Destructor. More...
 
Smart::StatusCode answer (const Smart::QueryIdPtr id, const A &answer)
 Provide answer to be sent back to the requestor. More...
 

Detailed Description

template<class R, class A>
class SmartACE::QueryServer< R, A >

server query template.

Server part of query pattern to perform two-way communication.

Template parameters

Demonstrated in first example and third example

Member Typedef Documentation

◆ IQueryServerBase

template<class R, class A>
using SmartACE::QueryServer< R, A >::IQueryServerBase = Smart::IQueryServerPattern<R,A>

Constructor & Destructor Documentation

◆ QueryServer()

template<class R, class A>
SmartACE::QueryServer< R, A >::QueryServer ( SmartComponent component,
const std::string &  service,
IQueryServerHandlerPtr  query_handler = nullptr 
)

Constructor.

Note that a handler has to be supplied. Without a handler, the QueryServer could not accept a query.

(Currently exception not thrown)

Parameters
componentmanagement class of the component
servicename of the service
query_handleran optional query_handler

◆ ~QueryServer()

template<class R, class A>
virtual SmartACE::QueryServer< R, A >::~QueryServer ( )
virtual

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.

Member Function Documentation

◆ answer()

template<class R, class A>
Smart::StatusCode SmartACE::QueryServer< R, A >::answer ( const Smart::QueryIdPtr  id,
const A &  answer 
)

Provide answer to be sent back to the requestor.

Member function is thread safe and thread reentrant.

Parameters
ididentifies the request to which the answer belongs
answeris the reply itself.
Returns
status code:
  • SMART_OK : everything is ok and answer sent to requesting client
  • SMART_WRONGID : no pending query with that id known
  • SMART_DISCONNECTED : answer not needed anymore since client got disconnected meanwhile
  • SMART_ERROR_COMMUNICATION : communication problems
  • SMART_ERROR : something went wrong

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