Responder Class Referenceabstract

#include <Pt/XmlRpc/Responder.h>

Dispatches requests to a service procedure.

Inherits Responder.

Public Member Functions

 Responder (Remoting::ServiceDefinition &service)
 Construct with Service.
 
virtual ~Responder ()
 Destructor.
 
const ServiceProcedure * activeProcedure () const
 The currently executing procedure.
 
void cancel ()
 Resets to initial state.
 
bool isFailed () const
 Indicates if the procedure has failed.
 

Protected Member Functions

bool advanceResult ()
 Formats the XML-RPC message. More...
 
void beginCall (System::EventLoop &loop)
 Begins the service procedure call.
 
void beginMessage (std::istream &is)
 Parses the XML-RPC message. More...
 
void beginResult (std::ostream &os)
 Formats the XML-RPC result. More...
 
Pt::DecomposerendCall ()
 Ends the service procedure call.
 
void finishMessage (System::EventLoop &loop)
 Parses the XML-RPC message. More...
 
void finishResult ()
 Formats the XML-RPC message. More...
 
virtual void onCancel ()
 Cancels all operations. More...
 
virtual void onFault (const Fault &fault)=0
 The service procedure has failed. More...
 
virtual void onReady ()
 The service procedure has finished. More...
 
virtual void onResult ()=0
 The service procedure has finished. More...
 
bool parseMessage ()
 Parses the XML-RPC message. More...
 
void setFault (int rc, const char *msg)
 Fails the service procedure. More...
 
Pt::Composer ** setProcedure (const std::string &name)
 Sets the service procedure.
 

Member Function Documentation

virtual void onReady ( )
protectedvirtual

Derived responders implement this method to format and send the XML-RPC result. It is called when the service procedure has finished. Use beginResult(), advanceResult() and finishResult() to format the XML-RPC result.

Implements Responder.

virtual void onCancel ( )
protectedvirtual

Derived responders implement this method to cancel all operations.

Implements Responder.

virtual void onFault ( const Fault fault)
protectedpure virtual

Derived responders implement this method to format and send the XML-RPC fault result. It is called when the service procedure has failed. Use beginResult(), advanceResult() and finishResult() to format the XML-RPC result.

virtual void onResult ( )
protectedpure virtual

Derived responders implement this method to format and send the XML-RPC result. It is called when the service procedure has finished. Use beginResult(), advanceResult() and finishResult() to format the XML-RPC result.

void beginMessage ( std::istream &  is)
protected

This method is used by derived responders to begin parsing a XML-RPC message from a std::istream.

bool parseMessage ( )
protected

This method is used by derived responders to parse a XML-RPC message. Each call consumes the available data from the std::istream set with beginMessage() and returns true if no more message data needs to be parsed, either because the message is complete or an error occured.

void finishMessage ( System::EventLoop loop)
protected

This method is used by derived responders after the XML-RPC message has been parsed by parseMessage(). This will execute the service procedure.

void beginResult ( std::ostream &  os)
protected

This method is used by derived responders in onResult() and onError() to begin formatting a XML-RPC result to a std::ostream.

bool advanceResult ( )
protected

This method is used by derived responders in onResult() and onError() to format a XML-RPC result. Each call generates a chunk of the result and returns true if the message is complete.

void finishResult ( )
protected

This method is used by derived responders in onResult() and onError() to format the end of a XML-RPC result. It is called after advanceResult() returns true.

void setFault ( int  rc,
const char *  msg 
)
protected

This method is used by derived responders to indicate that the service procedure should not be executed, but a fault result be generated instead.