This class stores, reads, and writes BINEX records.
- See also
- binex_read_write.cpp for an example.
-
binex_test.cpp for an example.
-
BinexStream.
Definition at line 65 of file BinexData.hpp.
#include <BinexData.hpp>
|
| BinexData () |
|
| BinexData (const BinexData &other) |
|
| BinexData (RecordID recordID, SyncByte recordFlags=DEFAULT_RECORD_FLAGS) noexcept |
|
BinexData & | clearMessage () |
|
virtual void | dump (std::ostream &s) const |
|
BinexData & | ensureMessageCapacity (size_t cap) |
|
void | extractMessageData (size_t &offset, MGFZI &data) |
|
void | extractMessageData (size_t &offset, std::string &data, size_t size) const |
|
template<class T > |
void | extractMessageData (size_t &offset, T &data, size_t size) const |
|
void | extractMessageData (size_t &offset, UBNXI &data) |
|
size_t | getHeadLength () const |
|
const std::string & | getMessageData () const |
|
size_t | getMessageLength () const |
|
virtual size_t | getRecord (std::istream &s) |
|
SyncByte | getRecordFlags () const |
|
RecordID | getRecordID () const |
|
size_t | getRecordSize () const |
|
size_t | getTailLength () const |
|
virtual bool | isData (void) const |
|
BinexData & | operator= (const BinexData &right) |
|
bool | operator== (const BinexData &b) const |
|
virtual void | putRecord (std::ostream &s) const |
|
BinexData & | setRecordFlags (SyncByte flags=DEFAULT_RECORD_FLAGS) |
|
BinexData & | setRecordID (RecordID id) |
|
BinexData & | updateMessageData (size_t &offset, const char *data, size_t size) |
|
BinexData & | updateMessageData (size_t &offset, const MGFZI &data) |
|
BinexData & | updateMessageData (size_t &offset, const std::string &data, size_t size) |
|
template<class T > |
BinexData & | updateMessageData (size_t &offset, const T &data, size_t size) |
|
BinexData & | updateMessageData (size_t &offset, const UBNXI &data) |
|
virtual | ~BinexData () |
|
void | getRecord (FFStream &s) |
|
virtual bool | isHeader () const |
|
void | putRecord (FFStream &s) const |
|
virtual | ~FFData (void) |
| virtual desctuctor More...
|
|
|
static unsigned long long | parseBuffer (const std::string &buffer, size_t offset, size_t size) |
|
|
static void | reverseBuffer (std::string &buffer, size_t offset=0, size_t n=std::string::npos) |
|
template<class T > |
static void | reverseBytes (T &val) |
|
◆ RecordID
◆ SyncByte
Synchronization byte (record flags)
Definition at line 73 of file BinexData.hpp.
◆ recordFlagsEnum
0x38
Enumerator |
---|
eReverseReadable | |
eBigEndian | |
eEnhancedCRC | |
Definition at line 84 of file BinexData.hpp.
◆ BinexData() [1/3]
gnsstk::BinexData::BinexData |
( |
| ) |
|
◆ BinexData() [2/3]
◆ BinexData() [3/3]
◆ ~BinexData()
virtual gnsstk::BinexData::~BinexData |
( |
| ) |
|
|
inlinevirtual |
◆ clearMessage()
BinexData & gnsstk::BinexData::clearMessage |
( |
| ) |
|
Remove all data from the record message buffer.
Definition at line 1012 of file BinexData.cpp.
◆ dump()
void gnsstk::BinexData::dump |
( |
std::ostream & |
s | ) |
const |
|
virtual |
◆ ensureMessageCapacity()
BinexData & gnsstk::BinexData::ensureMessageCapacity |
( |
size_t |
cap | ) |
|
Reserves a number of bytes for storage of the record message. This number can grow as data is added to the message, but an adequate initial number results in greater efficiency. The actual length of the data in the message buffer is a separate and strictly smaller amount.
- Exceptions
-
Definition at line 1021 of file BinexData.cpp.
◆ extractMessageData() [1/4]
void gnsstk::BinexData::extractMessageData |
( |
size_t & |
offset, |
|
|
MGFZI & |
data |
|
) |
| |
Extracts a MGFZI from the message buffer. The location within the message buffer is set by the offset parameter. After extracting the MGFZI from the message buffer, the value of the offset parameter is updated by the MGFZI's size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to extract |
data | Location to store the extracted data |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 1129 of file BinexData.cpp.
◆ extractMessageData() [2/4]
void gnsstk::BinexData::extractMessageData |
( |
size_t & |
offset, |
|
|
std::string & |
data, |
|
|
size_t |
size |
|
) |
| const |
Extracts raw data from the message buffer. The location within the message buffer is set by the offset parameter, and the size of the data to extract is set by the size parameter. This method checks to ensure that all data is extracted from within the message buffer. After extracting data from the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to extract |
data | Location to store the extracted data |
size | Number of bytes of data to be extracted |
- Exceptions
-
Definition at line 1147 of file BinexData.cpp.
◆ extractMessageData() [3/4]
template<class T >
void gnsstk::BinexData::extractMessageData |
( |
size_t & |
offset, |
|
|
T & |
data, |
|
|
size_t |
size |
|
) |
| const |
|
inline |
Extracts data from the message buffer. The location within the message buffer is set by the offset parameter, and the size of the data to extract is set by the size parameter. This method checks to ensure that the value of the size parameter does not exceed sizeof(T) and that all data is extracted from within the message buffer. After extracting data from the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to extract |
data | Location to store the extracted data |
size | Number of bytes of data to be extracted |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 836 of file BinexData.hpp.
◆ extractMessageData() [4/4]
void gnsstk::BinexData::extractMessageData |
( |
size_t & |
offset, |
|
|
UBNXI & |
data |
|
) |
| |
Extracts a UBNXI from the message buffer. The location within the message buffer is set by the offset parameter. After extracting the UBNXI from the message buffer, the value of the offset parameter is updated by the UBNXI's size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to extract |
data | Location to store the extracted data |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 1111 of file BinexData.cpp.
◆ getCRC()
void gnsstk::BinexData::getCRC |
( |
const std::string & |
head, |
|
|
const std::string & |
message, |
|
|
std::string & |
crc |
|
) |
| const |
|
protected |
- Parameters
-
bufs | A NULL-terminated list of pointers to byte buffers |
bufLens | A list of lengths for the buffers specified by bufs |
crc | A pointer to the buffer in which to store the CRC |
crcLen | The number of bytes used to store the CRC |
Definition at line 1428 of file BinexData.cpp.
◆ getCRCLength()
size_t gnsstk::BinexData::getCRCLength |
( |
size_t |
crcDataLen | ) |
const |
|
protected |
Returns the number of bytes required to store the record's CRC based on the record's current contents.
Definition at line 1530 of file BinexData.cpp.
◆ getHeadLength()
size_t gnsstk::BinexData::getHeadLength |
( |
| ) |
const |
Returns the current length of the record head, i.e. the combined length of the synchronization byte, the record ID, and the message length. In other words, the returned length is the offset of the message data from the start of the record.
- Returns
- Record head length in bytes
Definition at line 1037 of file BinexData.cpp.
◆ getMessageData()
const std::string& gnsstk::BinexData::getMessageData |
( |
| ) |
const |
|
inline |
Returns a pointer to the raw message data. Note that the format of the data is dependent upon the record flags at the time the data was added to the message.
Definition at line 640 of file BinexData.hpp.
◆ getMessageLength()
size_t gnsstk::BinexData::getMessageLength |
( |
| ) |
const |
|
inline |
Returns the length of the data in the record message buffer (which is separate from the record message buffer's capacity).
- Returns
- Record message data length in bytes
Definition at line 615 of file BinexData.hpp.
◆ getRecord()
size_t gnsstk::BinexData::getRecord |
( |
std::istream & |
s | ) |
|
|
virtual |
Retrieves a BINEX record from the specified generic input stream.
- Returns
- the number of bytes parsed in the stream.
- Exceptions
-
std::exception | |
FFStreamError | |
StringUtils::StringException | |
Definition at line 1267 of file BinexData.cpp.
◆ getRecordFlags()
SyncByte gnsstk::BinexData::getRecordFlags |
( |
| ) |
const |
|
inline |
Returns flags indicating endianness, reversability, and CRC-mode of the current record. The individual flags can be extracted from the returned value by AND-ing with values from recordFlagsEnum.
Definition at line 536 of file BinexData.hpp.
◆ getRecordID()
RecordID gnsstk::BinexData::getRecordID |
( |
| ) |
const |
|
inline |
Returns the ID of this BINEX record.
Definition at line 561 of file BinexData.hpp.
◆ getRecordSize()
size_t gnsstk::BinexData::getRecordSize |
( |
| ) |
const |
Returns the number of bytes required to represent the entire record (based on the record's current contents).
Definition at line 989 of file BinexData.cpp.
◆ getTailLength()
size_t gnsstk::BinexData::getTailLength |
( |
| ) |
const |
|
inline |
Returns the current length of the record tail, i.e. the combined length of the CRC, the optional reverse length, and the optional synchronization byte. In other words, the returned length is the number of bytes in the record following the message data.
- Returns
- Record tail length in bytes
Definition at line 629 of file BinexData.hpp.
◆ isData()
virtual bool gnsstk::BinexData::isData |
( |
void |
| ) |
const |
|
inlinevirtual |
◆ isHeadSyncByteValid()
bool gnsstk::BinexData::isHeadSyncByteValid |
( |
SyncByte |
headSync, |
|
|
SyncByte & |
expectedTailSync |
|
) |
| const |
|
protected |
Determines whether the supplied head sync byte is valid an returns an expected correosponding tail sync byte if appropriate.
Definition at line 1575 of file BinexData.cpp.
◆ isTailSyncByteValid()
bool gnsstk::BinexData::isTailSyncByteValid |
( |
SyncByte |
tailSync, |
|
|
SyncByte & |
expectedHeadSync |
|
) |
| const |
|
protected |
Determines whether the supplied tail sync byte is valid an returns an expected correosponding head sync byte.
Definition at line 1611 of file BinexData.cpp.
◆ operator=()
◆ operator==()
◆ parseBuffer()
unsigned long long gnsstk::BinexData::parseBuffer |
( |
const std::string & |
buffer, |
|
|
size_t |
offset, |
|
|
size_t |
size |
|
) |
| |
|
staticprotected |
Converts a raw sequence of bytes into an unsigned long long integer.
- Parameters
-
buffer | Raw bytes to convert |
offset | Position at which to begin conversion |
size | Number of bytes to convert |
- Returns
- Result of converting raw bytes to an unsigned integer
- Exceptions
-
Definition at line 1640 of file BinexData.cpp.
◆ putRecord()
void gnsstk::BinexData::putRecord |
( |
std::ostream & |
s | ) |
const |
|
virtual |
Writes the BINEX data to the specified generic output stream.
- Exceptions
-
std::exception | |
FFStreamError | |
StringUtils::StringException | |
Definition at line 1179 of file BinexData.cpp.
◆ reallyGetRecord()
void gnsstk::BinexData::reallyGetRecord |
( |
FFStream & |
s | ) |
|
|
protectedvirtual |
This function retrieves a BINEX record from the given FFStream. If an error is encountered in reading from the stream, the stream is returned to its original position and its fail-bit is set.
- Exceptions
-
std::exception | |
StringUtils::StringException | when a StringUtils function fails |
FFStreamError | when exceptions(failbit) is set and a read or formatting error occurs. This also resets the stream to its pre-read position. |
Implements gnsstk::FFData.
Definition at line 1255 of file BinexData.cpp.
◆ reallyPutRecord()
void gnsstk::BinexData::reallyPutRecord |
( |
FFStream & |
s | ) |
const |
|
protectedvirtual |
Writes the BINEX data to the file stream formatted correctly.
- Exceptions
-
std::exception | |
FFStreamError | |
StringUtils::StringException | |
Implements gnsstk::FFData.
Definition at line 1166 of file BinexData.cpp.
◆ reverseBuffer()
void gnsstk::BinexData::reverseBuffer |
( |
std::string & |
buffer, |
|
|
size_t |
offset = 0 , |
|
|
size_t |
n = std::string::npos |
|
) |
| |
|
staticprivate |
Reverses the order of the first bufferLength bytes in the specified buffer.
- Parameters
-
buffer | String containing bytes to reverse |
offset | Starting position of bytes to reverse |
n | Number of bytes to reverse |
Definition at line 1683 of file BinexData.cpp.
◆ reverseBytes()
template<class T >
void gnsstk::BinexData::reverseBytes |
( |
T & |
val | ) |
|
|
staticprivate |
◆ setRecordFlags()
Sets the endianness, reversability, and CRC-mode of the record. The "flags" paramater should be set by OR-ing together values from recordFlagsEnum enumeration. Invalid bits in "flag" are silently ignored.
WARNING: Since the record flags determine how data is stored in the record message buffer, altering the record flags after data has been placed in the message buffer could result in misinterpretation of that data. Doing so is therefore highly discouraged.
Definition at line 974 of file BinexData.cpp.
◆ setRecordID()
Sets the ID of this BINEX record.
- Exceptions
-
Definition at line 958 of file BinexData.cpp.
◆ updateMessageData() [1/5]
BinexData & gnsstk::BinexData::updateMessageData |
( |
size_t & |
offset, |
|
|
const char * |
data, |
|
|
size_t |
size |
|
) |
| |
Updates the message buffer with the specified raw data. The location within the message buffer is set by the offset parameter, and the size of the data to copy is set by the size parameter. After updating the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to update |
data | Raw data with which to update the message buffer |
size | Number of bytes of data to be copied |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 1098 of file BinexData.cpp.
◆ updateMessageData() [2/5]
Updates the message buffer with the specified MGFZI. The location within the message buffer is set by the offset parameter. This method checks to ensure that all data fits within the message buffer. After updating the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to update |
data | Data with which to update the message buffer |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 1064 of file BinexData.cpp.
◆ updateMessageData() [3/5]
BinexData & gnsstk::BinexData::updateMessageData |
( |
size_t & |
offset, |
|
|
const std::string & |
data, |
|
|
size_t |
size |
|
) |
| |
Updates the message buffer with the specified raw data. The location within the message buffer is set by the offset parameter, and the size of the data to copy is set by the size parameter. After updating the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to update |
data | Raw data with which to update the message buffer |
size | Number of bytes of data to be copied |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 1077 of file BinexData.cpp.
◆ updateMessageData() [4/5]
template<class T >
BinexData& gnsstk::BinexData::updateMessageData |
( |
size_t & |
offset, |
|
|
const T & |
data, |
|
|
size_t |
size |
|
) |
| |
|
inline |
Updates the message buffer with the specified data. The location within the message buffer is set by the offset parameter, and the size of the data to copy is set by the size parameter. This method checks to ensure that the value of the size parameter does not exceed sizeof(T) and that all data fits within the message buffer. After updating the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to update |
data | Data with which to update the message buffer |
size | Number of bytes of data to be copied |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 739 of file BinexData.hpp.
◆ updateMessageData() [5/5]
Updates the message buffer with the specified UBNXI. The location within the message buffer is set by the offset parameter. This method checks to ensure that all data fits within the message buffer. After updating the message buffer, the value of the offset parameter is updated by size to reference the next available byte in the message buffer.
- Parameters
-
offset | Location within the message buffer at which to update |
data | Data with which to update the message buffer |
- Exceptions
-
FFStreamError | |
InvalidParameter | |
Definition at line 1051 of file BinexData.cpp.
◆ DEFAULT_RECORD_FLAGS
◆ INVALID_RECORD_ID
◆ msg
std::string gnsstk::BinexData::msg |
|
private |
◆ nativeLittleEndian
const bool gnsstk::BinexData::nativeLittleEndian = true |
|
static |
◆ recID
◆ syncByte
◆ VALID_RECORD_FLAGS
The documentation for this class was generated from the following files: