GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
geotess::IFStreamBinary Class Reference

Opens a file for binary read and write access. More...

#include <IFStreamBinary.h>

Public Member Functions

 IFStreamBinary ()
 Public Default Constructor. More...
 
 IFStreamBinary (bool align)
 Standard constructor that sets the padding (alignment) option to align. More...
 
 IFStreamBinary (const string &filename)
 Standard constructor creates a new IFStreamBinary and opens reads its buffer from the input filename. More...
 
 IFStreamBinary (const string &filename, int num_bytes)
 Standard constructor creates a new IFStreamBinary and opens reads its buffer from the input filename. More...
 
 IFStreamBinary (string *str)
 Standard constructor that uses a provided string ptr as the data container. More...
 
 IFStreamBinary (const IFStreamBinary &db)
 Copy Constructor. More...
 
virtual ~IFStreamBinary ()
 Public destructor. More...
 
void boundaryAlignmentOff ()
 Turns off intrinsic boundary alignment. More...
 
void boundaryAlignmentOn ()
 Turns on intrinsic boundary alignment. More...
 
void byteOrderReverseOff ()
 Turns off byte order reversal. More...
 
void byteOrderReverseOn ()
 Turns on byte order reversal. More...
 
void clear ()
 Clears the buffer. More...
 
void decrementPos (int decrement=1)
 Decrement the iterator position. More...
 
void dumpBuffer ()
 Debug dump of the data. More...
 
int getCapacity () const
 Return the allocated capacity of this IFStreamBinary. More...
 
const string & getData () const
 Return a const reference to 'this' IFStreamBinarys data. More...
 
const string & getFileName () const
 Return the file name with which this binary reader was opened. More...
 
int getPos () const
 Get the current iterator position. More...
 
char * getPosPointer ()
 Return a pointer at the current iterator location in the IFStreamBinary data. More...
 
char * getPosPointer (int pos)
 Return a pointer to position pos in 'this' IFStreamBinarys data. More...
 
void incrementPos (int increment=1)
 Increment the iterator position. More...
 
bool isBoundaryAlignmentOn () const
 Returns true if the byte order in reads and writes is reversed for all 2, 4, or 8 byte intrinsincs (short, int, long, float, double, etc.). More...
 
bool isByteOrderReversalOn () const
 Returns true if the byte order in reads and writes is reversed for all 2, 4, or 8 byte intrinsincs (short, int, long, float, double, etc.). More...
 
IFStreamBinaryoperator= (const IFStreamBinary &db)
 Assignment operator. More...
 
bool readBool ()
 Read bool data. More...
 
bool readBool (int pos)
 Read in a single bool starting at the input position and return it. More...
 
void readBoolArray (bool *array, int num_bools)
 Read in num_bools into the input array. More...
 
byte readByte ()
 Read byte data. More...
 
byte readByte (int pos)
 Read in a single byte starting at the input position and return it. More...
 
void readByteArray (byte *array, int num_bs)
 Read in num_bytes into the input array. More...
 
void readCharArray (string &s, int num_chars)
 Read in num_chars to the string s. More...
 
void readCharArray (char *array, int num_chars)
 Read in num_chars to the presized character array. More...
 
double readDouble ()
 Read double data. More...
 
double readDouble (int pos)
 Read in a single double starting at the input position and return it. More...
 
void readDoubleArray (double *array, int num_doubles)
 Read in num_doubles into the input array. More...
 
double readDoubleNC ()
 Read in a single double and return it. More...
 
float readFloat ()
 Read float data. More...
 
float readFloat (int pos)
 Read in a single float starting at the input position and return it. More...
 
void readFloatArray (float *array, int num_floats)
 Read in num_floats into the input array. More...
 
float readFloatNC ()
 Read in a single float and return it. More...
 
void readFromFile (const string &filename)
 Read and fills the buffer from the input file name. More...
 
void readFromFile (const string &filename, int num_bytes)
 Read num_bytes from input file (Partial read). More...
 
void readFromFile (ifstream &ifs, int num_bytes)
 Reads num_bytes data from the input ifstream into this buffer. More...
 
int readInt ()
 Read int data. More...
 
int readInt (int pos)
 Read in a single int starting at the input position and return it. More...
 
void readIntArray (int *array, int num_ints)
 Read in num_ints into the input array. More...
 
int readIntNC ()
 Read in a single int and return it. More...
 
LONG_INT readLong ()
 Read long data. More...
 
LONG_INT readLong (int pos)
 Read in a single long starting at the input position and return it. More...
 
void readLongArray (LONG_INT *array, int num_longs)
 Read in num_longs into the input array. More...
 
