00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef _connect_h
00056 #define _connect_h
00057
00058
00059 #include <string>
00060
00061 #ifndef _das_h
00062 #include "DAS.h"
00063 #endif
00064
00065 #ifndef _dds_h
00066 #include "DDS.h"
00067 #endif
00068
00069 #ifndef _error_h
00070 #include "Error.h"
00071 #endif
00072
00073 #ifndef _util_h
00074 #include "util.h"
00075 #endif
00076
00077 #ifndef _datadds_h
00078 #include "DataDDS.h"
00079 #endif
00080
00081 #ifndef _httpconnect_h
00082 #include "HTTPConnect.h"
00083 #endif
00084
00085 #ifndef response_h
00086 #include "Response.h"
00087 #endif
00088
00089 using std::string;
00090
00091 namespace libdap
00092 {
00093
00133 class Connect
00134 {
00135 private:
00136 bool _local;
00137
00138 HTTPConnect *d_http;
00139 string _URL;
00140 string _proj;
00141 string _sel;
00142
00143 string d_version;
00144 string d_protocol;
00145
00146 void process_data(DataDDS &data, Response *rs);
00147
00148
00149 void parse_mime(Response *rs);
00150
00151 protected:
00154 Connect()
00155 { }
00156 Connect(const Connect &)
00157 { }
00158 Connect &operator=(const Connect &)
00159 {
00160 throw InternalErr(__FILE__, __LINE__, "Unimplemented assignment");
00161 }
00163
00164 public:
00165 Connect(const string &name, string uname = "", string password = "")
00166 throw(Error, InternalErr);
00167
00168 virtual ~Connect();
00169
00170 bool is_local();
00171
00172
00173 virtual string URL(bool CE = true);
00174 virtual string CE();
00175
00176 void set_credentials(string u, string p);
00177 void set_accept_deflate(bool deflate);
00178
00179 void set_cache_enabled(bool enabled);
00180 bool is_cache_enabled();
00181
00191 string get_version()
00192 {
00193 return d_version;
00194 }
00195
00199 string get_protocol()
00200 {
00201 return d_protocol;
00202 }
00203
00204
00205 virtual string request_version();
00206 virtual string request_protocol();
00207
00208 virtual void request_das(DAS &das);
00209 virtual void request_das_url(DAS &das);
00210
00211 virtual void request_dds(DDS &dds, string expr = "");
00212 virtual void request_dds_url(DDS &dds);
00213
00214 virtual void request_ddx(DDS &dds, string expr = "");
00215 virtual void request_ddx_url(DDS &dds);
00216
00217 virtual void request_data(DataDDS &data, string expr = "");
00218 virtual void request_data_url(DataDDS &data);
00219
00220 virtual void read_data(DataDDS &data, Response *rs);
00221 virtual void read_data_no_mime(DataDDS &data, Response *rs);
00222 };
00223
00224 }
00225
00226 #endif // _connect_h