OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfTextHeaderV2_0.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // Author: Garrett Potts
7 //
8 // Description: Nitf support class
9 //
10 //********************************************************************
11 // $Id: ossimNitfTextHeaderV2_0.cpp 9094 2006-06-13 19:12:40Z dburken $
13 #include <ossim/base/ossimString.h>
14 #include <cstring> // for memset
15 #include <istream>
16 
17 RTTI_DEF1(ossimNitfTextHeaderV2_0, "ossimNitfTextHeaderV2_0", ossimNitfTextHeader)
18 
20 {
21  clearFields();
22 }
23 
25 {
26  if(in)
27  {
28  clearFields();
29 
30  in.read(theFilePartType, 2);
31  in.read(theTextId, 10);
32  in.read(theDataAndTime, 14);
33  in.read(theTextTitle, 80);
35  in.read(theTextCodewords, 40);
36  in.read(theTextControlAndHandling, 40);
37  in.read(theTextReleasingInstructions, 40);
38  in.read(theTextClassificationAuthority, 20);
39  in.read(theTextSecurityControlNumber, 20);
40  in.read(theTextSecurityDowngrade, 6);
41  if(ossimString(theTextSecurityDowngrade) == "999998")
42  {
43  in.read(theTextSecurityDowngradeEvent, 40);
44  }
45  in.read(theTextEncyption, 1);
46  in.read(theTextFormat, 3);
47  in.read(theExtSubheaderDataLength, 5);
48  long dataLength = ossimString(theExtSubheaderDataLength).toLong();
49  if(dataLength > 0)
50  {
51  in.read(theExtSubheaderOverflow, 3);
52 
53  // ignore the data for now
54  in.ignore(dataLength - 3);
55  }
56  }
57 }
58 
60 {
61  out << "theFilePartType: " << theFilePartType
62  << "\ntheTextId: " << theTextId
63  << "\ntheDataAndTime: " << theDataAndTime
64  << "\ntheTextTitle: " << theTextTitle
65  << "\ntheTextSecurityClassification: " << theTextSecurityClassification
66  << "\ntheTextCodewords: " << theTextCodewords
67  << "\ntheTextControlAndHandling: " << theTextControlAndHandling
68  << "\ntheTextReleasingInstructions: " << theTextReleasingInstructions
69  << "\ntheTextClassificationAuthority: " << theTextClassificationAuthority
70  << "\ntheTextSecurityControlNumber: " << theTextSecurityControlNumber
71  << "\ntheTextSecurityDowngrade: " << theTextSecurityDowngrade
72  << "\ntheTextSecurityDowngradeEvent: " << theTextSecurityDowngradeEvent
73  << "\ntheTextEncyption: " << theTextEncyption
74  << "\ntheTextFormat: " << theTextFormat
75  << "\ntheExtSubheaderDataLength: " << theExtSubheaderDataLength
76  << "\ntheExtSubheaderOverflow: " << theExtSubheaderOverflow
77  << std::endl;
78  return out;
79 }
80 
82 {
83 
84  memset(theFilePartType, ' ', 2);
85  memset(theTextId, ' ', 10);
86  memset(theDataAndTime, ' ', 14);
87  memset(theTextTitle, ' ', 80);
88  memset(theTextSecurityClassification, ' ', 1);
89  memset(theTextCodewords, ' ', 40);
90  memset(theTextControlAndHandling, ' ', 40);
91  memset(theTextReleasingInstructions, ' ', 40);
92  memset(theTextClassificationAuthority, ' ', 20);
93  memset(theTextSecurityControlNumber, ' ', 20);
94  memset(theTextSecurityDowngrade, ' ', 6);
95  memset(theTextSecurityDowngradeEvent, ' ', 40);
96  memset(theTextEncyption, ' ', 1);
97  memset(theTextFormat, ' ', 3);
98  memset(theExtSubheaderDataLength, ' ', 5);
99  memset(theExtSubheaderOverflow, ' ', 3);
100 
101  theFilePartType[2] = '\0';
102  theTextId[10] = '\0';
103  theDataAndTime[14] = '\0';
104  theTextTitle[80] = '\0';
106  theTextCodewords[40] = '\0';
107  theTextControlAndHandling[40] = '\0';
108  theTextReleasingInstructions[40] = '\0';
110  theTextSecurityControlNumber[20] = '\0';
111  theTextSecurityDowngrade[6] = '\0';
113  theTextEncyption[1] = '\0';
114  theTextFormat[3] = '\0';
115  theExtSubheaderDataLength[5] = '\0';
116  theExtSubheaderOverflow[3] = '\0';
117 }
virtual void parseStream(std::istream &in)
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...
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
virtual std::ostream & print(std::ostream &out) const
Generic print method.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23