Sen API
Sen Libraries
Loading...
Searching...
No Matches
annotation.h
Go to the documentation of this file.
1// === annotation.h ====================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_DB_ANNOTATION_H
9#define SEN_DB_ANNOTATION_H
10
11// sen
12#include "sen/core/base/span.h"
13#include "sen/core/meta/type.h"
14#include "sen/core/meta/var.h"
15
16// std
17#include <vector>
18
19namespace sen::db
20{
21
22class Input;
23
25class Annotation
26{
27 SEN_COPY_MOVE(Annotation)
28
29public:
30 ~Annotation() = default;
31
32public:
34 [[nodiscard]] const ConstTypeHandle<>& getType() const noexcept;
35
37 [[nodiscard]] Span<const uint8_t> getValueAsBuffer() const noexcept;
38
41 [[nodiscard]] const Var& getValueAsVariant() const;
42
43private:
44 friend class Input;
45 Annotation(ConstTypeHandle<> type, std::vector<uint8_t> buffer);
46
47private:
48 ConstTypeHandle<> type_;
49 mutable bool variantExtracted_ = false;
50 mutable Var variant_;
51 std::vector<uint8_t> buffer_;
52};
53
54} // namespace sen::db
55
56#endif // SEN_DB_ANNOTATION_H
Contiguous view of elements of type T. Inspired by http://www.open-std.org/jtc1/sc22/wg21/docs/papers...
Definition span.h:34
const Var & getValueAsVariant() const
The annotation content, as a variant. Contents of the variant are obtained by interpreting the buffer...
friend class Input
Definition annotation.h:44
Span< const uint8_t > getValueAsBuffer() const noexcept
The annotation content, as a buffer.
const ConstTypeHandle & getType() const noexcept
The data type of the annotation value.
Allows you to access an existing recording in the file system.
Definition input.h:63
TypeHandle< const T > ConstTypeHandle
Definition type.h:319
Definition annotation.h:20
STL namespace.
Can hold any supported value type. Wraps std::variant to allow recursion and implements some helpers.
Definition var.h:119