OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Attributes | Friends | List of all members
ossimRpfReplaceUpdateRecord Class Reference

RPF replace/update section subheader record. More...

#include <ossimRpfReplaceUpdateRecord.h>

Public Member Functions

 ossimRpfReplaceUpdateRecord ()
 default constructor More...
 
 ossimRpfReplaceUpdateRecord (const ossimRpfReplaceUpdateRecord &obj)
 copy constructor More...
 
const ossimRpfReplaceUpdateRecordoperator= (const ossimRpfReplaceUpdateRecord &rhs)
 assignment operator More...
 
ossimErrorCode parseStream (std::istream &in)
 Method to parse the record. More...
 
void writeStream (std::ostream &out)
 Write method. More...
 
void clearFields ()
 Clears fields. More...
 
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. More...
 
void getNewFilename (std::string &file) const
 Gets new file field. More...
 
void getOldFilename (std::string &file) const
 Gets old file field. More...
 
ossim_uint8 getUpdateStatus () const
 
void setNewFilename (const std::string &file)
 Sets old file name 12 byte field. More...
 
void setOldFilename (const std::string &file)
 Sets new file name 12 byte field. More...
 
void setUpdateStatus (ossim_uint8 status)
 

Private Attributes

char m_newFile [13]
 This is a 12 byte asci field. More...
 
char m_oldFile [13]
 This is a 12 byte asci field. More...
 
ossim_uint8 m_updateStatus
 This is a 1 byte unsigned integer. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const ossimRpfReplaceUpdateRecord &data)
 Convenience output operator. More...
 

Detailed Description

RPF replace/update section subheader record.

See MIL-STD-2411 for detailed information.

Definition at line 26 of file ossimRpfReplaceUpdateRecord.h.

Constructor & Destructor Documentation

◆ ossimRpfReplaceUpdateRecord() [1/2]

ossimRpfReplaceUpdateRecord::ossimRpfReplaceUpdateRecord ( )

default constructor

Definition at line 29 of file ossimRpfReplaceUpdateRecord.cpp.

References clearFields().

30  :
32 {
33  clearFields();
34 }
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.

◆ ossimRpfReplaceUpdateRecord() [2/2]

ossimRpfReplaceUpdateRecord::ossimRpfReplaceUpdateRecord ( const ossimRpfReplaceUpdateRecord obj)

copy constructor

Definition at line 36 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile, and m_oldFile.

37  :
39 {
40  memcpy(m_newFile, obj.m_newFile, 13);
41  memcpy(m_oldFile, obj.m_oldFile, 13);
42 }
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
char m_oldFile[13]
This is a 12 byte asci field.
char m_newFile[13]
This is a 12 byte asci field.

Member Function Documentation

◆ clearFields()

void ossimRpfReplaceUpdateRecord::clearFields ( )

Clears fields.

Definition at line 127 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile, m_oldFile, and m_updateStatus.

Referenced by ossimRpfReplaceUpdateRecord(), and parseStream().

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_uint8 m_updateStatus
This is a 1 byte unsigned integer.
char m_oldFile[13]
This is a 12 byte asci field.
char m_newFile[13]
This is a 12 byte asci field.

◆ getNewFilename()

void ossimRpfReplaceUpdateRecord::getNewFilename ( std::string &  file) const

Gets new file field.

Parameters
fileSet by this.

Definition at line 97 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile.

98 {
99  file = m_newFile;
100 }
char m_newFile[13]
This is a 12 byte asci field.

◆ getOldFilename()

void ossimRpfReplaceUpdateRecord::getOldFilename ( std::string &  file) const

Gets old file field.

Parameters
fileSet by this.

Definition at line 102 of file ossimRpfReplaceUpdateRecord.cpp.

References m_oldFile.

103 {
104  file = m_oldFile;
105 }
char m_oldFile[13]
This is a 12 byte asci field.

◆ getUpdateStatus()

ossim_uint8 ossimRpfReplaceUpdateRecord::getUpdateStatus ( ) const
Returns
The update status field.

Definition at line 107 of file ossimRpfReplaceUpdateRecord.cpp.

References m_updateStatus.

108 {
109  return m_updateStatus;
110 }
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.

◆ operator=()

const ossimRpfReplaceUpdateRecord & ossimRpfReplaceUpdateRecord::operator= ( const ossimRpfReplaceUpdateRecord rhs)

