MrSID Decode SDK for Raster Reference Manual  9.5.1.4427
Segment.h
Go to the documentation of this file.
1 /* //////////////////////////////////////////////////////////////////////////
2 // //
3 // This code is Copyright (c) 2010 LizardTech, Inc, 1008 Western Avenue, //
4 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
5 // prohibited. Access to and use of this code is permitted only under //
6 // license from LizardTech, Inc. Portions of the code are protected by //
7 // US and foreign patents and other filings. All Rights Reserved. //
8 // //
10 /* PUBLIC */
11 
12 #ifndef Segment_H
13 #define Segment_H
14 
15 // lt_lib_base
16 #include "lt_base.h"
17 
18 // lt_lib_mrsid_nitf
19 #include "nitf_types.h"
20 
21 
23 class LTIOStreamInf;
25 class NITFReaderManager;
26 
27 namespace Nitf {
28 class SecurityBlock;
29 class FieldReader;
30 class FileHeader;
31 class MetadataHelper;
32 class SecurityMetadata;
33 class TREData;
34 
35 
42 class Segment
43 {
44 public:
45  // not for public use
46  Segment(NITFReaderManager&, LTIOStreamInf&,
47  lt_int64 headerOffset, lt_int64 headerLength,
48  lt_int64 dataOffset, lt_int64 dataLength,
49  const char* code, int segmentNumber,
50  bool doUserSubheader, bool doExtendedSubheader);
51 
52  // not for public use
53  virtual ~Segment();
54 
62  virtual LT_STATUS initialize();
63 
64  int getSegmentNumber() const;
65  const char* getSegmentID();
66 
67  // not for public use
68  lt_int64 getHeaderOffset() const;
69 
70  // not for public use
71  lt_int64 getHeaderLength() const;
72 
73  // not for public use
74  lt_int64 getDataOffset() const;
75 
76  // not for public use
77  lt_int64 getDataLength() const;
78 
79  // not for public use
80  const SecurityBlock* getSecurityBlock() const;
81 
86 
87  // not for public use
89 
90  // not for public use
91  const char* getMetadataTagPrefix() const;
92 
96  int getNumTREs() const;
97 
106  const TREData* getTRE(int index) const;
107 
108 protected:
109  virtual LT_STATUS readHeader() = 0;
110  virtual LT_STATUS readData() = 0;
111 
113 
114  MetadataHelper* m_mdHelper;
115 
116  FieldReader* m_field;
117 
119  const lt_int64 m_headerOffset;
120  lt_int64 m_headerLength; // not const, because FileHeader length not known
121  const lt_int64 m_dataOffset;
122  const lt_int64 m_dataLength;
123 
124  NITFReaderManager& m_manager;
126 
128 
129  const int m_segmentNumber;
130  const char* m_segmentID;
131 
132 private:
133  void addTREChunk(const lt_uint8* bytes, int length);
134  void addTRE(const char* tag, const lt_uint8* bytes, int length);
135  TREData** m_treData;
136  int m_treCount;
137 
138  LT_STATUS readExtFields();
139  LT_STATUS processTREs();
140 
141  const char* m_code;
142 
143  const bool m_doUserSubheader;
144  const bool m_doExtendedSubheader;
145  lt_int64 m_offsetUD;
146  lt_int64 m_lenUD;
147  int m_overflowUD;
148  lt_int64 m_offsetX;
149  lt_int64 m_lenX;
150  int m_overflowX;
151 
152  char* m_tagPrefix;
153 
154  // nope
155  Segment(Segment&);
156  Segment& operator=(const Segment&);
157 };
158 
159 
160 }
162 
163 #endif // Segment_H

LizardTech