LONG_INT readLongNC ()
 Read in a single long and return it. More...
 
short readShort ()
 Read short data. More...
 
short readShort (int pos)
 Read in a single short starting at the input position and return it. More...
 
void readShortArray (short *array, int num_shorts)
 Read in num_shorts into the input array. More...
 
short readShortNC ()
 Read in a single short and return it. More...
 
string readString ()
 Read string data. More...
 
void readString (string &s)
 Read in a string and assign it to s. More...
 
void readType (string &s)
 Read in a string and assign it to s. More...
 
void readType (bool &b)
 Read in a single bool and assign to s. More...
 
void readType (byte &b)
 Read in a single byte and assign to s. More...
 
void readType (short &s)
 Read in a single short and assign to s. More...
 
void readType (int &i)
 Read in a single int and assign to i. More...
 
void readType (LONG_INT &l)
 Read in a single long and assign to l. More...
 
void readType (float &f)
 Read in a single float and assign to f. More...
 
void readType (double &d)
 Read in a single double and assign to d. More...
 
void readTypeArray (string &array, int num_chars)
 Read in num_chars to the string s. More...
 
void readTypeArray (bool *array, int num_bools)
 Read in num_bools into the input array. More...
 
void readTypeArray (byte *array, int num_bs)
 Read in num_bytes into the input array. More...
 
void readTypeArray (short *array, int num_shorts)
 Read in num_shorts into the input array. More...
 
void readTypeArray (int *array, int num_ints)
 Read in num_ints into the input array. More...
 
void readTypeArray (LONG_INT *array, int num_longs)
 Read in num_longs into the input array. More...
 
void readTypeArray (float *array, int num_floats)
 Read in num_floats into the input array. More...
 
void readTypeArray (double *array, int num_doubles)
 Read in num_doubles into the input array. More...
 
void reserve (int sze)
 Sets the storage capacity. More...
 
void resetPos ()
 Reset the current iterator position to the beginning of the buffer. More...
 
void reSize (int spc)
 This function allocates spc bytes in the buffer. More...
 
void setBoundaryAlignment (bool align)
 Sets the intrinsic boundary alignment flag to align. More...
 
void setByteOrderReverse (bool bor)
 Sets the byte order reverse flag to bor. More...
 
void setMemoryCapacityIncrement (int mci)
 Set the amount of memory increase (bytes) for bData everytime it's current capacity is exceeded (defaults to 1MB = 1000000). More...
 
void setPosToEnd ()
 Set the current iterator position to the end of the buffer. More...
 
int size ()
 Returns the IFStreamBinary size. More...
 
void writeBool (bool b)
 Write bool data. More...
 
void writeBool (bool b, int pos)
 Write the input bool at the input buffer position. More...
 
void writeBoolArray (const bool *array, int num_bools)
 Write num_bools from the input bool array to the output buffer. More...
 
void writeBoolNC (bool b)
 Write the input bool at the current buffer position. More...
 
void writeByte (byte b)
 Write byte data. More...
 
void writeByte (byte b, int pos)
 Write the input byte at the input buffer position. More...
 
void writeByteArray (const byte *array, int num_bytes)
 Write num_bytes from the input byte array to the output buffer. More...
 
void writeByteNC (byte b)
 Write the input byte at the current buffer position. More...
 
void writeCharArray (const char *array, int num_chars)
 Write num_chars from the input character array to the output buffer. More...
 
void writeDouble (double d)
 Write double data. More...
 
void writeDouble (double d, int pos)
 Write the input double at the input buffer position. More...
 
void writeDoubleArray (const double *array, int num_doubles)
 Write num_doubles from the input double array to the output buffer. More...
 
void writeDoubleNC (double d)
 Write the input double at the current buffer position. More...
 
void writeFloat (float f)
 Write float data. More...
 
void writeFloat (float f, int pos)
 Write the input float at the input buffer position. More...
 
void writeFloatArray (const float *array, int num_floats)
 Write num_floats from the input float array to the output buffer. More...
 
void writeFloatNC (float f)
 Write the input float at the current buffer position. More...
 
void writeInt (int i)
 Write int data. More...
 
void writeInt (int i, int pos)
 Write the input int at the input buffer position. More...
 
void writeIntArray (const int *array, int num_ints)
 Write num_ints from the input int array to the output buffer. More...
 
void writeIntNC (int i)
 Write the input int at the current buffer position. More...
 
void writeLong (LONG_INT l)
 Write long data. More...
 
void writeLong (LONG_INT l, int pos)
 Write the input long at the input buffer position. More...
 
