IODA Bundle
HttpHandle.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 // @file HttpHandle.h
12 // @author Piotr Kuchta - ECMWF 27 Oct 2016
13 
14 #ifndef eckit_filesystem_HttpFileHandle_h
15 #define eckit_filesystem_HttpFileHandle_h
16 
17 #include "eckit/io/TCPHandle.h"
18 
19 namespace odc {
20 
21 class HttpHandle : public eckit::DataHandle {
22 public:
23  HttpHandle(const std::string& url);
24  ~HttpHandle();
25 // -- Overridden methods
26  // From DataHandle
27  virtual eckit::Length openForRead();
28  virtual void openForWrite(const eckit::Length&);
29  virtual void openForAppend(const eckit::Length&);
30 
31  virtual long read(void*,long);
32  virtual long write(const void*,long);
33  virtual void close();
34  virtual void print(std::ostream&) const;
35 
36  // From Streamable
37  virtual void encode(eckit::Stream&) const;
38 
39  static std::string parseHost(const std::string&);
40  static int parsePort(const std::string&);
41 
42 private:
43  const std::string url_;
44  eckit::TCPHandle tcp_;
45 };
46 
47 } // namespace odc
48 
49 #endif
const std::string url_
Definition: HttpHandle.h:43
eckit::TCPHandle tcp_
Definition: HttpHandle.h:44
virtual eckit::Length openForRead()
Definition: HttpHandle.cc:51
HttpHandle(const std::string &url)
Definition: HttpHandle.cc:41
virtual void encode(eckit::Stream &) const
Definition: HttpHandle.cc:24
virtual void openForAppend(const eckit::Length &)
Definition: HttpHandle.cc:60
virtual void close()
Definition: HttpHandle.cc:78
static int parsePort(const std::string &)
Definition: HttpHandle.cc:35
static std::string parseHost(const std::string &)
Definition: HttpHandle.cc:29
virtual long write(const void *, long)
Definition: HttpHandle.cc:71
virtual void print(std::ostream &) const
Definition: HttpHandle.cc:19
virtual void openForWrite(const eckit::Length &)
Definition: HttpHandle.cc:56
virtual long read(void *, long)
Definition: HttpHandle.cc:64
Definition: ColumnInfo.h:23