DODSFilter.h
// -*- mode: c++; c-basic-offset:4 -*-
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.
// Copyright (c) 2002,2003 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
// (c) COPYRIGHT URI/MIT 1997-1999
// Please first read the full copyright statement in the file COPYRIGHT_URI.
//
// Authors:
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
#ifndef _dodsfilter_h
#define _dodsfilter_h
#include <string>
#ifndef _das_h
#include "DAS.h"
#endif
#ifndef _dds_h
#include "DDS.h"
#endif
#ifndef constraint_evaluator_h
#include "ConstraintEvaluator.h"
#endif
namespace libdap {
class DODSFilter {
public:
enum Response {
Unknown_Response,
DAS_Response,
DDS_Response,
DataDDS_Response,
DDX_Response,
DataDDX_Response,
BLOB_Response,
Version_Response
};
protected:
bool d_comp; // True if the output should be compressed.
bool d_bad_options; // True if the options (argc,argv) are bad.
bool d_conditional_request;
string d_program_name; // Name of the filter program
string d_dataset; // Name of the dataset/database
string d_dap2ce; // DAP2 Constraint expression
string d_cgi_ver; // Version of CGI script (caller)
string d_anc_dir; // Look here for ancillary files
string d_anc_file; // Use this for ancillary file name
string d_cache_dir; // Use this for cache files
string d_url; // URL minus CE.
Response d_response; // enum name of the response to generate
string d_action; // string name of the response to generate
int d_timeout; // Server timeout after N seconds
time_t d_anc_das_lmt; // Last modified time of the anc. DAS.
time_t d_anc_dds_lmt; // Last modified time of the anc. DDS.
time_t d_if_modified_since; // Time from a conditional request.
void initialize();
void initialize(int argc, char *argv[]);
virtual int process_options(int argc, char *argv[]);
public:
DODSFilter() { initialize(); }
DODSFilter(int argc, char *argv[]);
virtual ~DODSFilter();
virtual bool is_conditional() const;
virtual string get_cgi_version() const;
virtual void set_cgi_version(string version);
virtual string get_ce() const;
virtual void set_ce(string _ce);
virtual string get_dataset_name() const;
virtual void set_dataset_name(const string _dataset);
virtual string get_URL() const;
virtual void set_URL(const string &url);
virtual string get_dataset_version() const;
virtual Response get_response() const;
virtual string get_action() const;
virtual void set_response(const string &r);
virtual time_t get_dataset_last_modified_time() const;
virtual time_t get_das_last_modified_time(const string &anc_location = "") const;
virtual time_t get_dds_last_modified_time(const string &anc_location = "") const;
virtual time_t get_data_last_modified_time(const string &anc_location = "") const;
virtual time_t get_request_if_modified_since() const;
virtual string get_cache_dir() const;
void set_timeout(int timeout = 0);
int get_timeout() const;
virtual void establish_timeout(ostream &stream) const;
virtual void print_usage() const;
virtual void send_version_info() const;
virtual void send_das(DAS &das, const string &anc_location = "", bool with_mime_headers = true) const;
virtual void send_das(ostream &out, DAS &das, const string &anc_location = "", bool with_mime_headers = true) const;
virtual void send_dds(DDS &dds, ConstraintEvaluator &eval, bool constrained = false,
const string &anc_location = "", bool with_mime_headers = true) const;
virtual void send_dds(ostream &out, DDS &dds, ConstraintEvaluator &eval, bool constrained = false,
const string &anc_location = "", bool with_mime_headers = true) const;
// deprecated
virtual void functional_constraint(BaseType &var, DDS &dds, ConstraintEvaluator &eval, ostream &out) const;
virtual void dataset_constraint(DDS &dds, ConstraintEvaluator &eval, ostream &out, bool ce_eval = true) const;
virtual void dataset_constraint_ddx(DDS &dds, ConstraintEvaluator &eval, ostream &out, const string &boundary,
const string &start, bool ce_eval = true) const;
virtual void send_data(DDS &dds, ConstraintEvaluator &eval, ostream &data_stream, const string &anc_location = "",
bool with_mime_headers = true) const;
virtual void send_ddx(DDS &dds, ConstraintEvaluator &eval, ostream &out, bool with_mime_headers = true) const;
virtual void send_data_ddx(DDS &dds, ConstraintEvaluator &eval, ostream &data_stream, const string &start,
const string &boundary, const string &anc_location = "",
bool with_mime_headers = true) const;
virtual void establish_timeout(FILE *stream) const;
virtual void send_das(FILE *out, DAS &das, const string &anc_location = "", bool with_mime_headers = true) const;
virtual void send_dds(FILE *out, DDS &dds, ConstraintEvaluator &eval, bool constrained = false,
const string &anc_location = "", bool with_mime_headers = true) const;
// deprecated
virtual void functional_constraint(BaseType &var, DDS &dds, ConstraintEvaluator &eval, FILE *out) const;
virtual void dataset_constraint(DDS &dds, ConstraintEvaluator &eval, FILE *out, bool ce_eval = true) const;
virtual void send_data(DDS &dds, ConstraintEvaluator &eval, FILE *data_stream, const string &anc_location = "",
bool with_mime_headers = true) const;
virtual void send_ddx(DDS &dds, ConstraintEvaluator &eval, FILE *out, bool with_mime_headers = true) const;
};
} // namespace libdap
#endif // _dodsfilter_h
libdap::BaseType
The basic data type for the DODS DAP types.
Definition BaseType.h:118
libdap::ConstraintEvaluator
Evaluate a constraint expression.
Definition ConstraintEvaluator.h:41
libdap::DAS
Hold attribute data for a DAP2 dataset.
Definition DAS.h:119
libdap::DDS
Definition DDS.h:176
libdap::DODSFilter
Common functions for DODS server filter programs.
Definition DODSFilter.h:77
libdap::DODSFilter::get_ce
virtual string get_ce() const
Get the constraint expression.
Definition DODSFilter.cc:345
libdap::DODSFilter::send_data
virtual void send_data(DDS &dds, ConstraintEvaluator &eval, ostream &data_stream, const string &anc_location="", bool with_mime_headers=true) const
Transmit data.
Definition DODSFilter.cc:837
libdap::DODSFilter::get_dds_last_modified_time
virtual time_t get_dds_last_modified_time(const string &anc_location="") const
Definition DODSFilter.cc:467
libdap::DODSFilter::get_response
virtual Response get_response() const
Definition DODSFilter.cc:414
libdap::DODSFilter::get_dataset_last_modified_time
virtual time_t get_dataset_last_modified_time() const
Definition DODSFilter.cc:439
libdap::DODSFilter::process_options
virtual int process_options(int argc, char *argv[])
Definition DODSFilter.cc:254
libdap::DODSFilter::set_URL
virtual void set_URL(const string &url)
Definition DODSFilter.cc:368
libdap::DODSFilter::get_action
virtual string get_action() const
Definition DODSFilter.cc:417
libdap::DODSFilter::initialize
void initialize()
Definition DODSFilter.cc:188
libdap::DODSFilter::set_timeout
void set_timeout(int timeout=0)
Definition DODSFilter.cc:528
libdap::DODSFilter::Response
Response
Definition DODSFilter.h:80
libdap::DODSFilter::print_usage
virtual void print_usage() const
Print usage information for a filter program.
Definition DODSFilter.cc:578
libdap::DODSFilter::get_dataset_version
virtual string get_dataset_version() const
Get the version information for the dataset.
Definition DODSFilter.cc:382
libdap::DODSFilter::DODSFilter
DODSFilter()
Definition DODSFilter.h:127
libdap::DODSFilter::is_conditional
virtual bool is_conditional() const
Is this request conditional?
Definition DODSFilter.cc:315
libdap::DODSFilter::get_dataset_name
virtual string get_dataset_name() const
Get the dataset name.
Definition DODSFilter.cc:357
libdap::DODSFilter::send_ddx
virtual void send_ddx(DDS &dds, ConstraintEvaluator &eval, ostream &out, bool with_mime_headers=true) const
Definition DODSFilter.cc:922
libdap::DODSFilter::get_cgi_version
virtual string get_cgi_version() const
Definition DODSFilter.cc:337
libdap::DODSFilter::send_version_info
virtual void send_version_info() const
Send version information back to the client program.
Definition DODSFilter.cc:590
libdap::DODSFilter::send_data_ddx
virtual void send_data_ddx(DDS &dds, ConstraintEvaluator &eval, ostream &data_stream, const string &start, const string &boundary, const string &anc_location="", bool with_mime_headers=true) const
Transmit data.
Definition DODSFilter.cc:966
libdap::DODSFilter::set_response
virtual void set_response(const string &r)
Definition DODSFilter.cc:390
libdap::DODSFilter::get_URL
virtual string get_URL() const
Definition DODSFilter.cc:364
libdap::DODSFilter::set_cgi_version
virtual void set_cgi_version(string version)
Definition DODSFilter.cc:330
libdap::DODSFilter::get_timeout
int get_timeout() const
Definition DODSFilter.cc:531
libdap::DODSFilter::get_cache_dir
virtual string get_cache_dir() const
Get the cache directory.
Definition DODSFilter.cc:522
libdap::DODSFilter::get_das_last_modified_time
virtual time_t get_das_last_modified_time(const string &anc_location="") const
Definition DODSFilter.cc:450
libdap::DODSFilter::get_request_if_modified_since
virtual time_t get_request_if_modified_since() const
Definition DODSFilter.cc:514
libdap::DODSFilter::get_data_last_modified_time
virtual time_t get_data_last_modified_time(const string &anc_location="") const
Definition DODSFilter.cc:490
libdap::Response
Definition Response.h:52
libdap
top level DAP object to house generic methods
Definition AlarmHandler.h:35