Ditto 2.0.0-alpha1
Rga.hpp
1#ifndef _DITTO_RGA_
2#define _DITTO_RGA_
3
4#include "AbstractDocumentPath.hpp"
5
6#include "dittoffi.hpp"
7
8#include <vector>
9
10namespace ditto {
16class Rga {
17 friend class AbstractDocumentPath;
18
19public:
20 Rga(const nlohmann::json &info);
26 Rga(std::vector<nlohmann::json> value = std::vector<nlohmann::json>());
27 DittoCrdtType get_type() const;
32 std::vector<nlohmann::json> get_value() const;
33
34protected:
35 // TODO : use std::any when we bump up to C++17.
36 // The array representation of the RGA.
37 std::vector<nlohmann::json> value;
38
39 // Size accessor to the inner value
40 size_t size() const;
41};
42
43void to_json(nlohmann::json &j, const Rga &a);
44
45} // namespace ditto
46
47#endif
Provides an interface to specify a path to a key in a document that you can then call various update ...
Definition: AbstractDocumentPath.hpp:21
Represents a CRDT Replicated Growable Array (RGA) that can be upserted as part of a document or assig...
Definition: Rga.hpp:16
std::vector< nlohmann::json > get_value() const
Return the array representation of the RGA.
Definition: Rga.cpp:15
Rga(std::vector< nlohmann::json > value=std::vector< nlohmann::json >())
Construct a new Rga object than can be used as part of a document's context.
basic_json<> json
default JSON class
Definition: json.hpp:2933