OTB  6.7.0
Orfeo Toolbox
otbCurlHelperInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbCurlHelperInterface_h
22 #define otbCurlHelperInterface_h
23 
24 #include <iosfwd>
25 #include "itkObject.h"
26 #include "itkObjectFactory.h"
27 #include "OTBCurlAdaptersExport.h"
28 
29 namespace otb
30 {
41 class OTBCurlAdapters_EXPORT CurlHelperInterface : public itk::Object
42 {
43 public:
44 
50 
51  itkTypeMacro(CurlHelperInterface, itk::Object);
52 
53  virtual bool TestUrlAvailability(const std::string& url) const = 0;
54 
55  virtual int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const = 0;
56 
57  virtual int RetrieveFile(const std::string& urlString, std::string filename) const = 0;
58 
59  virtual int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const = 0;
60 
61  virtual int RetrieveFileMulti(const std::vector<std::string>& listURLs,
62  const std::vector<std::string>& listFiles,
63  int maxConnect) const = 0;
64 
65  static bool IsCurlAvailable();
66  static bool IsCurlMultiAvailable();
67 
68 protected:
70  ~CurlHelperInterface() override {}
71 
72 private:
73  CurlHelperInterface(const Self &) = delete;
74  void operator =(const Self&) = delete;
75 
76 };
77 }
78 #endif
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
Class to use the curl capabilities from OTB.