00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef NITFTREPARSERSHELL_H 00011 #define NITFTREPARSERSHELL_H 00012 00013 #include "PlugInShell.h" 00014 #include "Testable.h" 00015 #include "NitfTreParser.h" 00016 00017 namespace Nitf 00018 { 00019 00020 /** 00021 * \ingroup ShellModule 00022 * This class is a shell for a tre parer plug-in. 00023 * 00024 * TreParser developers should take this class and extend it to support their 00025 * importer specific code. 00026 */ 00027 class TreParserShell : public PlugInShell, public Testable, public TreParser 00028 { 00029 public: 00030 TreParserShell(); 00031 ~TreParserShell(); 00032 00033 // PlugIn 00034 /** 00035 * @copydoc PlugIn::getShortDescription() 00036 * 00037 * @default The default implementation returns a 00038 * general description based on the results of getName(). 00039 */ 00040 std::string getShortDescription() const; 00041 00042 // Testable 00043 /** 00044 * @copydoc Testable::runOperationalTests() 00045 * 00046 * @default The default implementation returns true, 00047 * since most TreParser plug-ins will not 00048 * require operational tests. 00049 */ 00050 bool runOperationalTests(Progress* pProgress, std::ostream& failure); 00051 00052 // TreParser 00053 /** 00054 * @copydoc Nitf::TreParser::isTreValid() 00055 * 00056 * @default The default implementation returns TreState::UNTESTED. 00057 */ 00058 TreState isTreValid(const DynamicObject& tre, std::ostream& reporter) const; 00059 00060 /** 00061 * @copydoc Nitf::TreParser::ossimTagToDynamicObject(const ossimNitfRegisteredTag&, DynamicObject&, std::string&) const 00062 * 00063 * @default The default implementation returns false, 00064 * so that developers only need to override 00065 * those methods they wish to implement. 00066 */ 00067 bool ossimTagToDynamicObject(const ossimNitfRegisteredTag& input, DynamicObject& output, 00068 std::string& errorMessage) const; 00069 00070 /** 00071 * @copydoc Nitf::TreParser::toDynamicObject(std::istream&, size_t, DynamicObject&, std::string&) const 00072 * 00073 * @default The default implementation returns false, 00074 * so that developers only need to override 00075 * those methods they wish to implement. 00076 */ 00077 bool toDynamicObject(std::istream& input, size_t numBytes, DynamicObject& output, 00078 std::string& errorMessage) const; 00079 00080 /** 00081 * @copydoc Nitf::TreParser::ossimTagFromDynamicObject(const DynamicObject&, ossimNitfRegisteredTag&, std::string&) const 00082 * 00083 * @default The default implementation returns false, 00084 * so that developers only need to override 00085 * those methods they wish to implement. 00086 */ 00087 bool ossimTagFromDynamicObject(const DynamicObject& input, ossimNitfRegisteredTag& tre, 00088 std::string& errorMessage) const; 00089 00090 /** 00091 * @copydoc Nitf::TreParser::fromDynamicObject(const DynamicObject&, std::ostream&, size_t&, std::string&) const 00092 * 00093 * @default The default implementation returns false, 00094 * so that developers only need to override 00095 * those methods they wish to implement. 00096 */ 00097 bool fromDynamicObject(const DynamicObject& input, std::ostream& output, size_t& numBytesWritten, 00098 std::string &errorMessage) const; 00099 00100 /** 00101 * @copydoc Nitf::TreParser::importMetadata(const DynamicObject&, RasterDataDescriptor&, std::string&) const 00102 * 00103 * @default The default implementation returns false, 00104 * so that developers only need to override 00105 * those methods they wish to implement. 00106 */ 00107 bool importMetadata(const DynamicObject& tre, RasterDataDescriptor& descriptor, 00108 std::string& errorMessage) const; 00109 00110 /** 00111 * @copydoc Nitf::TreParser::exportMetadata(const RasterDataDescriptor&, const RasterFileDescriptor&, DynamicObject&, unsigned int&, std::string&, std::string&) const 00112 * 00113 * @default The default implementation returns #UNCHANGED, 00114 * so that developers only need to override 00115 * those methods they wish to implement. Note that 00116 * if a subclass wishes to reimplement this function, 00117 * the subclass should use CreateOnExportSubtype(). 00118 */ 00119 TreExportStatus exportMetadata(const RasterDataDescriptor& descriptor, 00120 const RasterFileDescriptor& exportDescriptor, DynamicObject& tre, 00121 unsigned int& ownerIndex, std::string& tagType, std::string& errorMessage) const; 00122 }; 00123 } 00124 00125 #endif