Ditto
4.7.2-rc.1
Loading...
Searching...
No Matches
include
Register.hpp
1
2
#ifndef _DITTO_REGISTER_
3
#define _DITTO_REGISTER_
4
5
#include "AbstractDocumentPath.hpp"
6
7
#include "internal_errors.hpp"
8
#include "json.hpp"
9
10
namespace
ditto {
11
class
Register
{
12
friend
class
AbstractDocumentPath
;
13
14
public
:
15
template
<
class
T>
Register
(
T
value);
16
Register
(
const
nlohmann::json
&info);
21
template
<
typename
T>
T
get_value
()
const
;
22
nlohmann::json
get_json_value()
const
;
23
DittoCrdtType
get_type()
const
;
24
25
protected
:
26
nlohmann::json
value;
27
};
28
29
void
to_json(
nlohmann::json
&
j
,
const
Register
&
a
);
30
31
template
<
class
T> Register::Register(
T
ext_value
) {
32
value =
nlohmann::json
(
ext_value
);
33
}
34
35
template
<
class
T>
T
Register::get_value
()
const
{
return
T
(value); }
36
}
// namespace ditto
37
38
#endif
ditto::AbstractDocumentPath
Provides an interface to specify a path to a key in a document that you can then call various update ...
Definition
AbstractDocumentPath.hpp:21
ditto::Register
Definition
Register.hpp:11
ditto::Register::get_value
T get_value() const
Get the value of the register in the current view of the document.
Definition
Register.hpp:35
nlohmann::json
basic_json<> json
default JSON class
Definition
json.hpp:2933
ditto::ArcPointee
Definition
Arc.hpp:11
Generated by
1.10.0