OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfCsdidaTag.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: David Burken
8 //
9 // Description: CSDIDA tag class definition.
10 //
11 // Dataset Indentification TRE.
12 //
13 // See document STDI-0006-NCDRD Table 3.3-14 for more info.
14 //
15 //----------------------------------------------------------------------------
16 // $Id
17 
18 #include <cstring>
19 #include <istream>
20 #include <iostream>
21 #include <iomanip>
22 
24 
25 
27 
29  : ossimNitfRegisteredTag(std::string("CSDIDA"), 70)
30 {
31  clearFields();
32 }
33 
35 {
36 }
37 
39 {
40  clearFields();
41 
42  in.read(theDay, 2);
43  in.read(theMonth, 3);
44  in.read(theYear, 4);
45  in.read(thePlatformCode, 2);
46  in.read(theVehicleId, 2);
47  in.read(thePass, 2);
48  in.read(theOperation, 3);
49  in.read(theSensorId, 2);
50  in.read(theProductId, 2);
51  in.read(theReservedField1, 4);
52  in.read(theTime, 14);
53  in.read(theProcessTime, 14);
54  in.read(theReservedField2, 2);
55  in.read(theReservedField3, 2);
56  in.read(theReservedField4, 1);
57  in.read(theReservedField5, 1);
58  in.read(theSoftwareVersionNumber, 10);
59 }
60 
62 {
63  out.write(theDay, 2);
64  out.write(theMonth, 3);
65  out.write(theYear, 4);
66  out.write(thePlatformCode, 2);
67  out.write(theVehicleId, 2);
68  out.write(thePass, 2);
69  out.write(theOperation, 3);
70  out.write(theSensorId, 2);
71  out.write(theProductId, 2);
72  out.write(theReservedField1, 4);
73  out.write(theTime, 14);
74  out.write(theProcessTime, 14);
75  out.write(theReservedField2, 2);
76  out.write(theReservedField3, 2);
77  out.write(theReservedField4, 1);
78  out.write(theReservedField5, 1);
79  out.write(theSoftwareVersionNumber, 10);
80 }
81 
83 {
84  // BCS-N's to '0's, BCS-A's to ' '(spaces)
85 
86  memset(theDay, '0', 2);
87  memset(theMonth, ' ', 3);
88  memset(theYear, '0', 4);
89  memset(thePlatformCode, ' ', 2);
90  memset(theVehicleId, '0', 2);
91  memset(thePass, '0', 2);
92  memset(theOperation, '0', 3);
93  memset(theSensorId, ' ', 2);
94  memset(theProductId, ' ', 2);
95  memcpy(theReservedField1, "00 ", 4);
96  memset(theTime, '0', 14);
97  memset(theProcessTime, '0', 14);
98  memcpy(theReservedField2, "00", 2);
99  memcpy(theReservedField3, "01", 2);
100  memcpy(theReservedField4, "N", 1);
101  memcpy(theReservedField5, "N", 1);
102  memset(theSoftwareVersionNumber, ' ', 10);
103 
104  theDay[2] = '\0';
105  theMonth[3] = '\0';
106  theYear[4] = '\0';
107  thePlatformCode[2] = '\0';
108  theVehicleId[2] = '\0';
109  thePass[2] = '\0';
110  theOperation[3] = '\0';
111  theSensorId[2] = '\0';
112  theProductId[2] = '\0';
113  theReservedField1[4] = '\0';
114  theTime[14] = '\0';
115  theProcessTime[14] = '\0';
116  theReservedField2[2] = '\0';
117  theReservedField3[2] = '\0';
118  theReservedField4[0] = '\0';
119  theReservedField5[0] = '\0';
120  theSoftwareVersionNumber[10] = '\0';
121 }
122 
124  std::ostream& out, const std::string& prefix) const
125 {
126  std::string pfx = prefix;
127  pfx += getTagName();
128  pfx += ".";
129 
130  out << setiosflags(std::ios::left)
131  << pfx << std::setw(24) << "CETAG:"
132  << getTagName() << "\n"
133  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
134  << pfx << std::setw(24) << "DAY:" << theDay << "\n"
135  << pfx << std::setw(24) << "MONTH:" << theMonth << "\n"
136  << pfx << std::setw(24) << "YEAR:" << theYear << "\n"
137  << pfx << std::setw(24) << "PLATFORM_CODE:" << thePlatformCode << "\n"
138  << pfx << std::setw(24) << "VEHICLE_ID:" << theVehicleId << "\n"
139  << pfx << std::setw(24) << "PASS:" << thePass << "\n"
140  << pfx << std::setw(24) << "OPERATION:" << theOperation << "\n"
141  << pfx << std::setw(24) << "SENSOR_ID:" << theSensorId << "\n"
142  << pfx << std::setw(24) << "PRODUCT_ID:" << theProductId << "\n"
143  << pfx << std::setw(24) << "TIME:" << theTime << "\n"
144  << pfx << std::setw(24) << "PROCESS_TIME:" << theProcessTime << "\n"
145  << pfx << std::setw(24) << "SOFTWARE_VERSION_NUMBER:"
146  << theSoftwareVersionNumber << "\n";
147 
148  return out;
149 }
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
char theReservedField1[5]
FIELD: Reserved.
char theProductId[3]
FIELD: PRODUCT_ID.
virtual void clearFields()
Method to clear all fields including null terminating.
char theReservedField5[1]
FIELD: Reserved.
char theYear[5]
FIELD: YEAR.
char theVehicleId[3]
FIELD: VEHICLE ID.
virtual void parseStream(std::istream &in)
Method to parse data from stream.
char theDay[3]
FIELD: DAY.
virtual std::ostream & print(std::ostream &out, const std::string &prefix) const
Print method that outputs a key/value type format adding prefix to keys.
char thePass[3]
FIELD: PASS.
char theProcessTime[15]
FIELD: PROCESS_TIME.
char theReservedField4[1]
FIELD: Reserved.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
char theReservedField2[3]
FIELD: Reserved.
char theSensorId[3]
FIELD: SENSOR_ID.
char theOperation[4]
FIELD: OPERATION.
char theReservedField3[3]
FIELD: Reserved.
char theSoftwareVersionNumber[11]
FIELD: SOFTWARE_VERSION_NUMBER.
RTTI_DEF1(ossimNitfCsdidaTag, "ossimNitfCsdidaTag", ossimNitfRegisteredTag)
char theTime[15]
FIELD: TIME.
char thePlatformCode[3]
FIELD: PLATFORM CODE.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
virtual ~ossimNitfCsdidaTag()
destructor
ossimNitfCsdidaTag()
default constructor
char theMonth[4]
FIELD: MONTH.
virtual void writeStream(std::ostream &out)
Method to write data to stream.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23