Blame tests/D4ResponseBuilder.h

Packit a4aae4
Packit a4aae4
// -*- mode: c++; c-basic-offset:4 -*-
Packit a4aae4
Packit a4aae4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
Packit a4aae4
// Access Protocol.
Packit a4aae4
Packit a4aae4
// Copyright (c) 2011 OPeNDAP, Inc.
Packit a4aae4
// Author: James Gallagher <jgallagher@opendap.org>
Packit a4aae4
//
Packit a4aae4
// This library is free software; you can redistribute it and/or
Packit a4aae4
// modify it under the terms of the GNU Lesser General Public
Packit a4aae4
// License as published by the Free Software Foundation; either
Packit a4aae4
// version 2.1 of the License, or (at your option) any later version.
Packit a4aae4
//
Packit a4aae4
// This library is distributed in the hope that it will be useful,
Packit a4aae4
// but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a4aae4
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a4aae4
// Lesser General Public License for more details.
Packit a4aae4
//
Packit a4aae4
// You should have received a copy of the GNU Lesser General Public
Packit a4aae4
// License along with this library; if not, write to the Free Software
Packit a4aae4
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit a4aae4
//
Packit a4aae4
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
Packit a4aae4
Packit a4aae4
#ifndef _d4_response_builder_h
Packit a4aae4
#define _d4_response_builder_h
Packit a4aae4
Packit a4aae4
#include <string>
Packit a4aae4
Packit a4aae4
namespace libdap {
Packit a4aae4
Packit a4aae4
// class ConstraintEvaluator;
Packit a4aae4
class DDS;
Packit a4aae4
class DMR;
Packit a4aae4
Packit a4aae4
/**
Packit a4aae4
 * Used for testing only. This duplicates code in the bes/dap module.
Packit a4aae4
 * jhrg 6/11/13
Packit a4aae4
 *
Packit a4aae4
 * This has now been extended with DAP4 DMR and Data response code.
Packit a4aae4
 * jhrg 9/5/13
Packit a4aae4
 */
Packit a4aae4
Packit a4aae4
class D4ResponseBuilder
Packit a4aae4
{
Packit a4aae4
Packit a4aae4
protected:
Packit a4aae4
    std::string d_dataset;  		/// Name of the dataset/database
Packit a4aae4
    int d_timeout;  		/// Response timeout after N seconds
Packit a4aae4
    std::string d_default_protocol;	/// Version std::string for the library's default protocol version
Packit a4aae4
Packit a4aae4
    void initialize();
Packit a4aae4
Packit a4aae4
public:
Packit a4aae4
    /** Make an empty instance. Use the set_*() methods to load with needed
Packit a4aae4
        values. You must call at least set_dataset_name() or be requesting
Packit a4aae4
        version information. */
Packit a4aae4
    D4ResponseBuilder() { initialize();  }
Packit a4aae4
Packit a4aae4
    virtual ~D4ResponseBuilder();
Packit a4aae4
Packit a4aae4
    /** The dataset name is the filename or other string that the
Packit a4aae4
     filter program will use to access the data. In some cases this
Packit a4aae4
     will indicate a disk file containing the data.  In others, it
Packit a4aae4
     may represent a database query or some other exotic data
Packit a4aae4
     access method.
Packit a4aae4
Packit a4aae4
     @brief Get the dataset name.
Packit a4aae4
     @return A string object that contains the name of the dataset. */
Packit a4aae4
    virtual std::string get_dataset_name() const { return d_dataset; }
Packit a4aae4
    virtual void set_dataset_name(const std::string _dataset);
Packit a4aae4
Packit a4aae4
    // These are used for DAP4 testing by dmr-test.
Packit a4aae4
    virtual void establish_timeout(ostream &stream) const;
Packit a4aae4
    virtual void remove_timeout() const;
Packit a4aae4
Packit a4aae4
    virtual void send_dmr(std::ostream &out, DMR &dmr, bool with_mime_headers, bool constrained);
Packit a4aae4
    virtual void send_dap(std::ostream &out, DMR &dmr, bool with_mime_headers, bool constrained);
Packit a4aae4
};
Packit a4aae4
Packit a4aae4
} // namespace libdap
Packit a4aae4
Packit a4aae4
#endif // _response_builder_h