Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Safir::Dob::ResponseSender Class Referenceabstract

Class used for responding to received requests. More...

#include <Safir/Dob/ResponseSender.h>

Inheritance diagram for Safir::Dob::ResponseSender:
Collaboration diagram for Safir::Dob::ResponseSender:

Public Member Functions

virtual ~ResponseSender ()
 Destructor. More...
 
virtual void Send (const Safir::Dob::ResponsePtr &response)=0
 Sends a response for the request that this instance was obtained with. More...
 
virtual bool IsDone ()=0
 Check if an instance is still waiting for a response to be sent. More...
 
virtual void Discard ()=0
 Discard this ResponseSender. More...
 

Detailed Description

Class used for responding to received requests.

The purpose of this class is to allow responses to be sent either from within the request callback, or at a later time (in which case you have to keep the responseSender you received in the callback "for later").

Note that you still have to send the response within the timout period, or the response will not be delivered to the requestor (who will have received a timeout response instead).

Constructor & Destructor Documentation

virtual Safir::Dob::ResponseSender::~ResponseSender ( )
virtual

Destructor.

Will check that the ResponseSender has been used, and if it hasn't an error will be reported (a PanicLog!).

Not using a ResponseSender is considered a programming error.

Member Function Documentation

virtual void Safir::Dob::ResponseSender::Discard ( )
pure virtual

Discard this ResponseSender.

Calling this function means that you forfeit your chance to send a response to the request. It will disable the checks in the destructor (see above).

The typical case when you must discard the ResponseSender is when calling Postpone with redispatchCurrent set to True. In this case you will get the request again together with a new ResponseSender.

virtual bool Safir::Dob::ResponseSender::IsDone ( )
pure virtual

Check if an instance is still waiting for a response to be sent.

Returns
True if a response has been sent using this instance (instance is consumed), otherwise false.
virtual void Safir::Dob::ResponseSender::Send ( const Safir::Dob::ResponsePtr response)
pure virtual

Sends a response for the request that this instance was obtained with.

This method may only be called once on any given instance! Calling it twice amounts to trying to send two responses to one request, which is considered a programming error.

Parameters
response- The response to be sent.
Exceptions
Safir::Dob::NotOpenException- If the connection is not open.