OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimPngCodecFactory.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: David Burken
8 //
9 // Description: Factory class definition for codec(encoder/decoder).
10 //
11 //----------------------------------------------------------------------------
12 // $Id$
13 
14 #include "ossimPngCodecFactory.h"
17 #include <ossim/base/ossimRefPtr.h>
18 #include <ossim/base/ossimString.h>
20 
21 #include "ossimPngCodec.h"
22 
23 #include <string>
24 
26 
27 static const std::string TYPE_KW = "type";
28 
30 {}
31 
33 {
34  if ( !m_instance )
35  {
37  }
38  return m_instance;
39 }
41 {
43  ossimString tempType = type.downcase();
44  if(tempType == "png")
45  {
46  result = new ossimPngCodec();
47  }
48  else if(tempType == "pnga")
49  {
50  result = new ossimPngCodec(true);
51  }
52  else if(tempType == "ossimPngCodec")
53  {
54  result = new ossimPngCodec();
55  }
56 
57  return result.release();
58 }
59 
61 {
62  ossimString type = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
63  ossimCodecBase* result = 0;
64  if(!type.empty())
65  {
66  result = this->createCodec(type);
67  if(result)
68  {
69  result->loadState(kwl, prefix);
70  }
71  }
72 
73  return result;
74 }
75 
76 void ossimPngCodecFactory::getTypeNameList(std::vector<ossimString>& typeNames)const
77 {
78  typeNames.push_back("png");
79  typeNames.push_back("pnga");
80  typeNames.push_back("ossimPngCodec");
81 }
82 
84 {}
85 
87 {}
88 
90  const ossimPngCodecFactory& /* rhs */)
91 {
92  return *this;
93 }
static ossimPngCodecFactory * instance()
Represents serializable keyword/value map.
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
static const char * TYPE_KW
virtual ~ossimPngCodecFactory()
virtual destructor
ossimPngCodecFactory()
hidden from use default constructor
T * release()
Definition: ossimRefPtr.h:93
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
static ossimPngCodecFactory * m_instance
The single instance of this class.
const ossimPngCodecFactory & operator=(const ossimPngCodecFactory &rhs)
hidden from use operator =
virtual void getTypeNameList(std::vector< ossimString > &typeNames) const
bool empty() const
Definition: ossimString.h:411
virtual ossimCodecBase * createCodec(const ossimString &type) const
createCodec takes a type and will return a new codec to encode decode image buffers ...