void writeLongArray (const LONG_INT *array, int num_longs)
 Write num_longs from the input long array to the output buffer. More...
 
void writeLongNC (LONG_INT l)
 Write the input long at the current buffer position. More...
 
void writeShort (short i)
 Write short data. More...
 
void writeShort (short i, int pos)
 Write the input short at the input buffer position. More...
 
void writeShortArray (const short *array, int num_ints)
 Write num_shorts from the input short array to the output buffer. More...
 
void writeShortNC (short i)
 Write the input short at the current buffer position. More...
 
void writeString (const string &str)
 Write string data to 'this' IFStreamBinary. More...
 
void writeString (const char *char_string)
 Write the null terminated character string at the current buffer position. More...
 
void writeToFile (const string &filename)
 Write the buffer to the output file name. More...
 
void writeToFile (ofstream &ofs)
 Write the buffer to the output stream. More...
 
void writeType (const string &str)
 Write the input string at the current buffer position. More...
 
void writeType (const char *char_string)
 Write the null terminated character string at the current buffer position. More...
 
void writeType (bool b)
 Write the input bool at the current buffer position. More...
 
void writeType (byte b)
 Write the input byte at the current buffer position. More...
 
void writeType (short i)
 Write the input short at the current buffer position. More...
 
void writeType (int i)
 Write the input int at the current buffer position. More...
 
void writeType (LONG_INT l)
 Write the input long at the current buffer position. More...
 
void writeType (float f)
 Write the input float at the current buffer position. More...
 
void writeType (double d)
 Write the input double at the current buffer position. More...
 
void writeTypeArray (const bool *array, int num_bools)
 Write num_bools from the input bool array to the output buffer. More...
 
void writeTypeArray (const byte *array, int num_bytes)
 Write num_bytes from the input byte array to the output buffer. More...
 
void writeTypeArray (const short *array, int num_ints)
 Write num_shorts from the input short array to the output buffer. More...
 
void writeTypeArray (const int *array, int num_ints)
 Write num_ints from the input int array to the output buffer. More...
 
void writeTypeArray (const LONG_INT *array, int num_longs)
 Write num_longs from the input long array to the output buffer. More...
 
void writeTypeArray (const float *array, int num_floats)
 Write num_floats from the input float array to the output buffer. More...
 
void writeTypeArray (const double *array, int num_doubles)
 Write num_doubles from the input double array to the output buffer. More...
 

Static Public Member Functions

static string className ()
 
static int classSize ()
 
static bool exists (const string &filename)
 Static function that returns true if the input filename exists. More...
 

Protected Member Functions

void align2Byte ()
 Ensure that the buffer position pointer (dbDataPos) is aligned on a 4 byte boundary. More...
 
void align4Byte ()
 Ensure that the buffer position pointer (dbDataPos) is aligned on a 4 byte boundary. More...
 
void align8Byte ()
 Ensure that the buffer position pointer (dbDataPos) is aligned on a 8 byte boundary. More...
 
void checkBufferSize (int sincr)
 This function checks to make sure that the buffer is large enough to contain sincr more bytes ... More...
 

Static Protected Member Functions

static void reverseBO2 (char *d)
 Reverses byte order of d. More...
 
static void reverseBO2Array (int n, char *a)
 
static void reverseBO4 (char *d)
 Reverses byte order of d. More...
 
static void reverseBO4Array (int n, char *a)
 
static void reverseBO8 (char *d)
 Reverses byte order of d. More...
 
static void reverseBO8Array (int n, char *a)
 
static void reverseBOArray (int n, char *a, int s)
 

Protected Attributes

bool bAlign
 A boolean, that if true, maintains 4 and 8 byte alignment in support of double alignment compilation. More...
 
string * bData
 A string object is used to contain the actual data. More...
 
int bDataPos
 The current iterator position in the data container (dbData). More...
 
string bFileName
 
int bMemIncr
 
bool bOwnStr
 A boolean, that if true, indicates the storage string for this IFStreamBinary is owned and therefore deleted when the IFStreamBinary is deleted. More...
 
bool bReverse
 A boolean, that if true, reverses the byte order of all 2, 4, and 8 byte intrinsics (shorts, ints, long, floats, doubles, etc.). More...
 
int bSize
 The current size of the data container. More...
 

Detailed Description

Opens a file for binary read and write access.

Opens a file for binary read and write access. The read portion is configured to parse binary files using standard readType(...) functionality.

Functionality is provided to read elemental, strings, booleans, bytes, shorts, ints, longs, floats, or doubles, as-well-as array input forms of each (except strings). The binary file can be read in intrinsic alignment form (somewhat faster) where doubles and longs are assumed to be read (and written) along 8 bytes boundaries, floats and ints are aligned on 4 byte boundaries, and shorts are aligned on a 2 byte boundary. A little/big-endian byte reversal flag can be set to reverse the byte structure if necessary.

