Sen API
Sen Libraries
Toggle main menu visibility
Loading...
Searching...
No Matches
cursor.h
Go to the documentation of this file.
1
// === cursor.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_CURSOR_H
9
#define SEN_DB_CURSOR_H
10
11
#include "
sen/core/base/class_helpers.h
"
12
#include "
sen/core/base/timestamp.h
"
13
14
#include <functional>
15
#include <variant>
16
17
namespace
sen::db
18
{
19
20
class
Input
;
21
25
template
<
typename
End
,
typename
... T>
26
class
Cursor
27
{
28
SEN_MOVE_ONLY(Cursor)
29
30
public
:
32
using
Payload
= std::variant<std::monostate, T...,
End
>;
33
35
struct
Entry
36
{
37
TimeStamp
time
;
38
Payload
payload
;
39
};
40
41
public
:
42
~Cursor
() =
default
;
43
44
public
:
46
[[nodiscard]]
bool
atEnd
() const noexcept {
return
std::holds_alternative<End>(entry_.payload); }
47
49
[[nodiscard]]
bool
atBegining
() const noexcept {
return
std::holds_alternative<std::monostate>(entry_.payload); }
50
52
[[nodiscard]]
const
Entry&
get
() const noexcept {
return
entry_; }
53
55
[[nodiscard]]
const
Entry&
operator->
() const noexcept {
return
entry_; }
56
58
Cursor&
operator++
()
59
{
60
frontProvider_(entry_);
61
return
*
this
;
62
}
63
64
private
:
65
friend
class
Input
;
66
using
Provider = std::function<void(Entry&)>;
67
68
private
:
69
explicit
Cursor(Provider frontProvider): frontProvider_(
std
::move(frontProvider)) {}
70
71
private
:
72
Entry entry_;
73
Provider frontProvider_;
74
};
75
76
}
// namespace sen::db
77
78
#endif
// SEN_DB_CURSOR_H
class_helpers.h
Here we define a set of template meta-programming helpers to let the compiler take some decisions bas...
sen::TimeStamp
A point in time.
Definition
timestamp.h:26
sen::db::Cursor::~Cursor
~Cursor()=default
sen::db::Cursor::Entry::payload
Payload payload
When.
Definition
cursor.h:38
sen::db::Cursor::atEnd
bool atEnd() const noexcept
True if the cursor is at the end of the recording.
Definition
cursor.h:46
sen::db::Cursor::Payload
std::variant< std::monostate, T..., End > Payload
The content of the current entry.
Definition
cursor.h:32
sen::db::Cursor::get
const Entry & get() const noexcept
The current entry.
Definition
cursor.h:52
sen::db::Cursor< End, PropertyChange, Event, Keyframe, Creation, Deletion >::Input
friend class Input
Definition
cursor.h:65
sen::db::Cursor::operator->
const Entry & operator->() const noexcept
The current entry.
Definition
cursor.h:55
sen::db::Cursor::operator++
Cursor & operator++()
Advance the cursor one step.
Definition
cursor.h:58
sen::db::Cursor::Entry::time
TimeStamp time
Definition
cursor.h:37
sen::db::Cursor::atBegining
bool atBegining() const noexcept
True if the cursor is at the start of the recording.
Definition
cursor.h:49
sen::db::Cursor::Entry
The current entry.
Definition
cursor.h:36
sen::db::Input
Allows you to access an existing recording in the file system.
Definition
input.h:63
sen::db::End
Represents the end of the recording. Used in cursors.
Definition
input.h:52
sen::db
Definition
type_specs.h:19
std
STL namespace.
timestamp.h
libs
db
include
sen
db
cursor.h
Generated by
1.17.0