libdap++
Updated for version 3.8.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Connect.h
Go to the documentation of this file.
1
2
// -*- mode: c++; c-basic-offset:4 -*-
3
4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5
// Access Protocol.
6
7
// Copyright (c) 2002,2003 OPeNDAP, Inc.
8
// Author: James Gallagher <jgallagher@opendap.org>
9
// Dan Holloway <dan@hollywood.gso.uri.edu>
10
// Reza Nekovei <reza@intcomm.net>
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
//
26
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
27
28
// (c) COPYRIGHT URI/MIT 1994-1999,2001,2002
29
// Please first read the full copyright statement in the file COPYRIGHT_URI.
30
//
31
// Authors:
32
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
33
// dan Dan Holloway <dholloway@gso.uri.edu>
34
// reza Reza Nekovei <rnekovei@ieee.org>
35
36
// Connect objects are used as containers for information pertaining to a
37
// connection that a user program makes to a dataset. The dataset may be
38
// either local (i.e., a file on the user's own computer) or a remote
39
// dataset. In the later case a DAP2 URL will be used to reference the
40
// dataset.
41
//
42
// Connect contains methods which can be used to read the DOS DAS and DDS
43
// objects from the remote dataset as well as reading reading data. The class
44
// understands in a rudimentary way how DAP2 constraint expressions are
45
// formed and how to manage the CEs generated by a API to request specific
46
// variables with the URL initially presented to the class when the object
47
// was instantiated.
48
//
49
// Connect also provides additional services such as error processing.
50
//
51
// Connect is not intended for use on the server-side.
52
//
53
// jhrg 9/29/94
54
55
#ifndef _connect_h
56
#define _connect_h
57
58
59
#include <string>
60
61
#ifndef _das_h
62
#include "
DAS.h
"
63
#endif
64
65
#ifndef _dds_h
66
#include "
DDS.h
"
67
#endif
68
69
#ifndef _error_h
70
#include "
Error.h
"
71
#endif
72
73
#ifndef _util_h
74
#include "
util.h
"
75
#endif
76
77
#ifndef _datadds_h
78
#include "
DataDDS.h
"
79
#endif
80
81
#ifndef _httpconnect_h
82
#include "
HTTPConnect.h
"
83
#endif
84
85
#ifndef response_h
86
#include "
Response.h
"
87
#endif
88
89
using
std::string;
90
91
namespace
libdap
92
{
93
129
class
Connect
130
{
131
private
:
132
bool
_local;
// Is this a local connection?
133
134
HTTPConnect
*d_http;
135
string
_URL;
// URL to remote dataset (minus CE)
136
string
_proj;
// Projection part of initial CE.
137
string
_sel;
// Selection of initial CE
138
139
string
d_version;
// Server implementation information
140
string
d_protocol;
// DAP protocol from the server
141
142
void
process_data(
DataDDS
&data,
Response
*rs);
143
// Use when you cannot use libwww/libcurl. Reads HTTP response.
144
void
parse_mime(
Response
*rs);
145
146
protected
:
149
Connect
() : d_http(0)
150
{ }
151
Connect
(
const
Connect
&) : d_http(0)
152
{ }
153
Connect
&
operator=
(
const
Connect
&)
154
{
155
throw
InternalErr
(__FILE__, __LINE__,
"Unimplemented assignment"
);
156
}
158
159
public
:
160
Connect
(
const
string
&name,
string
uname =
""
,
string
password =
""
)
161
throw(
Error
,
InternalErr
);
162
163
virtual ~
Connect
();
164
165
bool
is_local
();
166
167
// *** Add get_* versions of accessors. 02/27/03 jhrg
168
virtual
string
URL
(
bool
CE
= true);
169
virtual
string
CE
();
170
171
void
set_credentials
(
string
u,
string
p);
172
void
set_accept_deflate
(
bool
deflate
);
173
void
set_xdap_protocol
(
int
major,
int
minor);
174
175
void
set_cache_enabled
(
bool
enabled);
176
bool
is_cache_enabled
();
177
178
void
set_xdap_accept
(
int
major,
int
minor);
179
189
string
get_version
()
190
{
191
return
d_version;
192
}
193
197
string
get_protocol
()
198
{
199
return
d_protocol;
200
}
201
202
virtual
string
request_version
();
203
virtual
string
request_protocol
();
204
205
virtual
void
request_das
(
DAS
&das);
206
virtual
void
request_das_url
(
DAS
&das);
207
208
virtual
void
request_dds
(
DDS
&dds,
string
expr =
""
);
209
virtual
void
request_dds_url
(
DDS
&dds);
210
211
virtual
void
request_ddx
(
DDS
&dds,
string
expr =
""
);
212
virtual
void
request_ddx_url
(
DDS
&dds);
213
214
virtual
void
request_data
(
DataDDS
&data,
string
expr =
""
);
215
virtual
void
request_data_url
(
DataDDS
&data);
216
217
virtual
void
request_data_ddx
(
DataDDS
&data,
string
expr =
""
);
218
virtual
void
request_data_ddx_url
(
DataDDS
&data);
219
220
virtual
void
read_data
(
DataDDS
&data,
Response
*rs);
221
virtual
void
read_data_no_mime
(
DataDDS
&data,
Response
*rs);
222
};
223
224
}
// namespace libdap
225
226
#endif // _connect_h
Connect.h
Generated by
1.8.1.1