Sen API
Sen Libraries
Toggle main menu visibility
Loading...
Searching...
No Matches
snapshot.h
Go to the documentation of this file.
1
// === snapshot.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_SNAPSHOT_H
9
#define SEN_DB_SNAPSHOT_H
10
11
#include "
sen/core/meta/type.h
"
12
#include "
sen/core/obj/object.h
"
13
14
namespace
sen::db
15
{
16
17
class
Input
;
18
21
class
Snapshot
22
{
23
SEN_COPY_MOVE(Snapshot)
24
25
public
:
26
~Snapshot
() =
default
;
27
28
public
:
30
[[nodiscard]] ObjectId
getObjectId
() const noexcept;
31
33
[[nodiscard]] const
std
::
string
&
getName
() const noexcept;
34
36
[[nodiscard]] const
std
::
string
&
getSessionName
() const noexcept;
37
39
[[nodiscard]] const
std
::
string
&
getBusName
() const noexcept;
40
42
[[nodiscard]] const
ConstTypeHandle
<ClassType>&
getType
() const noexcept {
return
type_; }
43
44
public
:
46
[[nodiscard]]
const
Var
&
getPropertyAsVariant
(
const
Property
* property)
const
;
47
49
[[nodiscard]]
Span<const uint8_t>
getPropertyAsBuffer
(
const
Property
* property)
const
;
50
52
[[nodiscard]]
Span<const uint8_t>
getAllPropertiesBuffer
() const noexcept;
53
54
private:
55
friend class
Input
;
56
Snapshot(ObjectId objectId,
57
std
::
string
objectName,
58
std
::
string
sessionName,
59
std
::
string
busName,
60
ConstTypeHandle
<ClassType> type,
61
std
::vector<uint8_t> buffer);
62
63
private:
64
void
extractBuffersIfNeeded() const;
65
66
private:
67
ObjectId objectId_;
68
std
::
string
objectName_;
69
std
::
string
sessionName_;
70
std
::
string
busName_;
71
ConstTypeHandle
<ClassType> type_;
72
std
::vector<uint8_t> buffer_;
73
mutable
bool
buffersExtracted_ = false;
74
mutable
std
::unordered_map<const
Property
*,
Var
> varCache_;
75
mutable
std
::unordered_map<
MemberHash
,
Span
<const uint8_t>> bufferCache_;
76
};
77
78
}
// namespace sen::db
79
80
#endif
// SEN_DB_SNAPSHOT_H
sen::Property
Represents a property.
Definition
property.h:79
sen::Span
Contiguous view of elements of type T. Inspired by http://www.open-std.org/jtc1/sc22/wg21/docs/papers...
Definition
span.h:34
sen::db::Input
Allows you to access an existing recording in the file system.
Definition
input.h:63
sen::db::Snapshot::getPropertyAsBuffer
Span< const uint8_t > getPropertyAsBuffer(const Property *property) const
Get the value of a property as a serialized buffer.
sen::db::Snapshot::getSessionName
const std::string & getSessionName() const noexcept
The session where the object was published.
sen::db::Snapshot::getType
const ConstTypeHandle< ClassType > & getType() const noexcept
The class of the object.
Definition
snapshot.h:42
sen::db::Snapshot::~Snapshot
~Snapshot()=default
sen::db::Snapshot::getObjectId
ObjectId getObjectId() const noexcept
The ID of the object.
sen::db::Snapshot::getAllPropertiesBuffer
Span< const uint8_t > getAllPropertiesBuffer() const noexcept
Get the buffer containing all the serialized properties.
sen::db::Snapshot::getName
const std::string & getName() const noexcept
The name of the object.
sen::db::Snapshot::Input
friend class Input
Definition
snapshot.h:55
sen::db::Snapshot::getBusName
const std::string & getBusName() const noexcept
The bus where the object was published.
sen::db::Snapshot::getPropertyAsVariant
const Var & getPropertyAsVariant(const Property *property) const
Get the value of a property as a variant.
sen::ConstTypeHandle
TypeHandle< const T > ConstTypeHandle
Definition
type.h:319
sen::db
Definition
type_specs.h:19
std
STL namespace.
object.h
sen::MemberHash
The hash of a member.
Definition
type.h:39
sen::Var
Can hold any supported value type. Wraps std::variant to allow recursion and implements some helpers.
Definition
var.h:119
type.h
libs
db
include
sen
db
snapshot.h
Generated by
1.17.0