Constructor & Destructor Documentation

geotess::IFStreamBinary::IFStreamBinary ( )

Public Default Constructor.

geotess::IFStreamBinary::IFStreamBinary ( bool  align)

Standard constructor that sets the padding (alignment) option to align.

geotess::IFStreamBinary::IFStreamBinary ( const string &  filename)

Standard constructor creates a new IFStreamBinary and opens reads its buffer from the input filename.

geotess::IFStreamBinary::IFStreamBinary ( const string &  filename,
int  num_bytes 
)

Standard constructor creates a new IFStreamBinary and opens reads its buffer from the input filename.

geotess::IFStreamBinary::IFStreamBinary ( string *  str)

Standard constructor that uses a provided string ptr as the data container.

geotess::IFStreamBinary::IFStreamBinary ( const IFStreamBinary db)

Copy Constructor.

virtual geotess::IFStreamBinary::~IFStreamBinary ( )
virtual

Public destructor.

Member Function Documentation

void geotess::IFStreamBinary::align2Byte ( )
inlineprotected

Ensure that the buffer position pointer (dbDataPos) is aligned on a 4 byte boundary.

void geotess::IFStreamBinary::align4Byte ( )
inlineprotected

Ensure that the buffer position pointer (dbDataPos) is aligned on a 4 byte boundary.

void geotess::IFStreamBinary::align8Byte ( )
inlineprotected

Ensure that the buffer position pointer (dbDataPos) is aligned on a 8 byte boundary.

void geotess::IFStreamBinary::boundaryAlignmentOff ( )
inline

Turns off intrinsic boundary alignment.

void geotess::IFStreamBinary::boundaryAlignmentOn ( )
inline

Turns on intrinsic boundary alignment.

void geotess::IFStreamBinary::byteOrderReverseOff ( )
inline

Turns off byte order reversal.

void geotess::IFStreamBinary::byteOrderReverseOn ( )
inline

Turns on byte order reversal.

void geotess::IFStreamBinary::checkBufferSize ( int  sincr)
inlineprotected

This function checks to make sure that the buffer is large enough to contain sincr more bytes ...

if not it is resized so that it can.

static string geotess::IFStreamBinary::className ( )
inlinestatic
static int geotess::IFStreamBinary::classSize ( )
inlinestatic
void geotess::IFStreamBinary::clear ( )
inline

Clears the buffer.

void geotess::IFStreamBinary::decrementPos ( int  decrement = 1)
inline

Decrement the iterator position.

void geotess::IFStreamBinary::dumpBuffer ( )

Debug dump of the data.

static bool geotess::IFStreamBinary::exists ( const string &  filename)
static

Static function that returns true if the input filename exists.

int geotess::IFStreamBinary::getCapacity ( ) const
inline

Return the allocated capacity of this IFStreamBinary.

const string& geotess::IFStreamBinary::getData ( ) const
inline

Return a const reference to 'this' IFStreamBinarys data.

const string& geotess::IFStreamBinary::getFileName ( ) const
inline

Return the file name with which this binary reader was opened.

int geotess::IFStreamBinary::getPos ( ) const
inline

Get the current iterator position.

char* geotess::IFStreamBinary::getPosPointer ( )
inline

Return a pointer at the current iterator location in the IFStreamBinary data.

char* geotess::IFStreamBinary::getPosPointer ( int  pos)
inline

Return a pointer to position pos in 'this' IFStreamBinarys data.

void geotess::IFStreamBinary::incrementPos ( int  increment = 1)
inline

Increment the iterator position.

bool geotess::IFStreamBinary::isBoundaryAlignmentOn ( ) const
inline

Returns true if the byte order in reads and writes is reversed for all 2, 4, or 8 byte intrinsincs (short, int, long, float, double, etc.).

bool geotess::IFStreamBinary::isByteOrderReversalOn ( ) const
inline

Returns true if the byte order in reads and writes is reversed for all 2, 4, or 8 byte intrinsincs (short, int, long, float, double, etc.).

IFStreamBinary& geotess::IFStreamBinary::operator= ( const IFStreamBinary db)

Assignment operator.

bool geotess::IFStreamBinary::readBool ( )
inline

Read bool data.

Read in a single bool and return it.

readBool() reads one bool from the IFStreamBinary and updates buffer iterator. The second form specifies where to read but does not update the iterator. The last form reads num_bool into the input array. readType is for templatization and behaves like readBool(). Similarly, readTypeArray behaves as readBoolArray.

