MrSID Decode SDK for Raster Reference Manual  9.5.4.4709
Segment.h
Go to the documentation of this file.
00001 /* //////////////////////////////////////////////////////////////////////////
00002 //                                                                         //
00003 // This code is Copyright (c) 2010 LizardTech, Inc, 1008 Western Avenue,   //
00004 // Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
00005 // prohibited.  Access to and use of this code is permitted only under     //
00006 // license from LizardTech, Inc.  Portions of the code are protected by    //
00007 // US and foreign patents and other filings. All Rights Reserved.          //
00008 //                                                                         //
00010 /* PUBLIC */
00011 
00012 #ifndef Segment_H
00013 #define Segment_H
00014 
00015 // lt_lib_base
00016 #include "lt_base.h"
00017 
00018 // lt_lib_mrsid_nitf
00019 #include "nitf_types.h"
00020 
00021 
00022 LT_BEGIN_LIZARDTECH_NAMESPACE
00023 class LTIOStreamInf;
00024 class LTIMetadataDatabase;
00025 class NITFReaderManager;
00026 
00027 namespace Nitf {
00028 class SecurityBlock;
00029 class FieldReader;
00030 class FileHeader;
00031 class MetadataHelper;
00032 class SecurityMetadata;
00033 class TREData;
00034 
00035 
00042 class Segment
00043 {
00044 public:
00045    // not for public use
00046    Segment(NITFReaderManager&, LTIOStreamInf&,
00047            lt_int64 headerOffset, lt_int64 headerLength,
00048            lt_int64 dataOffset, lt_int64 dataLength,
00049            const char* code, int segmentNumber,
00050            bool doUserSubheader, bool doExtendedSubheader);
00051 
00052    // not for public use
00053    virtual ~Segment();
00054 
00062    virtual LT_STATUS initialize();
00063 
00064    int getSegmentNumber() const;
00065    const char* getSegmentID();
00066 
00067    // not for public use
00068    lt_int64 getHeaderOffset() const;
00069 
00070    // not for public use
00071    lt_int64 getHeaderLength() const;
00072 
00073    // not for public use
00074    lt_int64 getDataOffset() const;
00075 
00076    // not for public use
00077    lt_int64 getDataLength() const;
00078 
00079    // not for public use
00080    const SecurityBlock* getSecurityBlock() const;
00081 
00085    const SecurityMetadata* getSecurityMetadata() const;
00086 
00087    // not for public use
00088    virtual LT_STATUS addMetadata(LTIMetadataDatabase&) const;
00089 
00090    // not for public use
00091    const char* getMetadataTagPrefix() const;
00092 
00096    int getNumTREs() const;
00097 
00106    const TREData* getTRE(int index) const;
00107 
00108 protected:
00109    virtual LT_STATUS readHeader() = 0;
00110    virtual LT_STATUS readData() = 0;
00111 
00112    virtual LT_STATUS addMetadataLocal(LTIMetadataDatabase&) const =0;
00113 
00114    MetadataHelper* m_mdHelper;
00115 
00116    FieldReader* m_field;
00117 
00118    LTIOStreamInf& m_stream;
00119    const lt_int64 m_headerOffset;
00120    lt_int64 m_headerLength;  // not const, because FileHeader length not known
00121    const lt_int64 m_dataOffset;
00122    const lt_int64 m_dataLength;
00123 
00124    NITFReaderManager& m_manager;
00125    Version m_version;
00126 
00127    SecurityBlock* m_securityBlock;
00128 
00129    const int m_segmentNumber;
00130    const char* m_segmentID;
00131 
00132 private:
00133    void addTREChunk(const lt_uint8* bytes, int length);
00134    void addTRE(const char* tag, const lt_uint8* bytes, int length);
00135    TREData** m_treData;
00136    int m_treCount;
00137 
00138    LT_STATUS readExtFields();
00139    LT_STATUS processTREs();
00140 
00141    const char* m_code;
00142 
00143    const bool m_doUserSubheader;
00144    const bool m_doExtendedSubheader;
00145    lt_int64 m_offsetUD;
00146    lt_int64 m_lenUD;
00147    int m_overflowUD;
00148    lt_int64 m_offsetX;
00149    lt_int64 m_lenX;
00150    int m_overflowX;
00151 
00152    char* m_tagPrefix;
00153 
00154    // nope
00155    Segment(Segment&);
00156    Segment& operator=(const Segment&);
00157 };
00158 
00159 
00160 }
00161 LT_END_LIZARDTECH_NAMESPACE
00162 
00163 #endif // Segment_H