Google APIs Client Library for C++
HttpTransportFactory Class Reference

Abstract interface for creating concrete HttpTransport instances. More...

#include "client/transport/http_transport.h"

+ Inheritance diagram for HttpTransportFactory:

List of all members.

Public Member Functions

 HttpTransportFactory ()
 Default constructor creates instances with the default configuration default HttpTransportOptions.
 HttpTransportFactory (const HttpTransportLayerConfig *config)
 Standard constructor.
virtual ~HttpTransportFactory ()
 Standard destructor.
HttpTransportNewWithOptions (const HttpTransportOptions &options)
 Construct a new transport instance with the provided options.
HttpTransportNew ()
 Construct a new instance using the default transport options given to this factory instance.
HttpRequestOptionsmutable_request_options ()
 Get the modifiable default request options given the transport instances created by this factory.
const HttpRequestOptionsdefault_request_options () const
 Returns the default request options assigned by this factory instance.
const string & default_id () const
 Returns the default id to assign new transport instances created.
void set_default_id (const StringPiece &id)
 Change the default transport identifier for new instances.
void reset_scribe (HttpScribe *scribe)
 Sets the scribe to bind to instances.
HttpScribescribe ()
 Returns the scribe, if any.
const HttpTransportLayerConfigconfig ()
 Returns the configuration that this factory was constructed with.

Protected Member Functions

virtual HttpTransportDoAlloc (const HttpTransportOptions &options)=0
 Specialized factories override this method to create new instances.

Detailed Description

Abstract interface for creating concrete HttpTransport instances.

This class implements a Factory pattern for instantiating new HttpTransport instances. It acts as the base class for all HttpTransport factories used by the Google APIs Client Library for C++ runtime library.

It is recommended that you always use this class when defining classes and interfaces rather than the concrete subclasses. If you need a factory but do not care about the implementation, consider HttpTransport::default_transport_factory().

Current HttpTransport::default_transport_factory must be explicit set at some point during execution (such as application startup).

See also:
New

Constructor & Destructor Documentation

Default constructor creates instances with the default configuration default HttpTransportOptions.

This method still calls DoAlloc with the default options.

HttpTransportFactory ( const HttpTransportLayerConfig config) [explicit]

Standard constructor.

Caller maintains ownership of the configuration, which can be shared across mutliple factory instances.

Parameters:
[in]configIf NULL then this behaves similar to the default constructor. If non-null the caller retains ownership.
Note:
This factory instance is independent of the default_transport_factory in the config. If you want to use this instance as the default in the config then call config->ResetDefaultTransportFactory with this instance after the constructor returns.
virtual ~HttpTransportFactory ( ) [virtual]

Standard destructor.


Member Function Documentation

const HttpTransportLayerConfig* config ( ) [inline]

Returns the configuration that this factory was constructed with.

Returns:
NULL if it just uses the defaults.
const string& default_id ( ) const [inline]

Returns the default id to assign new transport instances created.

const HttpRequestOptions& default_request_options ( ) const [inline]

Returns the default request options assigned by this factory instance.

virtual HttpTransport* DoAlloc ( const HttpTransportOptions options) [protected, pure virtual]

Specialized factories override this method to create new instances.

The base class will add the scribe and other factory configurations.

Implemented in JsonPlaybackTransportFactory, and CurlHttpTransportFactory.

Get the modifiable default request options given the transport instances created by this factory.

Changing these options will affect future transport instances created but will not affect exsting transport or request instances.

HttpTransport* New ( ) [inline]

Construct a new instance using the default transport options given to this factory instance.

Construct a new transport instance with the provided options.

void reset_scribe ( HttpScribe scribe)

Sets the scribe to bind to instances.

If this is non-NULL then it must remain valid until any transports created with this factory are finished. Since the factory will own the scribe, that means the factory cannot be destroyed either until all transports created from this are no longer in used.

Parameters:
[in]scribeOwnership is passed. NULL will clear.
HttpScribe* scribe ( ) [inline]

Returns the scribe, if any.

void set_default_id ( const StringPiece &  id) [inline]

Change the default transport identifier for new instances.

Parameters:
[in]idThe initial identifier to use for new instances is typically the name of the transport implementation.
See also:
HttpTransport::id()

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