Class PrimaryParser

Inheritance Relationships

Base Type

Class Documentation

class PrimaryParser : public urcl::comm::Parser<PrimaryPackage>

The primary specific parser. Interprets a given byte stream as serialized primary packages and parses it accordingly.

Public Functions

PrimaryParser() = default
virtual ~PrimaryParser() = default
inline bool parse(comm::BinParser &bp, std::vector<std::unique_ptr<PrimaryPackage>> &results) override

Uses the given BinParser to create package objects from the contained serialization.

Parameters:
  • bp – A BinParser holding one or more serialized primary packages

  • results – A vector of pointers to created primary package objects

Returns:

True, if the byte stream could successfully be parsed as primary packages, false otherwise

inline bool parse(comm::BinParser &bp, std::unique_ptr<PrimaryPackage> &results) override

Uses the given BinParser to create a single package object from the contained serialization.

Note: This function assumes that the byte stream contains exactly one primary package. For packages with sub-packages this will return false.

Parameters:
  • bp – A BinParser holding one serialized primary package

  • results – A unique pointer to hold the created primary package object

Returns:

True, if the byte stream could successfully be parsed as a primary package, false otherwise