assignment operator

Definition at line 44 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile, m_oldFile, and m_updateStatus.

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 }
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
char m_oldFile[13]
This is a 12 byte asci field.
char m_newFile[13]
This is a 12 byte asci field.

◆ parseStream()

ossimErrorCode ossimRpfReplaceUpdateRecord::parseStream ( std::istream &  in)

Method to parse the record.

Note no byte swapping required for this record.

Parameters
inStream sitting at record.

Definition at line 56 of file ossimRpfReplaceUpdateRecord.cpp.

References clearFields(), m_newFile, m_oldFile, m_updateStatus, ossimErrorCodes::OSSIM_ERROR, ossimErrorCodes::OSSIM_OK, and status.

Referenced by ossimRpfFrame::populateReplaceUpdateTable().

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 }
ossim_int32 ossimErrorCode
static const ossimErrorCode OSSIM_OK
static const ossimErrorCode OSSIM_ERROR
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
char m_oldFile[13]
This is a 12 byte asci field.
return status
char m_newFile[13]
This is a 12 byte asci field.

◆ print()

std::ostream & ossimRpfReplaceUpdateRecord::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.

Parameters
outStream to output to.
prefixThis will be prepended to key.
recordNumberThis is added to key. See below. e.g. Where prefix = "nitf.rpf.", recordNumber = 0 and key is "new_file" key becomes: "nitf.rpf.replace_update_record0.new_file:"
Returns
output stream.

Definition at line 82 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile, m_oldFile, m_updateStatus, ossimString::string(), and ossimString::toString().

Referenced by operator<<().

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 }
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
char m_oldFile[13]
This is a 12 byte asci field.
char m_newFile[13]
This is a 12 byte asci field.
const std::string & string() const
Definition: ossimString.h:414

◆ setNewFilename()

void ossimRpfReplaceUpdateRecord::setNewFilename ( const std::string &  file)

Sets old file name 12 byte field.

Parameters
file

Definition at line 112 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile, and ossimNitfCommon::setField().

113 {
115 }
char m_newFile[13]
This is a 12 byte asci field.
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.

◆ setOldFilename()

void ossimRpfReplaceUpdateRecord::setOldFilename ( const std::string &  file)

Sets new file name 12 byte field.

Parameters
file

Definition at line 117 of file ossimRpfReplaceUpdateRecord.cpp.

References m_oldFile, and ossimNitfCommon::setField().

118 {
120 }
char m_oldFile[13]
This is a 12 byte asci field.
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.

◆ setUpdateStatus()

void ossimRpfReplaceUpdateRecord::setUpdateStatus ( ossim_uint8  status)
Returns
Sets the update status field.

Definition at line 122 of file ossimRpfReplaceUpdateRecord.cpp.

References m_updateStatus, and status.

123 {
125 }
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
return status

◆ writeStream()

void ossimRpfReplaceUpdateRecord::writeStream ( std::ostream &  out)

Write method.

Note no byte swapping required for this record.

Parameters
outStream to write to.

Definition at line 75 of file ossimRpfReplaceUpdateRecord.cpp.

References m_newFile, m_oldFile, and m_updateStatus.

76 {
77  out.write((char*)&m_newFile, 12);
78  out.write((char*)&m_oldFile, 12);
79  out.write((char*)&m_updateStatus, 1);
80 }
ossim_uint8 m_updateStatus
This is a 1 byte unsigned integer.
char m_oldFile[13]
This is a 12 byte asci field.
char m_newFile[13]
This is a 12 byte asci field.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const ossimRpfReplaceUpdateRecord data 
)
friend

Convenience output operator.

Definition at line 24 of file ossimRpfReplaceUpdateRecord.cpp.

25 {
26  return data.print(out);
27 }
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.

Member Data Documentation

◆ m_newFile

char ossimRpfReplaceUpdateRecord::m_newFile[13]
private

◆ m_oldFile

char ossimRpfReplaceUpdateRecord::m_oldFile[13]
private

◆ m_updateStatus

ossim_uint8 ossimRpfReplaceUpdateRecord::m_updateStatus
private

This is a 1 byte unsigned integer.

Definition at line 114 of file ossimRpfReplaceUpdateRecord.h.

Referenced by clearFields(), getUpdateStatus(), operator=(), parseStream(), print(), setUpdateStatus(), and writeStream().


The documentation for this class was generated from the following files: