arcstk::v_1_0_0::ContentHandler class

Interface for ARStreamParser content handlers.

Add actual behaviour to an ARStreamParser. A concrete subclass of ContentHandler implements the handling of each syntactic entity the ARStreamParser emits.

A ContentHandler reacts to the following events:

  • Start of input (once on beginning the parsing process)
  • Start of a block (once on every block)
  • ARId, i.e. the header of a block (once on every block)
  • A triplet (once or more times on every block)
  • End of a block (once on every block)
  • End of input (once on the end of the parsing process)

Event start_input() occurrs before the first actual bytes are parsed. Event end_input() occurrs after the last actual bytes are parsed.

The ARId is not represented as such, but as a sequence of the four numeric constants that are required to compute the actual ARId.

Each triplet comes with an ARCS for the entire track, a confidence value and an ARCS for frame 450 of the track.

If a parsing error occurrs, the ContentHandler will receive additional validity flags to indicate which members of the last triplet were parsed successfully and which were not.

Derived classes

class v_1_0_0::DefaultContentHandler final
Populates an existing ARResponse instance.

Constructors, destructors, conversion operators

~ContentHandler() virtual noexcept
Virtual default destructor.

Public functions

void end_block()
React on the end of an ARBlock.
void end_input()
React on the end of the input.
void id(const uint8_t track_count, const uint32_t id1, const uint32_t id2, const uint32_t cddb_id)
React on an ARId.
void start_block()
React on the start of an ARBlock.
void start_input()
React on the start of the input.
void triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs)
React on an ARTriplet.
void triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs, const bool arcs_valid, const bool confidence_valid, const bool frame450_arcs_valid)
React on an ARTriplet.

Private functions

void do_end_block() pure virtual
Implements end_block()
void do_end_input() pure virtual
Implements end_input()
void do_id(const uint8_t track_count, const uint32_t id1, const uint32_t id2, const uint32_t cddb_id) pure virtual
Implements id()
void do_start_block() pure virtual
Implements start_block()
void do_start_input() pure virtual
Implements start_input()
void do_triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs) pure virtual
Implements triplet().
void do_triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs, const bool arcs_valid, const bool confidence_valid, const bool frame450_arcs_valid) pure virtual
Implements triplet().

Function documentation

void arcstk::v_1_0_0::ContentHandler::id(const uint8_t track_count, const uint32_t id1, const uint32_t id2, const uint32_t cddb_id)

React on an ARId.

Parameters
track_count in Track count in this id
id1 in Disc id 1 in this id
id2 in Disc id 2 in this id
cddb_id in CDDB id in this id

Each ARBlock starts with the id of the disc it describes, so this method is always called directly after start_block().

void arcstk::v_1_0_0::ContentHandler::triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs)

React on an ARTriplet.

Parameters
arcs in ARCS in this triplet
confidence in Confidence in this triplet
frame450_arcs in ARCS of frame 450 in this triplet

void arcstk::v_1_0_0::ContentHandler::triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs, const bool arcs_valid, const bool confidence_valid, const bool frame450_arcs_valid)

React on an ARTriplet.

Parameters
arcs in The ARCS value of this triplet
confidence in The confidence value of this triplet
frame450_arcs in The ARCS for frame 450 of this triplet
arcs_valid in Validity of ARCS of this triplet
confidence_valid in Validity of confidence of this triplet
frame450_arcs_valid in Validity of frame 450 ARCS of this triplet

If a parse error occurred on parsing the triplet, validity flags for each part of the triplet are passed. A validity flag that is TRUE indicates that the respective part of the triplet was parsed correctly. A validity value of FALSE reports that the parsed value is not reliable.

void arcstk::v_1_0_0::ContentHandler::do_id(const uint8_t track_count, const uint32_t id1, const uint32_t id2, const uint32_t cddb_id) pure virtual private

Implements id()

Parameters
track_count in Track count in this id
id1 in Disc id 1 in this id
id2 in Disc id 2 in this id
cddb_id in CDDB id in this id

Each ARBlock starts with the id of the disc it describes, so this method is always called directly after start_block().

void arcstk::v_1_0_0::ContentHandler::do_triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs) pure virtual private

Implements triplet().

Parameters
arcs in ARCS in this triplet
confidence in Confidence in this triplet
frame450_arcs in ARCS of frame 450 in this triplet

void arcstk::v_1_0_0::ContentHandler::do_triplet(const Checksum arcs, const uint8_t confidence, const Checksum frame450_arcs, const bool arcs_valid, const bool confidence_valid, const bool frame450_arcs_valid) pure virtual private

Implements triplet().

Parameters
arcs in The ARCS value of this triplet
confidence in The confidence value of this triplet
frame450_arcs in The ARCS for frame 450 of this triplet
arcs_valid in Validity of ARCS of this triplet
confidence_valid in Validity of confidence of this triplet
frame450_arcs_valid in Validity of frame 450 ARCS of this triplet