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

#include <ossimJ2kSotRecord.h>

Public Member Functions

 ossimJ2kSotRecord ()
 default constructor More...
 
 ~ossimJ2kSotRecord ()
 destructor More...
 
void parseStream (ossim::istream &in)
 Parse method. More...
 
void writeStream (std::ostream &out)
 Write method. More...
 
void setIsot (ossim_uint16 isot)
 Sets the tile index. More...
 
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. More...
 

Public Attributes

ossim_uint16 theLsot
 Length in bytes of the marker segment. More...
 
ossim_uint16 theIsot
 Tile index. More...
 
ossim_uint32 thePsot
 The length in bytes of this record including the SOT marker. More...
 
ossim_uint8 theTpsot
 Tile-Part index. More...
 
ossim_uint8 theTnsot
 0 = Number of tile-parts of this tile in the codestream is not defined in this header. More...
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &out, const ossimJ2kSotRecord &obj)
 operator<<. More...
 

Detailed Description

Definition at line 16 of file ossimJ2kSotRecord.h.

Constructor & Destructor Documentation

◆ ossimJ2kSotRecord()

ossimJ2kSotRecord::ossimJ2kSotRecord ( )

default constructor

Definition at line 25 of file ossimJ2kSotRecord.cpp.

26  :
27  theLsot(0),
28  theIsot(0),
29  thePsot(0),
30  theTpsot(0),
31  theTnsot(0)
32 {
33 }
ossim_uint8 theTnsot
0 = Number of tile-parts of this tile in the codestream is not defined in this header.
ossim_uint8 theTpsot
Tile-Part index.
ossim_uint16 theIsot
Tile index.
ossim_uint16 theLsot
Length in bytes of the marker segment.
ossim_uint32 thePsot
The length in bytes of this record including the SOT marker.

◆ ~ossimJ2kSotRecord()

ossimJ2kSotRecord::~ossimJ2kSotRecord ( )

destructor

Definition at line 35 of file ossimJ2kSotRecord.cpp.

36 {
37 }

Member Function Documentation

◆ parseStream()

void ossimJ2kSotRecord::parseStream ( ossim::istream in)

Parse method.

Performs byte swapping as needed.

Parameters
inStream to parse.
Note
Marker is not read.

Definition at line 39 of file ossimJ2kSotRecord.cpp.

References ossim::byteOrder(), OSSIM_LITTLE_ENDIAN, ossimEndian::swap(), theIsot, theLsot, thePsot, theTnsot, and theTpsot.

Referenced by ossimKakaduNitfReader::dumpTiles(), and ossimJ2kInfo::printSotMarker().

40 {
41  // Note: marker not read...
42 
43  in.read((char*)&theLsot, 2);
44  in.read((char*)&theIsot, 2);
45  in.read((char*)&thePsot, 4);
46  in.read((char*)&theTpsot, 1);
47  in.read((char*)&theTnsot, 1);
48 
50  {
51  // Stored big endian, must swap.
52  ossimEndian endian;
53  endian.swap(theLsot);
54  endian.swap(theIsot);
55  endian.swap(thePsot);
56  }
57 }
ossim_uint8 theTnsot
0 = Number of tile-parts of this tile in the codestream is not defined in this header.
ossim_uint8 theTpsot
Tile-Part index.
ossim_uint16 theIsot
Tile index.
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
ossim_uint16 theLsot
Length in bytes of the marker segment.
ossim_uint32 thePsot
The length in bytes of this record including the SOT marker.
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26

◆ print()

std::ostream & ossimJ2kSotRecord::print ( std::ostream &  out,
const std::string &  prefix = std::string() 
) const

print method that outputs a key/value type format adding prefix to keys.

Parameters
outString to output to.
prefixThis will be prepended to key. e.g. Where prefix = "nitf." and key is "file_name" key becomes: "nitf.file_name:"
Returns
output stream.

Definition at line 98 of file ossimJ2kSotRecord.cpp.

References theIsot, theLsot, thePsot, theTnsot, and theTpsot.

Referenced by ossimKakaduNitfReader::dumpTiles(), operator<<(), and ossimJ2kInfo::printSotMarker().

