OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfCodecFactory.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Description: Factory class declaration for codec(encoder/decoder).
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
13 
16 
18 {
19  m_instance = this;
20 }
21 
23 {
24  std::lock_guard<std::mutex> lock(m_mutex);
25  m_instance = 0;
26 }
27 
28 
30 {
31  std::lock_guard<std::mutex> lock(m_mutex);
32  if(!m_instance)
33  {
35  }
36 
37  return m_instance;
38 }
39 
41 {
42  ossimCodecBase* result=0;
43 
44  if(imageHeader.valid()&&imageHeader->isCompressed())
45  {
46  ossimKeywordlist kwl;
47 
48  imageHeader->saveState(kwl);
49  // rename the type to be a NITF IC compression type
50  // J2K should be C8
51  //
52  kwl.add("type", imageHeader->getCompressionCode().c_str(), true);
54  }
55 
56  return result;
57 }
static ossimCodecFactoryRegistry * instance()
This is a convenience class that is used by the NITF handler to create the proper keywordlist from th...
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
static ossimNitfCodecFactory * instance()
virtual bool saveState(ossimKeywordlist &kwl, const ossimString &prefix="") const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static ossimNitfCodecFactory * m_instance
virtual ossimCodecBase * createCodec(const ossimString &type) const
Will loop through all registered factories trying to allocate a codec for the passed in type...
virtual ossimString getCompressionCode() const =0
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
ossimCodecBase * createCodec(ossimRefPtr< ossimNitfImageHeader > imageHeader)
virtual bool isCompressed() const =0