BinexData::UBNXI Class Reference

#include <BinexData.hpp>

List of all members.


Detailed Description

An unsigned integer stored using 1, 2, 3, or 4 bytes to represent integers from 0 to 536870911; used to represent BINEX record IDs, subrecord IDs, field IDs, and so on.

Definition at line 87 of file BinexData.hpp.

Public Member Functions

 UBNXI ()
 Default constructor - sets value to 0.
 UBNXI (const UBNXI &other)
 Copy constructor.
 throw (FFStreamError)
 Constructor with unsigned long initialization value.
UBNXIoperator= (const UBNXI &right)
 Copies another UBNXI.
bool operator== (const UBNXI &other) const
 Compares two UBNXI's for equality.
bool operator!= (const UBNXI &other) const
 Compares two UBNXI's for inequality.
bool operator< (const UBNXI &other) const
 Returns whether this UBNXI is less than the other.
bool operator<= (const UBNXI &other) const
 Returns whether this UBNXI is less than or equal to the other.
bool operator> (const UBNXI &other) const
 Returns whether this UBNXI is greater than the other.
bool operator>= (const UBNXI &other) const
 Returns whether this UBNXI is greater than or equal to the other.
 operator unsigned long () const
 Returns the value of the UBNXI as an unsigned long.
size_t getSize () const
 Returns the number of bytes required to represent the UBNXI.
size_t decode (const std::string &inBuffer, size_t offset=0, bool littleEndian=false) throw (FFStreamError)
 Attempts to decode a valid UBNXI from the contents of inBuffer.
size_t encode (std::string &outBuffer, size_t offset=0, bool littleEndian=false) const
 Converts the UBNXI to a series of bytes placed in outBuffer.
size_t read (std::istream &strm, std::string *outBuffer=NULL, size_t offset=0, bool reverseBytes=false, bool littleEndian=false) throw (FFStreamError)
 Attempts to read a valid UBNXI from the specified input stream.
size_t write (std::ostream &strm, std::string *outBuffer=NULL, size_t offset=0, bool reverseBytes=false, bool littleEndian=false) const throw (FFStreamError)
 Attempts to write the UBNXI to the specified output stream.

Static Public Attributes

const unsigned long MIN_VALUE = 0
const unsigned long MAX_VALUE = 536870911
const unsigned char MAX_BYTES = 4

Protected Attributes

unsigned long value
size_t size


Constructor & Destructor Documentation

UBNXI  ) 
 

Default constructor - sets value to 0.

Definition at line 44 of file BinexData.cpp.

References BinexData::UBNXI::size, and BinexData::UBNXI::value.

UBNXI const UBNXI other  )  [inline]
 

Copy constructor.

Definition at line 103 of file BinexData.hpp.


Member Function Documentation

size_t decode const std::string &  inBuffer,
size_t  offset = 0,
bool  littleEndian = false
throw (FFStreamError)
 

Attempts to decode a valid UBNXI from the contents of inBuffer.

The contents of inBuffer are assumed to be in normal order (i.e. not reversed) but may be either big or little endian.

Parameters:
inBuffer Sequence of bytes to decode
offset Offset into inBuffer at which to decode
littleEndian Byte order of the encoded bytes
Returns:
Number of bytes decoded

Definition at line 87 of file BinexData.cpp.

References GPSTK_THROW.

Referenced by BinexData::extractMessageData(), and BinexData::reallyGetRecord().

size_t encode std::string &  outBuffer,
size_t  offset = 0,
bool  littleEndian = false
const
 

Converts the UBNXI to a series of bytes placed in outBuffer.

The bytes are output in normal order (i.e. not reversed) but may encode in either big or little endian format.

Parameters:
outBuffer Sequence of encoded bytes
offset Offset into outBuffer at which to encode
littleEndian Optional flag indicating byte order of the encoded bytes
Returns:
Number of bytes used to encode

Definition at line 124 of file BinexData.cpp.

References GPSTK_THROW, BinexData::reverseBuffer(), and BinexData::UBNXI::size.

Referenced by BinexData::reallyPutRecord(), and BinexData::updateMessageData().

size_t getSize  )  const [inline]
 

Returns the number of bytes required to represent the UBNXI.

A size of 0 indicates an invalid or uninitialized UBNXI.

Definition at line 193 of file BinexData.hpp.

Referenced by BinexData::getRecordSize(), and BinexData::reallyPutRecord().

operator unsigned long  )  const [inline]
 

