OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfReplaceUpdateRecord.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // File: ossimRpfReplaceUpdateRecord.cpp
4 //
5 // License: See top level LICENSE.txt file.
6 //
7 // Author: David Burken
8 //
9 // Description:
10 //
11 // RPF replace/update section subheader record.
12 //
13 // See MIL-STD-2411 for detailed information.
14 //
15 //----------------------------------------------------------------------------
16 // $Id: ossimRpfReplaceUpdateRecord.cpp 20324 2011-12-06 22:25:23Z dburken $
17 
20 #include <cstring> /* for memset, memcpy */
21 #include <istream>
22 #include <ostream>
23 
25 {
26  return data.print(out);
27 }
28 
30  :
31  m_updateStatus(0)
32 {
33  clearFields();
34 }
35 
37  :
38  m_updateStatus(obj.m_updateStatus)
39 {
40  memcpy(m_newFile, obj.m_newFile, 13);
41  memcpy(m_oldFile, obj.m_oldFile, 13);
42 }
43 
45  const ossimRpfReplaceUpdateRecord& rhs)
46 {
47  if ( this != &rhs )
48  {
49  memcpy(m_newFile, rhs.m_newFile, 13);
50  memcpy(m_oldFile, rhs.m_oldFile, 13);
52  }
53  return *this;
54 }
55 
57 {
59  if( in.good() )
60  {
61  clearFields();
62  in.read((char*)&m_newFile, 12);
63  in.read((char*)&m_oldFile, 12);
64  in.read((char*)&m_updateStatus, 1);
65  }
66 
67  if ( in.fail() )
68  {
70  }
71 
72  return status;
73 }
74 
76 {
77  out.write((char*)&m_newFile, 12);
78  out.write((char*)&m_oldFile, 12);
79  out.write((char*)&m_updateStatus, 1);
80 }
81 
83  const std::string& prefix,
84  ossim_uint32 recordNumber)const
85 {
86  std::string pfx = prefix;
87  pfx += "replace_update_record";
88  pfx += ossimString::toString(recordNumber).string();
89  pfx += ".";
90  out << pfx << "new_file: " << m_newFile << "\n"
91  << pfx << "old_file: " << m_oldFile << "\n"
92  << pfx << "update_status: " << int(m_updateStatus)
93  << std::endl;
94  return out;
95 }
96 
97 void ossimRpfReplaceUpdateRecord::getNewFilename(std::string& file) const
98 {
99  file = m_newFile;
100 }
101 
102 void ossimRpfReplaceUpdateRecord::getOldFilename(std::string& file) const
103 {
104  file = m_oldFile;
105 }
106 
108 {
109  return m_updateStatus;
110 }
111 
112 void ossimRpfReplaceUpdateRecord::setNewFilename(const std::string& file)
113 {
115 }
116 
117 void ossimRpfReplaceUpdateRecord::setOldFilename(const std::string& file)
118 {
120 }
121 
123 {
125 }
126 
128 {
129  memset(m_newFile, ' ', 12);
130  memset(m_oldFile, ' ', 12);
131  m_updateStatus = 0;
132 
133  m_newFile[12] = '\0';
134  m_oldFile[12] = '\0';
135 }
ossim_int32 ossimErrorCode
void getNewFilename(std::string &file) const
Gets new file field.
std::ostream & print(std::ostream &out, const std::string &prefix=std::string(), ossim_uint32 recordNumber=0) const
print method that outputs a key/value type format adding prefix to keys.
static const ossimErrorCode OSSIM_OK
void setNewFilename(const std::string &file)
Sets old file name 12 byte field.
static ossimString toString(bool aValue)
Numeric to string methods.
static const ossimErrorCode OSSIM_ERROR
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
void setOldFilename(const std::string &file)
Sets new file name 12 byte field.
const ossimRpfReplaceUpdateRecord & operator=(const ossimRpfReplaceUpdateRecord &rhs)
assignment operator
char m_oldFile[13]
This is a 12 byte asci field.
void getOldFilename(std::string &file) const
Gets old file field.
unsigned int ossim_uint32
return status
char m_newFile[13]
This is a 12 byte asci field.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
std::ostream & operator<<(std::ostream &out, const ossimRpfReplaceUpdateRecord &data)
ossimErrorCode parseStream(std::istream &in)
Method to parse the record.
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.
ossimRpfReplaceUpdateRecord()
default constructor
void writeStream(std::ostream &out)
Write method.
unsigned char ossim_uint8
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
RPF replace/update section subheader record.
const std::string & string() const
Definition: ossimString.h:414