libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
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 ()=default
 
 Response (FILE *s, int status=0)
 
 Response (std::fstream *s, int status=0)
 
virtual ~Response ()
 
Suppressed default methods
 Response (const Response &)=delete
 
Responseoperator= (const Response &)=delete
 
getters
virtual int get_status () const
 
virtual FILE * get_stream () const
 
virtual std::istream * get_cpp_stream () const
 
virtual ObjectType get_type () const
 
virtual std::string get_version () const
 
virtual std::string get_protocol () const
 
setters
virtual void set_status (int s)
 
virtual void set_stream (FILE *s)
 
virtual void set_cpp_stream (std::istream *s)
 
virtual void set_type (ObjectType o)
 
virtual void set_version (const std::string &v)
 
virtual void set_protocol (const std::string &p)
 

Protected Attributes

bool d_delete_cpp_stream_ptr = false
 

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 50 of file Response.h.

Constructor & Destructor Documentation

◆ Response() [1/4]

libdap::Response::Response ( )
default

◆ Response() [2/4]

libdap::Response::Response ( const Response & )
delete

◆ Response() [3/4]

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

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 85 of file Response.h.

◆ Response() [4/4]

libdap::Response::Response ( std::fstream * s,
int status = 0 )
inlineexplicit

Definition at line 87 of file Response.h.

◆ ~Response()

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

Close the stream.

Definition at line 90 of file Response.h.

Member Function Documentation

◆ get_cpp_stream()

virtual std::istream * libdap::Response::get_cpp_stream ( ) const
inlinevirtual

Reimplemented in libdap::StdinResponse.

Definition at line 104 of file Response.h.

◆ get_protocol()

virtual std::string libdap::Response::get_protocol ( ) const
inlinevirtual

Definition at line 108 of file Response.h.

◆ get_status()

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

Definition at line 102 of file Response.h.

◆ get_stream()

virtual FILE * libdap::Response::get_stream ( ) const
inlinevirtual

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

Definition at line 103 of file Response.h.

◆ get_type()

virtual ObjectType libdap::Response::get_type ( ) const
inlinevirtual

Definition at line 106 of file Response.h.

◆ get_version()

virtual std::string libdap::Response::get_version ( ) const
inlinevirtual

Definition at line 107 of file Response.h.

◆ operator=()

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

◆ set_cpp_stream()

virtual void libdap::Response::set_cpp_stream ( std::istream * s)
inlinevirtual

Reimplemented in libdap::StdinResponse.

Definition at line 116 of file Response.h.

◆ set_protocol()

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

Definition at line 120 of file Response.h.

◆ set_status()

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

Definition at line 113 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 115 of file Response.h.

◆ set_type()

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

Definition at line 118 of file Response.h.

◆ set_version()

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

Definition at line 119 of file Response.h.

Member Data Documentation

◆ d_delete_cpp_stream_ptr

bool libdap::Response::d_delete_cpp_stream_ptr = false
protected

Definition at line 67 of file Response.h.


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