OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfTextHeaderV2_1.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 //
7 // Description: Nitf support class
8 //
9 //********************************************************************
10 // $Id$
11 
16 #include <ossim/base/ossimString.h>
17 #include <cstring> // for memset
18 #include <istream>
19 
20 RTTI_DEF1(ossimNitfTextHeaderV2_1, "ossimNitfTextHeaderV2_1", ossimNitfTextHeader)
21 
22 
49 
50 
52 {
53  clearFields();
54 }
55 
57 {
58 }
59 
61 {
62  if(in)
63  {
64  clearFields();
65 
66  in.read(theFilePartType, 2);
67  in.read(theTextId, 7);
68  in.read(theTextAttLevel, 3);
69  in.read(theDataAndTime, 14);
70  in.read(theTextTitle, 80);
72  // If text class is T,S,C, or R, need to have TSCLSY populated with valid code
73  in.read(theTextSecuritySystem, 2);
74  in.read(theTextCodewords, 11);
75  in.read(theTextControlAndHandling, 2);
76  in.read(theTextReleasingInstructions, 20);
77  in.read(theTextDeclassificationType, 2);
78  in.read(theTextDeclassificationDate, 8);
80  in.read(theTextSecurityDowngrade, 2);
81  in.read(theTextSecurityDowngradeDate, 8);
82  in.read(theTextClassificationText, 43); // TSCLTX
83  in.read(theTextClassificationAthorityType, 1); // TSCATP
84  in.read(theTextClassificationAthority, 40); // TSCAUT
85  in.read(theTextClassificationReason, 1); // TSCRSN
86  in.read(theTextSecuritySourceDate, 8); // TSSRDT
87  in.read(theTextSecurityControlNumber, 15); // TSCTLN
88 
89  in.read(theTextEncyption, 1);
90  in.read(theTextFormat, 3);
91  in.read(theExtSubheaderDataLength, 5);
92  long dataLength = ossimString(theExtSubheaderDataLength).toLong();
93  if(dataLength > 0)
94  {
95  in.read(theExtSubheaderOverflow, 3);
96 
97  // ignore the data for now
98  in.ignore(dataLength - 3);
99  }
100  }
101 }
102 
104 {
105  out << "theFilePartType: " << theFilePartType
106  << "\ntheTextId: " << theTextId
107  << "\ntheTextAttLevel: " << theTextAttLevel
108  << "\ntheDataAndTime: " << theDataAndTime
109  << "\ntheTextTitle: " << theTextTitle
110  << "\ntheTextSecurityClassification: " << theTextSecurityClassification
111  << "\ntheTextSecuritySystem: " << theTextSecuritySystem
112  << "\ntheTextCodewords: " << theTextCodewords
113  << "\ntheTextControlAndHandling: " << theTextControlAndHandling
114  << "\ntheTextReleasingInstructions: " << theTextReleasingInstructions
115  << "\ntheTextDeclassificationType: " << theTextDeclassificationType
116  << "\ntheTextDeclassificationDate: " << theTextDeclassificationDate
117  << "\ntheTextDeclassificationExemption: " << theTextDeclassificationExemption
118  << "\ntheTextSecurityDowngrade: " << theTextSecurityDowngrade
119  << "\ntheTextSecurityDowngradeDate: " << theTextSecurityDowngradeDate
120  << "\ntheTextClassificationText: " << theTextClassificationText
121  << "\ntheTextClassificationAthorityType: " << theTextClassificationAthorityType
122  << "\ntheTextClassificationAthority: " << theTextClassificationAthority
123  << "\ntheTextClassificationReason: " << theTextClassificationReason
124  << "\ntheTextSecuritySourceDate: " << theTextSecuritySourceDate
125  << "\ntheTextSecurityControlNumber: " << theTextSecurityControlNumber
126  << "\ntheTextEncyption: " << theTextEncyption
127  << "\ntheTextFormat: " << theTextFormat
128  << "\ntheExtSubheaderDataLength: " << theExtSubheaderDataLength
129  << "\ntheExtSubheaderOverflow: " << theExtSubheaderOverflow
130  << std::endl;
131  return out;
132 }
133 
135 {
136  memset(theFilePartType,' ', 2);
137  memset(theTextId,' ', 7);
138  memset(theTextAttLevel,' ', 3);
139  memset(theDataAndTime,' ', 14);
140  memset(theTextTitle,' ', 80);
141  memset(theTextSecurityClassification, ' ',1);
142  // If text class is T,S,C, or R, need to have TSCLSY populated with valid code
143  memset(theTextSecuritySystem, ' ', 2);
144  memset(theTextCodewords, ' ',11);
145  memset(theTextControlAndHandling,' ', 2);
146  memset(theTextReleasingInstructions,' ', 20);
147  memset(theTextDeclassificationType,' ', 2);
148  memset(theTextDeclassificationDate, ' ',8);
149  memset(theTextDeclassificationExemption,' ', 4);
150  memset(theTextSecurityDowngrade, ' ',2);
151  memset(theTextSecurityDowngradeDate, ' ',8);
152  memset(theTextClassificationText, ' ',43); // TSCLTX
153  memset(theTextClassificationAthorityType, ' ',1); // TSCATP
154  memset(theTextClassificationAthority, ' ',40); // TSCAUT
155  memset(theTextClassificationReason, ' ',1); //TSCRSN
156  memset(theTextSecuritySourceDate,' ', 8); //TSSRDT
157  memset(theTextSecurityControlNumber, ' ',15); // TSCTLN
158  memset(theTextEncyption, ' ',1);
159  memset(theTextFormat, ' ',3);
160  memset(theExtSubheaderDataLength, ' ',5);
161  memset(theExtSubheaderOverflow, ' ',3);
162 
163  theFilePartType[2] = '\0';
164  theTextId[7] = '\0';
165  theTextAttLevel[3] = '\0';
166  theDataAndTime[14] = '\0';
167  theTextTitle[80] = '\0';
169  theTextSecuritySystem[2] = '\0';
170  theTextCodewords[11] = '\0';
171  theTextControlAndHandling[2] = '\0';
172  theTextReleasingInstructions[20] = '\0';
173  theTextDeclassificationType[2] = '\0';
174  theTextDeclassificationDate[8] = '\0';
176  theTextSecurityDowngrade[1] = '\0';
177  theTextSecurityDowngradeDate[8] = '\0';;
178  theTextClassificationText[43] = '\0';;
181  theTextClassificationReason[1] = '\0';
182  theTextSecuritySourceDate[8] = '\0';
183  theTextSecurityControlNumber[15] = '\0';
184  theTextEncyption[1] = '\0';
185  theTextFormat[3] = '\0';
186  theExtSubheaderDataLength[5] = '\0';
187  theExtSubheaderOverflow[3] = '\0';
188 
189 }
190 
191 
193 {
194  out.write(theFilePartType, 2);
195  out.write(theTextId, 7);
196  out.write(theTextAttLevel, 3);
197  out.write(theDataAndTime, 14);
198  out.write(theTextTitle, 80);
199  out.write(theTextSecurityClassification, 1);
200  // If text class is T,S,C, or R, need to have TSCLSY populated with valid code
201  out.write(theTextSecuritySystem, 2);
202  out.write(theTextCodewords, 11);
203  out.write(theTextControlAndHandling, 2);
204  out.write(theTextReleasingInstructions, 20);
205  out.write(theTextDeclassificationType, 2);
206  out.write(theTextDeclassificationDate, 8);
207  out.write(theTextDeclassificationExemption, 4);
208  out.write(theTextSecurityDowngrade, 2);
209  out.write(theTextSecurityDowngradeDate, 8);
210  out.write(theTextClassificationText, 43); // TSCLTX
211  out.write(theTextClassificationAthorityType, 1); // TSCATP
212  out.write(theTextClassificationAthority, 40); // TSCAUT
213  out.write(theTextClassificationReason, 1); // TSCRSN
214  out.write(theTextSecuritySourceDate, 8); // TSSRDT
215  out.write(theTextSecurityControlNumber, 15); // TSCTLN
216  out.write(theTextEncyption, 1);
217  out.write(theTextFormat, 3);
218  out.write(theExtSubheaderDataLength, 5);
219  long dataLength = ossimString(theExtSubheaderDataLength).toLong();
220  if(dataLength > 0)
221  {
222  out.write(theExtSubheaderOverflow, 3);
223  }
224 }
225 
226 
227 /*
228 void ossimNitfTextHeaderV2_1::getPropertyNames(std::vector<ossimString>& propertyNames)const
229 {
230  propertyNames.push_back(ISCLSY_KW);
231  propertyNames.push_back(ISCODE_KW);
232  propertyNames.push_back(ISCTLH_KW);
233  propertyNames.push_back(ISREL_KW);
234  propertyNames.push_back(ISDCTP_KW);
235  propertyNames.push_back(ISDCDT_KW);
236  propertyNames.push_back(ISDCXM_KW);
237  propertyNames.push_back(ISDG_KW);
238  propertyNames.push_back(ISDGDT_KW);
239  propertyNames.push_back(ISCLTX_KW);
240  propertyNames.push_back(ISCATP_KW);
241  propertyNames.push_back(ISCAUT_KW);
242  propertyNames.push_back(ISCRSN_KW);
243  propertyNames.push_back(ISSRDT_KW);
244  propertyNames.push_back(ISCTLN_KW);
245  propertyNames.push_back(XBANDS_KW);
246 }
247 */
248 
250 {
252 }
253 
255 {
257 }
258 
260 {
262 }
263 
265 {
267 }
268 
270 {
272 }
273 
275 {
277 }
static const ossimString TSCRSN_KW
static const ossimString TSDCXM_KW
virtual void writeStream(std::ostream &out)
void setReleasingInstructions(const ossimString &value)
static const ossimString TSSRDT_KW
void setDeclassificationType(const ossimString &value)
virtual std::ostream & print(std::ostream &out) const
Generic print method.
static const ossimString TSDGDT_KW
static const ossimString TSREL_KW
static const ossimString TSCATP_KW
static const ossimString TSDCDT_KW
static const ossimString TSDG_KW
static const ossimString TXTFMT_KW
static const ossimString ENCRYP_KW
static const ossimString TSCTLN_KW
static const ossimString TSCLAS_KW
static const ossimString TSCAUT_KW
static const ossimString TXTALVL_KW
static const ossimString TXTDT_KW
virtual void parseStream(std::istream &in)
static const ossimString TSCLSY_KW
static const ossimString TSDCTP_KW
static const ossimString TXSHD_KW
static const ossimString TXTITL_KW
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
long toLong() const
toLong&#39;s deprecated, please use the toInts...
void setControlAndHandling(const ossimString &value)
void setCodewords(const ossimString &value)
static const ossimString TSCTLH_KW
static const ossimString TSCLTX_KW
static void setField(void *fieldDestination, const ossimString &src, std::streamsize width, std::ios_base::fmtflags ioflags=std::ios::left, char fill=' ')
Sets a field with a given string, width, and IOS flags.
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
static const ossimString TXSOFL_KW
static const ossimString TEXTID_KW
void setSecurityClassification(const ossimString &value)
static const ossimString TE_KW
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
void setSecurityClassificationSystem(const ossimString &value)
static const ossimString TXSHDL_KW
static const ossimString TSCODE_KW