`ctf` plugin: add metadata stream parser utilities
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 15:26:45 +0000 (11:26 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
commitf5524c81ea641c5e4f0eae3f9a369d40d93f99a2
treead18a4079dd0b27abed650646b753267d83739b2
parent1947f6c6b28cc0114f7458816ff9e848ca07d951
`ctf` plugin: add metadata stream parser utilities

This patch adds:

ctf::src::getMetadataStreamMajorVersion():
    Returns the major version of a metadata stream based on its first
    byte.

ctf::src::createMetadataStreamParser(MetadataStreamMajorVersion, ...):
    Creates and returns a CTF metadata stream parser of which the
    concrete class depends on some major version.

ctf::src::createMetadataStreamParser(const std::uint8_t *, ...):
    Creates and returns a CTF metadata stream parser of which the
    concrete class depends on the first byte of some data.

ctf::src::parseMetadataStream():
    Parses a whole metadata stream, returning the resulting trace class
    and optional metadata stream UUID.

    This is the preferred way to parse a whole metadata stream as it
    calls the static parse() method of some concrete parser class which
    may contain more validation. For example,
    ctf::src::Ctf2MetadataStreamParser::parse() throws if there's no
    resulting trace class or if the current resulting trace class has no
    data stream classes (required by CTF2-SPEC-6.0 [1]).

[1]: https://diamon.org/ctf/files/CTF2-SPECRC-6.0rB.html#metadata-stream

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Id869bb4fc735a75fbe16827dfb6abed62d13467b

Change-Id: I9249645496012f8bddccbdc866af087c3d3bc549
src/plugins/ctf/common/src/metadata/Makefile.am
src/plugins/ctf/common/src/metadata/metadata-stream-parser-utils.cpp [new file with mode: 0644]
src/plugins/ctf/common/src/metadata/metadata-stream-parser-utils.hpp [new file with mode: 0644]
This page took 0.025173 seconds and 5 git commands to generate.