Template Class Parser

Class Documentation

template<typename T>
class Parser

The parser is a general paser. The namsepace rtde_interface and primary_interface both iclude classes which inherit from it (rtdeParser and primaryParser). The parser functionality also embodies a factory function taking in an uint8.

Public Functions

Parser() = default
virtual ~Parser() = default
virtual bool parse(BinParser &bp, std::vector<std::unique_ptr<T>> &results) = 0

Parses data from a binary parser into a vector of packages.

This will create new packages and push them to the results vector, thus new memory will be allocated for each package. Do not use this in a real-time context.

Parameters:
  • bp – Instance of class binaryParser

  • results – A vector of unique pointers to packages

virtual bool parse(BinParser &bp, std::unique_ptr<T> &result) = 0

Parses data from a binary parser into a single package.

This implementation may try to store data in the passed package instance to avoid memory allocations. Thus, this function may be used in a real-time context. Refer to the specific implementation and parser for details.

Parameters:
  • bp – Instance of class binaryParser

  • result – A unique pointer to a package where parsed data should be stored.