libdap++  Updated for version 3.8.2
libdap::Response Class Reference

#include <Response.h>

Inheritance diagram for libdap::Response:
Inheritance graph
Collaboration diagram for libdap::Response:
Collaboration graph

Public Member Functions

 Response (FILE *s, int status=0)
 
virtual ~Response ()
 
Accessors
virtual int get_status () const
 
virtual FILE * get_stream () const
 
virtual ObjectType get_type () const
 
virtual string get_version () const
 
virtual string get_protocol () const
 
Mutators
virtual void set_status (int s)
 
virtual void set_stream (FILE *s)
 
virtual void set_type (ObjectType o)
 
virtual void set_version (const string &v)
 
virtual void set_protocol (const string &p)
 

Protected Member Functions

Suppressed default methods
 Response ()
 
 Response (const Response &)
 
Responseoperator= (const Response &)
 

Detailed Description

Encapsulate a response. Instead of directly returning the FILE pointer from which a response is read, return an instance of this object. For a simple system where all that needs to be done to free the stream and its associated resources, this is overkill. However, some streams may require complex operations to free their resources once the client is done with the stream. Those classes should return a subclass of Response which has those operations built into the destructor.

Todo:
If the code that parses the MIME headers was moved from Connect and HTTPConnect to this class and its children, it would be easier to build a FileConnect class (or maybe the specifics of the connection type could be held in the Response object and HTTPConnect and the to be written FileConnect would not be needed).

Definition at line 62 of file Response.h.

Constructor & Destructor Documentation

◆ Response() [1/3]

libdap::Response::Response ( )
inlineprotected

Definition at line 79 of file Response.h.

◆ Response() [2/3]

libdap::Response::Response ( const Response )
inlineprotected

Definition at line 81 of file Response.h.

◆ Response() [3/3]

libdap::Response::Response ( FILE *  s,
int  status = 0 
)
inline

Initialize with a stream. Create an instance initialized to a stream. by default get_type() and get_version() return default values of unknown_type and "dods/0.0", respectively. Specializations (see HTTPResponse and HTTPConnect) may fill these fields in with other values.

Parameters
sRead data from this stream.
statusThe HTTP response status code.

Definition at line 97 of file Response.h.

◆ ~Response()

virtual libdap::Response::~Response ( )
inlinevirtual

Close the stream.

Definition at line 103 of file Response.h.

Member Function Documentation

◆ get_protocol()

◆ get_status()

virtual int libdap::Response::get_status ( ) const
inlinevirtual

Definition at line 111 of file Response.h.

Referenced by libdap::HTTPConnect::fetch_url().

◆ get_stream()

◆ get_type()

◆ get_version()

◆ operator=()

Response& libdap::Response::operator= ( const Response )
inlineprotected

Definition at line 83 of file Response.h.

◆ set_protocol()

virtual void libdap::Response::set_protocol ( const string &  p)
inlinevirtual

Definition at line 151 of file Response.h.

◆ set_status()

virtual void libdap::Response::set_status ( int  s)
inlinevirtual

Definition at line 135 of file Response.h.

◆ set_stream()

virtual void libdap::Response::set_stream ( FILE *  s)
inlinevirtual

Reimplemented in libdap::PipeResponse, and libdap::StdinResponse.

Definition at line 139 of file Response.h.

Referenced by libdap::HTTPResponse::~HTTPResponse().

◆ set_type()

virtual void libdap::Response::set_type ( ObjectType  o)
inlinevirtual

Definition at line 143 of file Response.h.

Referenced by libdap::Connect::read_data().

◆ set_version()

virtual void libdap::Response::set_version ( const string &  v)
inlinevirtual

Definition at line 147 of file Response.h.


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