Returns the value of the UBNXI as an unsigned long.

Definition at line 183 of file BinexData.hpp.

bool operator!= const UBNXI other  )  const [inline]
 

Compares two UBNXI's for inequality.

Definition at line 138 of file BinexData.hpp.

References BinexData::UBNXI::value.

bool operator< const UBNXI other  )  const [inline]
 

Returns whether this UBNXI is less than the other.

Definition at line 147 of file BinexData.hpp.

References BinexData::UBNXI::value.

bool operator<= const UBNXI other  )  const [inline]
 

Returns whether this UBNXI is less than or equal to the other.

Definition at line 156 of file BinexData.hpp.

References BinexData::UBNXI::value.

UBNXI& operator= const UBNXI right  )  [inline]
 

Copies another UBNXI.

Definition at line 118 of file BinexData.hpp.

References BinexData::UBNXI::size, and BinexData::UBNXI::value.

bool operator== const UBNXI other  )  const [inline]
 

Compares two UBNXI's for equality.

Definition at line 129 of file BinexData.hpp.

References BinexData::UBNXI::value.

bool operator> const UBNXI other  )  const [inline]
 

Returns whether this UBNXI is greater than the other.

Definition at line 165 of file BinexData.hpp.

References BinexData::UBNXI::value.

bool operator>= const UBNXI other  )  const [inline]
 

Returns whether this UBNXI is greater than or equal to the other.

Definition at line 174 of file BinexData.hpp.

References BinexData::UBNXI::value.

size_t read std::istream &  strm,
std::string *  outBuffer = NULL,
size_t  offset = 0,
bool  reverseBytes = false,
bool  littleEndian = false
throw (FFStreamError)
 

Attempts to read a valid UBNXI from the specified input stream.

The stream can be in reverse order and can be big or little endian. If the method succeeds, the number of bytes used to contruct the UBNXI can be determined by calling the getSize() method.

Parameters:
strm Stream from which to read
outBuffer Optional buffer to receive copy of raw input
offset Offset into outBuffer at which to copy input
reverseBytes Optional flag indicating whether the input bytes are reversed
littleEndian Optional flag indicating byte order of input
Returns:
Number of bytes removed from the input stream

Definition at line 237 of file BinexData.cpp.

References GPSTK_THROW.

Referenced by BinexData::reallyGetRecord().

throw FFStreamError   ) 
 

Constructor with unsigned long initialization value.

size_t write std::ostream &  strm,
std::string *  outBuffer = NULL,
size_t  offset = 0,
bool  reverseBytes = false,
bool  littleEndian = false
const throw (FFStreamError)
 

Attempts to write the UBNXI to the specified output stream.

The stream can be output in reverse order and can be big or little endian. The method fails if the entire UBNXI cannot be written to the stream.

Parameters:
strm Stream in which to write
outBuffer Optional buffer to receive copy of raw ouput
offset Offset into outBuffer at which to copy output
reverseBytes Optional flag indicating whether the ouput bytes should be reversed
littleEndian Optional flag indicating byte order of output
Returns:
Number of bytes added to the output stream

Definition at line 301 of file BinexData.cpp.

References GPSTK_THROW, and BinexData::reverseBuffer().


Member Data Documentation

const unsigned char MAX_BYTES = 4 [static]
 

Definition at line 93 of file BinexData.hpp.

const unsigned long MAX_VALUE = 536870911 [static]
 

Definition at line 92 of file BinexData.hpp.

const unsigned long MIN_VALUE = 0 [static]
 

Definition at line 91 of file BinexData.hpp.

size_t size [protected]
 

Definition at line 274 of file BinexData.hpp.

Referenced by BinexData::UBNXI::encode(), BinexData::getCRC(), BinexData::getRecordSize(), BinexData::UBNXI::operator=(), BinexData::reallyGetRecord(), BinexData::reallyPutRecord(), and BinexData::UBNXI::UBNXI().

unsigned long value [protected]
 

Definition at line 273 of file BinexData.hpp.

Referenced by BinexData::UBNXI::operator!=(), BinexData::UBNXI::operator<(), BinexData::UBNXI::operator<=(), BinexData::UBNXI::operator=(), BinexData::UBNXI::operator==(), BinexData::UBNXI::operator>(), BinexData::UBNXI::operator>=(), and BinexData::UBNXI::UBNXI().


The documentation for this class was generated from the following files:
Generated on Mon May 20 03:31:44 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1