Fixposition SDK 0.0.0-heads/main-0-g90a51ff
Collection of c++ libraries and apps for use with Fixposition products
Loading...
Searching...
No Matches
fpsdk::common::parser::Parser Class Reference

Message parser class. More...

#include <parser.hpp>

Public Member Functions

 Parser ()
 Constructor, initialises parser and makes it ready to accept data and emit messages.
 
bool Add (const uint8_t *data, const std::size_t size)
 Add data to parser.
 
bool Add (const std::vector< uint8_t > &data)
 Add data to parser.
 
void Reset ()
 Reset parser.
 
bool Process (ParserMsg &msg)
 Process data in parser, return message.
 
bool Flush (ParserMsg &msg)
 Get remaining data from parser as OTHER message(s)
 
ParserStats GetStats () const
 Get parser statistics.
 

Detailed Description

Message parser class.

Definition at line 164 of file parser.hpp.

Member Function Documentation

◆ Add() [1/2]

bool fpsdk::common::parser::Parser::Add ( const uint8_t * data,
const std::size_t size )

Add data to parser.

Parameters
[in]dataPointer to data
[in]sizeSize of data (should be <= MAX_ADD_SIZE)
Returns
true if data was added to the parser, false if there was not enough space left

◆ Add() [2/2]

bool fpsdk::common::parser::Parser::Add ( const std::vector< uint8_t > & data)

Add data to parser.

Parameters
[in]datadata, can be empty (should be <= MAX_ADD_SIZE)
Returns
true if data was added to the parser, false if there was not enough space left

◆ Reset()

void fpsdk::common::parser::Parser::Reset ( )

Reset parser.

Resets the parser state and discards all collected data.

◆ Process()

bool fpsdk::common::parser::Parser::Process ( ParserMsg & msg)

Process data in parser, return message.

Parameters
[out]msgThe detected message frame
Returns
true if a message was detected, false otherwise (meaning: not enough data in parser)

◆ Flush()

bool fpsdk::common::parser::Parser::Flush ( ParserMsg & msg)

Get remaining data from parser as OTHER message(s)

Parameters
[out]msgA chunk of the remaining data as a OTHER message
Returns
true if there was remaining data, false if parser buffer was empty

◆ GetStats()

ParserStats fpsdk::common::parser::Parser::GetStats ( ) const

Get parser statistics.

Returns
a copy of the parser statistics

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