bool geotess::IFStreamBinary::readBool ( int  pos)
inline

Read in a single bool starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readBoolArray ( bool *  array,
int  num_bools 
)
inline

Read in num_bools into the input array.

byte geotess::IFStreamBinary::readByte ( )
inline

Read byte data.

Read in a single byte and return it.

readByte() reads one byte from the IFStreamBinary and updates buffer iterator. The second form specifies where to read but does not update the iterator. The last form reads num_bytes into the input array. readType is for templatization and behaves like readByte(). Similarly, readTypeArray behaves as readByteArray.

byte geotess::IFStreamBinary::readByte ( int  pos)
inline

Read in a single byte starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readByteArray ( byte array,
int  num_bs 
)
inline

Read in num_bytes into the input array.

void geotess::IFStreamBinary::readCharArray ( string &  s,
int  num_chars 
)
inline

Read in num_chars to the string s.

void geotess::IFStreamBinary::readCharArray ( char *  array,
int  num_chars 
)
inline

Read in num_chars to the presized character array.

double geotess::IFStreamBinary::readDouble ( )
inline

Read double data.

Read in a single double and return it.

readDouble() reads one double from the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment is assumed to be ok (not checked). The third form specifies where to read but does not update the iterator or check alignment. The last form reads num_doubles into the input array. readType is for templatization and behaves like readDouble(). Similarly, readTypeArray behaves as readDoubleArray.

double geotess::IFStreamBinary::readDouble ( int  pos)
inline

Read in a single double starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readDoubleArray ( double *  array,
int  num_doubles 
)
inline

Read in num_doubles into the input array.

double geotess::IFStreamBinary::readDoubleNC ( )
inline

Read in a single double and return it.

Don't check for alignment.

float geotess::IFStreamBinary::readFloat ( )
inline

Read float data.

Read in a single float and return it.

readFloat() reads one float from the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment is assumed to be ok (not checked). The third form specifies where to read but does not update the iterator or check alignment. The last form reads num_floats into the input array. readType is for templatization and behaves like readFloat(). Similarly, readTypeArray behaves as readFloatArray.

float geotess::IFStreamBinary::readFloat ( int  pos)
inline

Read in a single float starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readFloatArray ( float *  array,
int  num_floats 
)
inline

Read in num_floats into the input array.

float geotess::IFStreamBinary::readFloatNC ( )
inline

Read in a single float and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readFromFile ( const string &  filename)

Read and fills the buffer from the input file name.

void geotess::IFStreamBinary::readFromFile ( const string &  filename,
int  num_bytes 
)

Read num_bytes from input file (Partial read).

void geotess::IFStreamBinary::readFromFile ( ifstream &  ifs,
int  num_bytes 
)

Reads num_bytes data from the input ifstream into this buffer.

the read begins at position file_pos in the input stream. Reads num_bytes data from the input ifstream into this buffer.

int geotess::IFStreamBinary::readInt ( )
inline

Read int data.

Read in a single int and return it.

readInt() reads one int from the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment is assumed to be ok (not checked). The third form specifies where to read but does not update the iterator or check alignment. The last form reads num_ints into the input array. readType is for templatization and behaves like readInt(). Similarly, readTypeArray behaves as readIntArray.

int geotess::IFStreamBinary::readInt ( int  pos)
inline

Read in a single int starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readIntArray ( int *  array,
int  num_ints 
)
inline

Read in num_ints into the input array.

int geotess::IFStreamBinary::readIntNC ( )
inline

Read in a single int and return it.

Don't check for alignment.

LONG_INT geotess::IFStreamBinary::readLong ( )
inline

Read long data.

Read in a single long and return it.

readLong() reads one long from the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment is assumed to be ok (not checked). The third form specifies where to read but does not update the iterator or check alignment. The last form reads num_longs into the input array. readType is for templatization and behaves like readLong(). Similarly, readTypeArray behaves as readLongArray.

LONG_INT geotess::IFStreamBinary::readLong ( int  pos)
inline

Read in a single long starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readLongArray ( LONG_INT array,
int  num_longs 
)
inline

Read in num_longs into the input array.

LONG_INT geotess::IFStreamBinary::readLongNC ( )
inline

Read in a single long and return it.

Don't check for alignment.

short geotess::IFStreamBinary::readShort ( )
inline

Read short data.

Read in a single short and return it.

readShort() reads one short from the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment is assumed to be ok (not checked). The third form specifies where to read but does not update the iterator or check alignment. The last form reads num_shorts into the input array. readType is for templatization and behaves like readShort(). Similarly, readTypeArray behaves as readShortArray.

short geotess::IFStreamBinary::readShort ( int  pos)
inline

Read in a single short starting at the input position and return it.

Don't check for alignment.

void geotess::IFStreamBinary::readShortArray ( short *  array,
int  num_shorts 
)
inline

Read in num_shorts into the input array.

short geotess::IFStreamBinary::readShortNC ( )
inline

Read in a single short and return it.

Don't check for alignment.

string geotess::IFStreamBinary::readString ( )
inline

Read string data.

Read in a single string and return it.

readString() assumes the string length immediately precedes the string data. readString(string& s) is the same as the first but assigns the string to the input reference. The next two functions read in num_chars and assign them into the input string reference s, or presized character array, respectively. The functions readType* are for templatized access.

void geotess::IFStreamBinary::readString ( string &  s)
inline

Read in a string and assign it to s.

void geotess::IFStreamBinary::readType ( string &  s)
inline

Read in a string and assign it to s.

void geotess::IFStreamBinary::readType ( bool &  b)
inline

Read in a single bool and assign to s.

void geotess::IFStreamBinary::readType ( byte b)
inline

Read in a single byte and assign to s.

void geotess::IFStreamBinary::readType ( short &  s)
inline

Read in a single short and assign to s.

void geotess::IFStreamBinary::readType ( int &  i)
inline

Read in a single int and assign to i.

void geotess::IFStreamBinary::readType ( LONG_INT l)
inline

Read in a single long and assign to l.

void geotess::IFStreamBinary::readType ( float &  f)
inline

Read in a single float and assign to f.

void geotess::IFStreamBinary::readType ( double &  d)
inline

Read in a single double and assign to d.

void geotess::IFStreamBinary::readTypeArray ( string &  array,
int  num_chars 
)
inline

Read in num_chars to the string s.

void geotess::IFStreamBinary::readTypeArray ( bool *  array,
int  num_bools 
)
inline

Read in num_bools into the input array.

void geotess::IFStreamBinary::readTypeArray ( byte array,
int  num_bs 
)
inline

Read in num_bytes into the input array.

void geotess::IFStreamBinary::readTypeArray ( short *  array,
int  num_shorts 
)
inline

Read in num_shorts into the input array.

void geotess::IFStreamBinary::readTypeArray ( int *  array,
int  num_ints 
)
inline

Read in num_ints into the input array.

void geotess::IFStreamBinary::readTypeArray ( LONG_INT array,
int  num_longs 
)
inline

Read in num_longs into the input array.

void geotess::IFStreamBinary::readTypeArray ( float *  array,
int  num_floats 
)
inline

Read in num_floats into the input array.

void geotess::IFStreamBinary::readTypeArray ( double *  array,
int  num_doubles 
)
inline

Read in num_doubles into the input array.

void geotess::IFStreamBinary::reserve ( int  sze)
inline

Sets the storage capacity.

Attained on next required resize.

void geotess::IFStreamBinary::resetPos ( )
inline

Reset the current iterator position to the beginning of the buffer.

void geotess::IFStreamBinary::reSize ( int  spc)
inline

This function allocates spc bytes in the buffer.

Used to minimize reallocation.

void geotess::IFStreamBinary::reverseBO2 ( char *  d)
inlinestaticprotected

Reverses byte order of d.

d is assumed to point to an 2 byte element.

static void geotess::IFStreamBinary::reverseBO2Array ( int  n,
char *  a 
)
staticprotected
void geotess::IFStreamBinary::reverseBO4 ( char *  d)
inlinestaticprotected

Reverses byte order of d.

d is assumed to point to an 4 byte element.

static void geotess::IFStreamBinary::reverseBO4Array ( int  n,
char *  a 
)
staticprotected
void geotess::IFStreamBinary::reverseBO8 ( char *  d)
inlinestaticprotected

Reverses byte order of d.

d is assumed to point to an 8 byte element.

static void geotess::IFStreamBinary::reverseBO8Array ( int  n,
char *  a 
)
staticprotected
static void geotess::IFStreamBinary::reverseBOArray ( int  n,
char *  a,
int  s 
)
staticprotected
void geotess::IFStreamBinary::setBoundaryAlignment ( bool  align)
inline

Sets the intrinsic boundary alignment flag to align.

void geotess::IFStreamBinary::setByteOrderReverse ( bool  bor)
inline

Sets the byte order reverse flag to bor.

void geotess::IFStreamBinary::setMemoryCapacityIncrement ( int  mci)
inline

Set the amount of memory increase (bytes) for bData everytime it's current capacity is exceeded (defaults to 1MB = 1000000).

