Google APIs Client Library for C++
HttpEntryScribe Class Reference

A high level but still abstract class for intercepting HTTP requests. More...

#include "client/transport/http_scribe.h"

+ Inheritance diagram for HttpEntryScribe:

List of all members.

Classes

class  Entry

Public Member Functions

virtual void AboutToSendRequest (const HttpRequest *request)
 Implements the HttpScribe::AboutToSendRequest method.
virtual void ReceivedResponseForRequest (const HttpRequest *request)
 Implements the HttpScribe::ReceivedResponseForRequest method.
virtual void RequestFailedWithTransportError (const HttpRequest *request, const util::Status &error)
 Implements the HttpScribe::RequestFailedWithTransportError method.

Protected Member Functions

 HttpEntryScribe (HttpScribeCensor *censor)
 Standard constructor.
virtual ~HttpEntryScribe ()
 Standard destructor.
EntryGetEntry (const HttpRequest *request) LOCKS_EXCLUDED(mutex_)
 Maps the request into a logical entry.
void DiscardEntry (Entry *entry) LOCKS_EXCLUDED(mutex_)
 Unmaps and destroys the logical entry.
void DiscardQueue ()
 Discard all the entries in the queue.
virtual EntryNewEntry (const HttpRequest *request)=0
 Create a new entry instance for the request.
queue< Entry * > * outstanding_queue ()
 Returns the entries that have not yet been unmapped.

Detailed Description

A high level but still abstract class for intercepting HTTP requests.

This class manages a collection of active HttpEntryScribe::Entry instances with activity associated with them. This might be a more useful starting point for viewing a collection of independent encapsulated messages as opposed to a stream of interleaved events.


Constructor & Destructor Documentation

HttpEntryScribe ( HttpScribeCensor censor) [explicit, protected]

Standard constructor.

Parameters:
[in]censorOwnership to the censorship policy is passed.
virtual ~HttpEntryScribe ( ) [protected, virtual]

Standard destructor.


Member Function Documentation

virtual void AboutToSendRequest ( const HttpRequest request) [virtual]

Implements the HttpScribe::AboutToSendRequest method.

This maps the request to an entry and calls the Entry::Sent method.

Parameters:
[in]requestThe request that was sent.

Implements HttpScribe.

void DiscardEntry ( Entry entry) [protected]

Unmaps and destroys the logical entry.

This can be called to forget about the entry, but is normally handled automatically by this scribe instance.

Parameters:
[in,out]entryThe entry will be destroyed.
void DiscardQueue ( ) [protected]

Discard all the entries in the queue.

Discarding the entries notifies the entry that it is done so it can flush and remove itself. This method is here so that derived destructors can call it if they need to finish the entry before they destruct.

The base class will call this to discard anything remaining in its destructor.

Entry* GetEntry ( const HttpRequest request) [protected]

Maps the request into a logical entry.

Parameters:
[in]requestThe intercepted request.
Returns:
the scribe maintains ownership for the entry consolidating activity for the request
See also:
NewEntry
DiscardEntry
virtual Entry* NewEntry ( const HttpRequest request) [protected, pure virtual]

Create a new entry instance for the request.

This is called from within a critical section so does not have to worry about threads.

This lets specialized scribes return specialized entries that drive the particular specialized behavior. It is called by GetEntry.

Returns:
ownership of the entry.

Implemented in JsonScribe, and HtmlScribe.

queue<Entry*>* outstanding_queue ( ) [inline, protected]

Returns the entries that have not yet been unmapped.

These are in the order they were created, which is probably the order in which they were sent (minus race conditions).

virtual void ReceivedResponseForRequest ( const HttpRequest request) [virtual]

Implements the HttpScribe::ReceivedResponseForRequest method.

This maps the request to an entry and calls the Entry::Received method.

Parameters:
[in]requestThe request whose response was received.

Implements HttpScribe.

virtual void RequestFailedWithTransportError ( const HttpRequest request,
const util::Status error 
) [virtual]

Implements the HttpScribe::RequestFailedWithTransportError method.

This maps the request to an entry and calls the Entry::Failed method.

Parameters:
[in]requestThe request that had a transport failure.
[in]errorAn explanation of the failure.

Implements HttpScribe.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines