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 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26 // (c) COPYRIGHT URI/MIT 1995-1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31
32 // Implementation for TestUrl. See TestByte.cc
33 //
34 // jhrg 1/12/95
35
36
37 #include "config.h"
38
39 #include <string>
40
41 #ifndef WIN32
42 #include <unistd.h>
43 #else
44 #include <io.h>
45 #include <fcntl.h>
46 #include <process.h>
47 #endif
48
49 #include "TestUrl.h"
50
51 extern int test_variable_sleep_interval;
52
53 void
_duplicate(const TestUrl & ts)54 TestUrl::_duplicate(const TestUrl &ts)
55 {
56 d_series_values = ts.d_series_values;
57 }
58
TestUrl(const string & n)59 TestUrl::TestUrl(const string &n) : Url(n), d_series_values(false)
60 {
61 }
62
TestUrl(const string & n,const string &)63 TestUrl::TestUrl(const string &n, const string &)
64 : Url(n), d_series_values(false)
65 {
66 }
67
TestUrl(const TestUrl & rhs)68 TestUrl::TestUrl(const TestUrl &rhs) : Url(rhs), TestCommon(rhs)
69 {
70 _duplicate(rhs);
71 }
72
73 TestUrl &
operator =(const TestUrl & rhs)74 TestUrl::operator=(const TestUrl &rhs)
75 {
76 if (this == &rhs)
77 return *this;
78
79 dynamic_cast<Url &>(*this) = rhs; // run Constructor=
80
81 _duplicate(rhs);
82
83 return *this;
84 }
85
86 BaseType *
ptr_duplicate()87 TestUrl::ptr_duplicate()
88 {
89 return new TestUrl(*this);
90 }
91
92 void
output_values(std::ostream & out)93 TestUrl::output_values(std::ostream &out)
94 {
95 print_val(out, "", false);
96 }
97
98 bool
read()99 TestUrl::read()
100 {
101 if (read_p())
102 return true;
103
104 if (test_variable_sleep_interval > 0)
105 sleep(test_variable_sleep_interval);
106
107 string url_test="http://dcz.gso.uri.edu/avhrr-archive/archive.html";
108
109 val2buf(&url_test);
110
111 set_read_p(true);
112
113 return true;
114 }
115