100 {
101  // Capture the original flags.
102  std::ios_base::fmtflags f = out.flags();
103 
104  std::string pfx = prefix;
105  pfx += "sot.";
106 
107  out.setf(std::ios_base::hex, std::ios_base::basefield);
108  out << pfx << "marker: 0xff90\n";
109  out.setf(std::ios_base::fmtflags(0), std::ios_base::basefield);
110 
111  out << pfx << "Lsot: " << theLsot << "\n"
112  << pfx << "Isot: " << theIsot << "\n"
113  << pfx << "Psot: " << thePsot << "\n"
114  << pfx << "Tpsot: " << int(theTpsot) << "\n"
115  << pfx << "Tnsot: " << int(theTnsot)
116  << std::endl;
117 
118  // Reset flags.
119  out.setf(f);
120 
121  return out;
122 }
ossim_uint8 theTnsot
0 = Number of tile-parts of this tile in the codestream is not defined in this header.
ossim_uint8 theTpsot
Tile-Part index.
ossim_uint16 theIsot
Tile index.
ossim_uint16 theLsot
Length in bytes of the marker segment.
ossim_uint32 thePsot
The length in bytes of this record including the SOT marker.

◆ setIsot()

void ossimJ2kSotRecord::setIsot ( ossim_uint16  isot)

Sets the tile index.

Parameters
isot

Definition at line 93 of file ossimJ2kSotRecord.cpp.

References theIsot.

94 {
95  theIsot = isot;
96 }
ossim_uint16 theIsot
Tile index.

◆ writeStream()

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

Write method.

Note: Write includes two marker bytes.

Parameters
outStream to write to.

Definition at line 59 of file ossimJ2kSotRecord.cpp.

References ossim::byteOrder(), OSSIM_LITTLE_ENDIAN, ossimEndian::swap(), theIsot, theLsot, thePsot, theTnsot, and theTpsot.

60 {
61  ossimEndian* endian = 0;
63  {
64  // Stored in file big endian, must swap.
65  endian = new ossimEndian();
66  endian->swap( theLsot );
67  endian->swap( theIsot );
68  endian->swap( thePsot );
69  }
70 
71  // Marker 0xff90:
72  out.put( 0xff );
73  out.put( 0x90 );
74 
75  out.write( (char*)&theLsot, 2);
76  out.write( (char*)&theIsot, 2);
77  out.write( (char*)&thePsot, 4);
78  out.write( (char*)&theTpsot, 1);
79  out.write( (char*)&theTnsot, 1);
80 
81  if ( endian )
82  {
83  // Swap back to native:
84  endian->swap(theLsot);
85  endian->swap(theIsot);
86  endian->swap(thePsot);
87 
88  delete endian;
89  endian = 0;
90  }
91 }
ossim_uint8 theTnsot
0 = Number of tile-parts of this tile in the codestream is not defined in this header.
ossim_uint8 theTpsot
Tile-Part index.
ossim_uint16 theIsot
Tile index.
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
ossim_uint16 theLsot
Length in bytes of the marker segment.
ossim_uint32 thePsot
The length in bytes of this record including the SOT marker.
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  out,
const ossimJ2kSotRecord obj 
)
friend

operator<<.

Definition at line 124 of file ossimJ2kSotRecord.cpp.

125 {
126  return obj.print(out);
127 }
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.

Member Data Documentation

◆ theIsot

ossim_uint16 ossimJ2kSotRecord::theIsot

Tile index.

Tiles are in raster order starting at 0.

Definition at line 72 of file ossimJ2kSotRecord.h.

Referenced by parseStream(), print(), setIsot(), and writeStream().

◆ theLsot

ossim_uint16 ossimJ2kSotRecord::theLsot

Length in bytes of the marker segment.

Definition at line 69 of file ossimJ2kSotRecord.h.

Referenced by parseStream(), print(), and writeStream().

◆ thePsot

ossim_uint32 ossimJ2kSotRecord::thePsot

The length in bytes of this record including the SOT marker.

Definition at line 75 of file ossimJ2kSotRecord.h.

Referenced by ossimKakaduNitfReader::dumpTiles(), parseStream(), print(), ossimJ2kInfo::printSotMarker(), and writeStream().

◆ theTnsot

ossim_uint8 ossimJ2kSotRecord::theTnsot

0 = Number of tile-parts of this tile in the codestream is not defined in this header.

1-255 number of tile-parts of this tile in the codestream.

Definition at line 86 of file ossimJ2kSotRecord.h.

Referenced by parseStream(), print(), and writeStream().

◆ theTpsot

ossim_uint8 ossimJ2kSotRecord::theTpsot

Tile-Part index.

Definition at line 78 of file ossimJ2kSotRecord.h.

Referenced by parseStream(), print(), and writeStream().


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