OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimCodecFactory.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 
17 #include <ossim/base/ossimRefPtr.h>
18 #include <ossim/base/ossimString.h>
19 
21 
22 #include <string>
23 
25 
26 static const std::string TYPE_KW = "type";
27 
29 {}
30 
32 {
33  if ( !theInstance )
34  {
36  }
37  return theInstance;
38 }
40 {
42 
43  if((type.downcase() == "jpeg") ||
44  (type == "ossimJpegCodec"))
45  {
46  result = new ossimJpegCodec();
47  }
48 
49  return result.release();
50 }
51 
52 ossimCodecBase* ossimCodecFactory::createCodec(const ossimKeywordlist& kwl, const char* prefix)const
53 {
54  ossimString type = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
55  ossimCodecBase* result = 0;
56  if(!type.empty())
57  {
58  result = this->createCodec(type);
59  if(result)
60  {
61  result->loadState(kwl, prefix);
62  }
63  }
64 
65  return result;
66 }
67 
68 void ossimCodecFactory::getTypeNameList(std::vector<ossimString>& typeNames)const
69 {
70  typeNames.push_back("jpeg");
71 }
72 
74 {}
75 
77 {}
78 
80  const ossimCodecFactory& /* rhs */)
81 {
82  return *this;
83 }
Represents serializable keyword/value map.
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual void getTypeNameList(std::vector< ossimString > &typeNames) const
static const char * TYPE_KW
virtual ossimCodecBase * createCodec(const ossimString &type) const
createCodec takes a type and will return a new codec to encode decode image buffers ...
virtual ~ossimCodecFactory()
virtual destructor
const ossimCodecFactory & operator=(const ossimCodecFactory &rhs)
hidden from use operator =
T * release()
Definition: ossimRefPtr.h:93
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
static ossimCodecFactory * theInstance
The single instance of this class.
Codec factory.
ossimCodecFactory()
hidden from use default constructor
bool empty() const
Definition: ossimString.h:411
static ossimCodecFactory * instance()