OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimPngPluginInit.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: See top level LICENSE.txt file
4 //
5 // Author: David Burken
6 //
7 // Description: OSSIM Portable Network Graphics (PNG) plugin initialization
8 // code.
9 //
10 //----------------------------------------------------------------------------
11 // $Id: ossimPngPluginInit.cpp 22998 2014-11-23 21:38:13Z gpotts $
12 
15 #include "ossimPngReaderFactory.h"
16 #include "ossimPngWriterFactory.h"
17 #include "ossimPngCodecFactory.h"
21 
22 extern "C"
23 {
24  static ossimSharedObjectInfo myPngInfo;
25  static ossimString thePngDescription;
26  static std::vector<ossimString> thePngObjList;
27 
28  static const char* getPngDescription()
29  {
30  if (thePngDescription.empty())
31  {
32  thePngDescription = "PNG reader / writer plugin.\n";
33  }
34  return thePngDescription.c_str();
35  }
36 
37  static int getPngNumberOfClassNames()
38  {
39  return (int)thePngObjList.size();
40  }
41 
42  static const char* getPngClassName(int idx)
43  {
44  if(idx < (int)thePngObjList.size())
45  {
46  return thePngObjList[idx].c_str();
47  }
48  return (const char*)0;
49  }
50 
51  /* Note symbols need to be exported on windoze... */
53  const char* /*options*/)
54  {
55  thePngObjList.push_back("ossimPngReader");
56  thePngObjList.push_back("ossimPngWriter");
57  thePngObjList.push_back("ossimPngCodec");
58 
59  myPngInfo.getDescription = getPngDescription;
60  myPngInfo.getNumberOfClassNames = getPngNumberOfClassNames;
61  myPngInfo.getClassName = getPngClassName;
62 
63  *info = &myPngInfo;
64 
65  /* Register the readers... */
67  registerFactory(ossimPngReaderFactory::instance());
68 
69  /* Register the writers... */
71  registerFactory(ossimPngWriterFactory::instance());
72 
74 
78 
79  }
80 
81  /* Note symbols need to be exported on windoze... */
83  {
85  unregisterFactory(ossimPngReaderFactory::instance());
86 
88  unregisterFactory(ossimPngWriterFactory::instance());
89 
91  }
92 }
static ossimCodecFactoryRegistry * instance()
static ossimPngCodecFactory * instance()
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Adds "ossimPngWriter" to list.
static ossimImageWriterFactoryRegistry * instance()
ossimSharedLibraryGetNumberOfClassNamesPtr getNumberOfClassNames
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Adds ossimPngWriter to the typeList.
OSSIM_PLUGINS_DLL void ossimSharedLibraryInitialize(ossimSharedObjectInfo **info, const char *)
void unregisterFactory(T *factory)
Will remove the factory from the registry.
ossimSharedLibraryGetDescriptionPtr getDescription
#define OSSIM_PLUGINS_DLL
void registerFactory(T *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.
static ossimPngReaderFactory * instance()
static method to return instance (the only one) of this class.
ossimSharedLibraryGetClassNamesPtr getClassName
virtual void getTypeNameList(std::vector< ossimString > &typeNames) const
OSSIM_PLUGINS_DLL void ossimSharedLibraryFinalize()
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
static ossimImageHandlerRegistry * instance()
static ossimPngWriterFactory * instance()
static method to return instance (the only one) of this class.