Ditto 4.13.1
 
Loading...
Searching...
No Matches
Register.hpp
1
2#ifndef DITTO_REGISTER_H
3#define DITTO_REGISTER_H
4
5#include "AbstractDocumentPath.hpp"
6
7#include "internal_errors.hpp"
8#include "json.hpp"
9
10namespace ditto {
15class DITTO_DEPRECATED_BECAUSE(
16 "Use DQL (Ditto Query Language) instead. For more information see: "
17 "https://ditto.com/link/legacy-to-dql-guide") Register {
18 friend class AbstractDocumentPath;
19
20public:
21 template <class T> explicit Register(T value);
22 explicit Register(const nlohmann::json &info);
27 template <typename T> T get_value() const;
28 nlohmann::json get_json_value() const;
29 DittoCrdtType get_type() const;
30
31protected:
32 nlohmann::json value; // NOLINT
33};
34
35DITTO_DISABLE_DEPRECATED_WARNINGS(
36 "Register is deprecated, and will be removed in v5")
37void to_json(nlohmann::json &j, const Register &a);
38DITTO_REENABLE_WARNINGS
39
40template <class T>
41Register::Register(T ext_value) : value(nlohmann::json(ext_value)) {}
42
43template <class T> T Register::get_value() const { return T(value); }
44} // namespace ditto
45
46#endif
Definition Register.hpp:17
T get_value() const
Get the value of the register in the current view of the document.
Definition Register.hpp:43
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19