void geotess::IFStreamBinary::setPosToEnd ( )
inline

Set the current iterator position to the end of the buffer.

int geotess::IFStreamBinary::size ( )
inline

Returns the IFStreamBinary size.

void geotess::IFStreamBinary::writeBool ( bool  b)
inline

Write bool data.

Write the input bool at the current buffer position.

writeBool writes one byte to the IFStreamBinary and updates buffer iterator. The second form is like the first except that sufficient buffer size is not checked. The third form simply writes the data at the input position (pos) but does not check for buffer size, nor does it update the internal buffer iterator. The last method writes num_bools from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeBool. Similarly, writeTypeArray behaves like writeBoolArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeBool ( bool  b,
int  pos 
)
inline

Write the input bool at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeBoolArray ( const bool *  array,
int  num_bools 
)
inline

Write num_bools from the input bool array to the output buffer.

void geotess::IFStreamBinary::writeBoolNC ( bool  b)
inline

Write the input bool at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeByte ( byte  b)
inline

Write byte data.

Write the input byte at the current buffer position.

writeByte writes one byte to the IFStreamBinary and updates buffer iterator. The second form is like the first except that sufficient buffer size is not checked. The third form simply writes the data at the input position (pos) but does not check for buffer size, nor does it update the internal buffer iterator. The last method writes num_bytes from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeByte. Similarly, writeTypeArray behaves like writeByteArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeByte ( byte  b,
int  pos 
)
inline

Write the input byte at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeByteArray ( const byte array,
int  num_bytes 
)
inline

Write num_bytes from the input byte array to the output buffer.

void geotess::IFStreamBinary::writeByteNC ( byte  b)
inline

Write the input byte at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeCharArray ( const char *  array,
int  num_chars 
)
inline

Write num_chars from the input character array to the output buffer.

void geotess::IFStreamBinary::writeDouble ( double  d)
inline

Write double data.

Write the input double at the current buffer position.

writeDouble writes one double to the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment and sufficient buffer size are not checked. The third form simply writes the data at the input position (pos) but does not check for alignment, buffer size, nor does it update the internal buffer iterator. The last method writes num_doubles from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeDouble. Similarly, writeTypeArray behaves like writeDoubleArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeDouble ( double  d,
int  pos 
)
inline

Write the input double at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeDoubleArray ( const double *  array,
int  num_doubles 
)
inline

Write num_doubles from the input double array to the output buffer.

void geotess::IFStreamBinary::writeDoubleNC ( double  d)
inline

Write the input double at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeFloat ( float  f)
inline

Write float data.

Write the input float at the current buffer position.

writeFloat writes one float to the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment and sufficient buffer size are not checked. The third form simply writes the data at the input position (pos) but does not check for alignment, buffer size, nor does it update the internal buffer iterator. The last method writes num_floats from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeFloat. Similarly, writeTypeArray behaves like writeFloatArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeFloat ( float  f,
int  pos 
)
inline

Write the input float at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeFloatArray ( const float *  array,
int  num_floats 
)
inline

Write num_floats from the input float array to the output buffer.

void geotess::IFStreamBinary::writeFloatNC ( float  f)
inline

Write the input float at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeInt ( int  i)
inline

Write int data.

Write the input int at the current buffer position.

writeInt writes one int to the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment and sufficient buffer size are not checked. The third form simply writes the data at the input position (pos) but does not check for alignment, buffer size, nor does it update the internal buffer iterator. The last method writes num_ints from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeInt. Similarly, writeTypeArray behaves like writeIntArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeInt ( int  i,
int  pos 
)
inline

Write the input int at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeIntArray ( const int *  array,
int  num_ints 
)
inline

Write num_ints from the input int array to the output buffer.

void geotess::IFStreamBinary::writeIntNC ( int  i)
inline

Write the input int at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeLong ( LONG_INT  l)
inline

Write long data.

Write the input long at the current buffer position.

writeLong writes one long to the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment and sufficient buffer size are not checked. The third form simply writes the data at the input position (pos) but does not check for alignment, buffer size, nor does it update the internal buffer iterator. The last method writes num_longs from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeLong. Similarly, writeTypeArray behaves like writeLongArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeLong ( LONG_INT  l,
int  pos 
)
inline

Write the input long at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeLongArray ( const LONG_INT array,
int  num_longs 
)
inline

Write num_longs from the input long array to the output buffer.

void geotess::IFStreamBinary::writeLongNC ( LONG_INT  l)
inline

Write the input long at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeShort ( short  s)
inline

Write short data.

Write the input short at the current buffer position.

