NASA Logo
Ocean Color Science Software

ocssw V2022

#include <l0stream.hpp>

Classes

struct  L0File
 

Public Member Functions

 L0Stream (std::vector< std::string > &l0FileNames)
 
 ~L0Stream ()
 
void read (char *buffer, size_t num)
 
void seekg (std::streamoff num, std::ios_base::seekdir dir)
 
bool fail ()
 
bool eof ()
 
int tellg ()
 
bool hasHeader (std::fstream &fileStream)
 
size_t getFileSize (std::fstream &fileStream)
 
size_t getBytesLeft ()
 
void exit_unhappy (std::string message)
 

Static Public Member Functions

static void strip_oci_header (std::fstream &fileStream)
 

Detailed Description

A class to simulate a single stream object over multiple OCI L0 files.

Authors
Jakob C. Lindo (SSAI)
Date
Apr 2024

Definition at line 16 of file l0stream.hpp.

Constructor & Destructor Documentation

◆ L0Stream()

L0Stream ( std::vector< std::string > &  l0FileNames)

Definition at line 21 of file l0stream.cpp.

◆ ~L0Stream()

~L0Stream ( )

Definition at line 36 of file l0stream.cpp.

Member Function Documentation

◆ eof()

bool eof ( )

Indicate if fstream::eof is true.

Returns
fstream::eof()

Definition at line 139 of file l0stream.cpp.

◆ exit_unhappy()

void exit_unhappy ( std::string  message)

For use when the program has reached a bad state.

Parameters
messageA helpful message to print to cerr indicating what went wrong

Definition at line 44 of file l0stream.cpp.

◆ fail()

bool fail ( )

Indicate if the fstream::badbit or fstream::failbit is set.

Returns
true if fstream::badbit or fstream::failbit is set, false otherwise

Definition at line 132 of file l0stream.cpp.

◆ getBytesLeft()

size_t getBytesLeft ( )

Obtain the number of bytes between the read/write head and the end of the current stream.

Parameters
fileStreamThe stream object
Returns
The number of bytes between the read/write head and the end of the current stream.

Definition at line 79 of file l0stream.cpp.

◆ getFileSize()

size_t getFileSize ( std::fstream &  fileStream)

Obtain the size in bytes of fileStream. This method does not guarantee that the read/write head returns to its position before being called.

Parameters
fileStreamAn open fstream.
Returns
The number of bytes in fileStream

Definition at line 71 of file l0stream.cpp.

◆ hasHeader()

bool hasHeader ( std::fstream &  fileStream)

Strips the PACE OCI header off of fileStream if it exists, and returns whether it does so or not.

Parameters
fileStreamAn open fstream
Returns
true if a header exists in the file, false if not.

Definition at line 66 of file l0stream.cpp.

◆ read()

void read ( char *  buffer,
size_t  num 
)

Read from the current stream, switching streams as necessary.

Parameters
bufferThe data structure into which bytes will be read.
numBytesThe size of the block to be read.

Definition at line 83 of file l0stream.cpp.

◆ seekg()

void seekg ( std::streamoff  num,
std::ios_base::seekdir  dir 
)

Move the read/write head a number of bytes in a particular direction, switching streams as necessary.

Parameters
numThe number of bytes to seek. May be negative, indicating a backwards seek.
dirThe direction to seek.

Definition at line 115 of file l0stream.cpp.

◆ strip_oci_header()

void strip_oci_header ( std::fstream &  fileStream)
static

Typical OCI header 00000000 63 46 45 31 20 53 43 49 00 00 00 40 50 41 43 45 |cFE1 SCI...@PACE| 00000010 00 00 00 03 20 4f 43 49 7c 8c a0 d3 52 07 30 00 |.... OCI|...R.0.| 00000020 4f 43 49 30 30 30 30 32 31 32 34 39 2e 6f 63 69 |OCI000021249.oci| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

Definition at line 49 of file l0stream.cpp.

◆ tellg()

int tellg ( )

Obtain the position of the read/write head from the beginning of the current filestream.

Returns
-1 if fail() or eof() is true, otherwise the position of the read/write head

Definition at line 146 of file l0stream.cpp.


The documentation for this class was generated from the following files:
  • /gfs-oceanweb/web/ocssw/ocssw_src/src/l1agen_oci/l0stream.hpp
  • /gfs-oceanweb/web/ocssw/ocssw_src/src/l1agen_oci/l0stream.cpp