OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfMstgtaTag.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: MSTGTA Mission Target Information Extension Format
10 // tag class definition.
11 //
12 // See document STDI-0002 Table 8-16 for more info.
13 //
14 //----------------------------------------------------------------------------
15 // $Id
16 
17 #include <cstring>
18 #include <istream>
19 #include <iostream>
20 #include <iomanip>
21 
23 
24 
26 
28  : ossimNitfRegisteredTag(std::string("MSTGTA"), 101)
29 {
30  clearFields();
31 }
32 
34 {
35 }
36 
38 {
39  clearFields();
40 
41  in.read(theTgtNum, TGT_NUM_SIZE);
42  in.read(theTgtId, TGT_ID_SIZE);
43  in.read(theTgtBe, TGT_BE_SIZE);
44  in.read(theTgtPri, TGT_PRI_SIZE);
45  in.read(theTgtReq, TGT_REQ_SIZE);
46  in.read(theTgtLtiov, TGT_LTIOV_SIZE);
47  in.read(theTgtType, TGT_TYPE_SIZE);
48  in.read(theTgtColl, TGT_COLL_SIZE);
49  in.read(theTgtCat, TGT_CAT_SIZE);
50  in.read(theTgtUtc, TGT_UTC_SIZE);
51  in.read(theTgtElev, TGT_ELEV_SIZE);
53  in.read(theTgtLoc, TGT_LOC_SIZE);
54 }
55 
57 {
58  out.write(theTgtNum, TGT_NUM_SIZE);
59  out.write(theTgtId, TGT_ID_SIZE);
60  out.write(theTgtBe, TGT_BE_SIZE);
61  out.write(theTgtPri, TGT_PRI_SIZE);
62  out.write(theTgtReq, TGT_REQ_SIZE);
63  out.write(theTgtLtiov, TGT_LTIOV_SIZE);
64  out.write(theTgtType, TGT_TYPE_SIZE);
65  out.write(theTgtColl, TGT_COLL_SIZE);
66  out.write(theTgtCat, TGT_CAT_SIZE);
67  out.write(theTgtUtc, TGT_UTC_SIZE);
68  out.write(theTgtElev, TGT_ELEV_SIZE);
70  out.write(theTgtLoc, TGT_LOC_SIZE);
71 }
72 
74 {
75  // BCS-N's to '0's, BCS-A's to ' '(spaces)
76 
77  // clear
78  memset(theTgtNum, '0', TGT_NUM_SIZE);
79  memset(theTgtId, ' ', TGT_ID_SIZE);
80  memset(theTgtBe, ' ', TGT_BE_SIZE);
81  memset(theTgtPri, ' ', TGT_PRI_SIZE);
82  memset(theTgtReq, ' ', TGT_REQ_SIZE);
83  memset(theTgtLtiov, ' ', TGT_LTIOV_SIZE);
84  memset(theTgtType, ' ', TGT_TYPE_SIZE);
85  memset(theTgtColl, '0', TGT_COLL_SIZE);
86  memset(theTgtCat, ' ', TGT_CAT_SIZE);
87  memset(theTgtUtc, ' ', TGT_UTC_SIZE);
88  memset(theTgtElev, ' ', TGT_ELEV_SIZE);
89  memset(theTgtElevUnit, ' ', TGT_ELEV_UNIT_SIZE);
90  memset(theTgtLoc, ' ', TGT_LOC_SIZE);
91 
92  // null terminate
93  theTgtNum[TGT_NUM_SIZE] = '\0';
94  theTgtId[TGT_ID_SIZE] = '\0';
95  theTgtBe[TGT_BE_SIZE] = '\0';
96  theTgtPri[TGT_PRI_SIZE] = '\0';
97  theTgtReq[TGT_REQ_SIZE] = '\0';
99  theTgtType[TGT_TYPE_SIZE] = '\0';
100  theTgtColl[TGT_COLL_SIZE] = '\0';
101  theTgtCat[TGT_CAT_SIZE] = '\0';
102  theTgtUtc[TGT_UTC_SIZE] = '\0';
103  theTgtElev[TGT_ELEV_SIZE] = '\0';
105  theTgtLoc[TGT_LOC_SIZE] = '\0';
106 }
107 
109  std::ostream& out, const std::string& prefix) const
110 {
111  std::string pfx = prefix;
112  pfx += getTagName();
113  pfx += ".";
114 
115  out << setiosflags(std::ios::left)
116  << pfx << std::setw(24) << "CETAG:"
117  << getTagName() << "\n"
118  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
119  << pfx << std::setw(24) << "TGT_NUM:" << theTgtNum << "\n"
120  << pfx << std::setw(24) << "TGT_ID:" << theTgtId << "\n"
121  << pfx << std::setw(24) << "TGT_BE:" << theTgtBe << "\n"
122  << pfx << std::setw(24) << "TGT_PRI:" << theTgtPri << "\n"
123  << pfx << std::setw(24) << "TGT_REQ:" << theTgtReq << "\n"
124  << pfx << std::setw(24) << "TGT_LTIOV:" << theTgtLtiov << "\n"
125  << pfx << std::setw(24) << "TGT_TYPE:" << theTgtType << "\n"
126  << pfx << std::setw(24) << "TGT_COLL:" << theTgtColl << "\n"
127  << pfx << std::setw(24) << "TGT_CAT:" << theTgtCat << "\n"
128  << pfx << std::setw(24) << "TGT_UTC:" << theTgtUtc << "\n"
129  << pfx << std::setw(24) << "TGT_ELEV:" << theTgtElev << "\n"
130  << pfx << std::setw(24) << "TGT_ELEV_UNIT:" << theTgtElevUnit << "\n"
131  << pfx << std::setw(24) << "TGT_LOC:" << theTgtLoc << "\n";
132 
133  return out;
134 }
char theTgtType[TGT_TYPE_SIZE+1]
FIELD: TGT_TYPE.
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
virtual void writeStream(std::ostream &out)
Method to write data to stream.
char theTgtId[TGT_ID_SIZE+1]
FIELD: TGT_ID.
char theTgtUtc[TGT_UTC_SIZE+1]
FIELD: TGT_UTC.
char theTgtLtiov[TGT_LTIOV_SIZE+1]
FIELD: TGT_LTIOV.
ossimNitfMstgtaTag()
default constructor
char theTgtBe[TGT_BE_SIZE+1]
FIELD: TGT_BE.
virtual std::ostream & print(std::ostream &out, const std::string &prefix=std::string()) const
Print method that outputs a key/value type format adding prefix to keys.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
char theTgtReq[TGT_REQ_SIZE+1]
FIELD: TGT_REQ.
char theTgtLoc[TGT_LOC_SIZE+1]
FIELD: TGT_LOC.
char theTgtColl[TGT_COLL_SIZE+1]
FIELD: TGT_COLL.
char theTgtElevUnit[TGT_ELEV_UNIT_SIZE+1]
FIELD: TGT_ELEV_UNIT.
virtual ~ossimNitfMstgtaTag()
destructor
RTTI_DEF1(ossimNitfMstgtaTag, "ossimNitfMstgtaTag", ossimNitfRegisteredTag)
virtual void clearFields()
Method to clear all fields including null terminating.
char theTgtElev[TGT_ELEV_SIZE+1]
FIELD: TGT_ELEV.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
char theTgtNum[TGT_NUM_SIZE+1]
Type R = Required Type <R> = BCS spaces allowed for entire field.
virtual void parseStream(std::istream &in)
Method to parse data from stream.
char theTgtCat[TGT_CAT_SIZE+1]
FIELD: TGT_CAT.
char theTgtPri[TGT_PRI_SIZE+1]
FIELD: TGT_PRI.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23