writeShort writes one short to the IFStreamBinary and updates buffer iterator. The second form is like the first except that byte alignment and sufficient buffer size are not checked. The third form simply writes the data at the input position (pos) but does not check for alignment, buffer size, nor does it update the internal buffer iterator. The last method writes num_shorts from the input array into 'this' IFStreamBinary. writeType is for templatization and behaves like writeShort. Similarly, writeTypeArray behaves like writeShortArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeShort ( short  s,
int  pos 
)
inline

Write the input short at the input buffer position.

Don't check for alignment or sufficient buffer size. Don't update the internal buffer position.

void geotess::IFStreamBinary::writeShortArray ( const short *  array,
int  num_ints 
)
inline

Write num_shorts from the input short array to the output buffer.

void geotess::IFStreamBinary::writeShortNC ( short  s)
inline

Write the input short at the current buffer position.

Don't check for alignment or sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeString ( const string &  str)
inline

Write string data to 'this' IFStreamBinary.

Write the input string at the current buffer position.

The two writeString functions first writes the the input string length immediately followed by the string data. The next function writes num_chars from the input character array into 'this' IFStreamBinary. readType is for templatization and behaves like readString(). Similarly, readTypeArray behaves like readCharArray.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit. Both the string size (int) and the strings data are written.

void geotess::IFStreamBinary::writeString ( const char *  char_string)
inline

Write the null terminated character string at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit. Both the string size (int) and its data are written.

void geotess::IFStreamBinary::writeToFile ( const string &  filename)

Write the buffer to the output file name.

void geotess::IFStreamBinary::writeToFile ( ofstream &  ofs)

Write the buffer to the output stream.

void geotess::IFStreamBinary::writeType ( const string &  str)
inline

Write the input string at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit. Both the string size (int) and the strings data are written.

void geotess::IFStreamBinary::writeType ( const char *  char_string)
inline

Write the null terminated character string at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit. Both the string size (int) and its data are written.

void geotess::IFStreamBinary::writeType ( bool  b)
inline

Write the input bool at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeType ( byte  b)
inline

Write the input byte at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeType ( short  s)
inline

Write the input short at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeType ( int  i)
inline

Write the input int at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeType ( LONG_INT  l)
inline

Write the input long at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeType ( float  f)
inline

Write the input float at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeType ( double  d)
inline

Write the input double at the current buffer position.

Ensure alignment and sufficient buffer size. Increment the internal buffer position on exit.

void geotess::IFStreamBinary::writeTypeArray ( const bool *  array,
int  num_bools 
)
inline

Write num_bools from the input bool array to the output buffer.

void geotess::IFStreamBinary::writeTypeArray ( const byte array,
int  num_bytes 
)
inline

Write num_bytes from the input byte array to the output buffer.

void geotess::IFStreamBinary::writeTypeArray ( const short *  array,
int  num_ints 
)
inline

Write num_shorts from the input short array to the output buffer.

void geotess::IFStreamBinary::writeTypeArray ( const int *  array,
int  num_ints 
)
inline

Write num_ints from the input int array to the output buffer.

void geotess::IFStreamBinary::writeTypeArray ( const LONG_INT array,
int  num_longs 
)
inline

Write num_longs from the input long array to the output buffer.

void geotess::IFStreamBinary::writeTypeArray ( const float *  array,
int  num_floats 
)
inline

Write num_floats from the input float array to the output buffer.

void geotess::IFStreamBinary::writeTypeArray ( const double *  array,
int  num_doubles 
)
inline

Write num_doubles from the input double array to the output buffer.

Member Data Documentation

bool geotess::IFStreamBinary::bAlign
protected

A boolean, that if true, maintains 4 and 8 byte alignment in support of double alignment compilation.

string* geotess::IFStreamBinary::bData
protected

A string object is used to contain the actual data.

int geotess::IFStreamBinary::bDataPos
protected

The current iterator position in the data container (dbData).

string geotess::IFStreamBinary::bFileName
protected
int geotess::IFStreamBinary::bMemIncr
protected
bool geotess::IFStreamBinary::bOwnStr
protected

A boolean, that if true, indicates the storage string for this IFStreamBinary is owned and therefore deleted when the IFStreamBinary is deleted.

bool geotess::IFStreamBinary::bReverse
protected

A boolean, that if true, reverses the byte order of all 2, 4, and 8 byte intrinsics (shorts, ints, long, floats, doubles, etc.).

This flag is set by client using this IFStreamBinary (default to false ... no reversal). The flag is used to convert byte order between big- and little- endian formats.

int geotess::IFStreamBinary::bSize
protected

The current size of the data container.


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