OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ossim::CurlStreamFactory Class Reference

#include <ossimCurlStreamFactory.h>

Inheritance diagram for ossim::CurlStreamFactory:
ossim::StreamFactoryBase

Public Member Functions

virtual ~CurlStreamFactory ()
 
virtual std::shared_ptr< ossim::istreamcreateIstream (const std::string &connectionString, const ossimKeywordlist &options, std::ios_base::openmode openMode) const
 
virtual std::shared_ptr< ossim::ostreamcreateOstream (const std::string &connectionString, const ossimKeywordlist &options, std::ios_base::openmode openMode) const
 
virtual std::shared_ptr< ossim::iostreamcreateIOstream (const std::string &connectionString, const ossimKeywordlist &options, std::ios_base::openmode openMode) const
 
virtual bool exists (const std::string &connectionString, bool &continueFlag) const
 Methods to test if connection exists. More...
 
- Public Member Functions inherited from ossim::StreamFactoryBase
virtual ~StreamFactoryBase ()
 

Static Public Member Functions

static CurlStreamFactoryinstance ()
 

Protected Member Functions

 CurlStreamFactory ()
 
 CurlStreamFactory (const CurlStreamFactory &)
 

Protected Attributes

ossimCurlHttpRequest m_curlHttpRequest
 

Static Protected Attributes

static CurlStreamFactorym_instance = 0
 

Detailed Description

Definition at line 20 of file ossimCurlStreamFactory.h.

Constructor & Destructor Documentation

◆ ~CurlStreamFactory()

ossim::CurlStreamFactory::~CurlStreamFactory ( )
virtual

Definition at line 20 of file ossimCurlStreamFactory.cpp.

21 {
22 }

◆ CurlStreamFactory() [1/2]

ossim::CurlStreamFactory::CurlStreamFactory ( )
protected

Definition at line 113 of file ossimCurlStreamFactory.cpp.

115 {
116 }
ossimCurlHttpRequest m_curlHttpRequest

◆ CurlStreamFactory() [2/2]

ossim::CurlStreamFactory::CurlStreamFactory ( const CurlStreamFactory )
protected

Definition at line 119 of file ossimCurlStreamFactory.cpp.

121 {
122 }
ossimCurlHttpRequest m_curlHttpRequest

Member Function Documentation

◆ createIOstream()

std::shared_ptr< ossim::iostream > ossim::CurlStreamFactory::createIOstream ( const std::string &  connectionString,
const ossimKeywordlist options,
std::ios_base::openmode  openMode 
) const
virtual

Implements ossim::StreamFactoryBase.

Definition at line 77 of file ossimCurlStreamFactory.cpp.

81 {
82  return std::shared_ptr<ossim::iostream>(0);
83 }

◆ createIstream()

std::shared_ptr< ossim::istream > ossim::CurlStreamFactory::createIstream ( const std::string &  connectionString,
const ossimKeywordlist options,
std::ios_base::openmode  openMode 
) const
virtual

Implements ossim::StreamFactoryBase.

Definition at line 34 of file ossimCurlStreamFactory.cpp.

38 {
39  //std::cout << "ossim::CurlStreamFactory::createIstream............Entered\n";
40  std::shared_ptr<ossim::CurlIStream> result = std::make_shared<ossim::CurlIStream>();
41  if(traceDebug())
42  {
43  ossimNotify(ossimNotifyLevel_WARN) << "ossim::AwsStreamFactory::createIstream: Entered...............\n";
44  }
45  //---
46  // Hack for upstream code calling ossimFilename::convertToNative()
47  // wrecking s3 url.
48  //---
49 #if defined(_WIN32)
50  ossimFilename f = connectionString;
51  f.convertBackToForwardSlashes();
52  result->open( f.string(), openMode) ;
53 #else
54  result->open( connectionString, openMode );
55 #endif
56 
57  if(!result->good())
58  {
59  result.reset();
60  }
61  if(traceDebug())
62  {
63  ossimNotify(ossimNotifyLevel_WARN) << "ossim::CurlStreamFactory::createIstream: Leaving...............\n";
64  }
65 
66  return result;
67 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ createOstream()

std::shared_ptr< ossim::ostream > ossim::CurlStreamFactory::createOstream ( const std::string &  connectionString,
const ossimKeywordlist options,
std::ios_base::openmode  openMode 
) const
virtual

Implements ossim::StreamFactoryBase.

Definition at line 69 of file ossimCurlStreamFactory.cpp.

73 {
74  return std::shared_ptr<ossim::ostream>(0);
75 }

◆ exists()

bool ossim::CurlStreamFactory::exists ( const std::string &  connectionString,
bool &  continueFlag 
) const
virtual

Methods to test if connection exists.

Parameters
connectionString
continueFlagInitializes by this, if set to false, indicates factory handles file/url and no more factory checks are necessary. If true, connection is not handled by this factory.
Returns
true on success, false, if not.

Implements ossim::StreamFactoryBase.

Definition at line 85 of file ossimCurlStreamFactory.cpp.

References ossimUrl::getProtocol(), and ossimHttpRequest::set().

87 {
88  bool result = false;
89  if ( connectionString.size() )
90  {
91  ossimUrl url(connectionString);
92 
93  if( (url.getProtocol() == "http") || (url.getProtocol() == "https") )
94  {
95  continueFlag = false; // Set to false to stop registry search.
96 
97  ossimKeywordlist header;
98  ossim_int64 filesize;
99  ossimCurlHttpRequest curlHttpRequest;
100  curlHttpRequest.set(url, header);
101  filesize = m_curlHttpRequest.getContentLength();
102  if ( filesize )
103  {
104  result = true;
105  }
106  }
107 
108  }
109  return result;
110 }
ossimCurlHttpRequest m_curlHttpRequest
Represents serializable keyword/value map.
ossim_int64 getContentLength() const
bool set(const ossimUrl &url, const ossimKeywordlist &headerOptions, HttpMethodType methodType=HTTP_METHOD_GET)
long long ossim_int64

◆ instance()

ossim::CurlStreamFactory * ossim::CurlStreamFactory::instance ( )
static

Definition at line 24 of file ossimCurlStreamFactory.cpp.

Referenced by ossimSharedLibraryInitialize().

25 {
26  if(!m_instance)
27  {
29  }
30 
31  return m_instance;
32 }
static CurlStreamFactory * m_instance

Member Data Documentation

◆ m_curlHttpRequest

ossimCurlHttpRequest ossim::CurlStreamFactory::m_curlHttpRequest
protected

Definition at line 60 of file ossimCurlStreamFactory.h.

◆ m_instance

ossim::CurlStreamFactory * ossim::CurlStreamFactory::m_instance = 0
staticprotected

Definition at line 62 of file ossimCurlStreamFactory.h.


The documentation for this class was generated from the following files: