Ditto  3.0.4
Rga.hpp
1 #ifndef _DITTO_RGA_
2 #define _DITTO_RGA_
3 
4 #include "AbstractDocumentPath.hpp"
5 
6 #include "Helpers.hpp"
7 
8 #include "dittoffi.hpp"
9 
10 #include <vector>
11 
12 namespace ditto {
19 class Rga {
20  friend class AbstractDocumentPath;
21 
22 public:
23  DittoCrdtType get_type() const;
24 
29  std::vector<nlohmann::json> get_value() const;
30 
31 protected:
37  Rga(std::vector<nlohmann::json> value = std::vector<nlohmann::json>())
38  DITTO_DEPRECATED;
39 
40  // TODO : use std::any when we bump up to C++17.
41  // The array representation of the RGA.
42  std::vector<nlohmann::json> value;
43 
44  // Size accessor to the inner value
45  size_t size() const;
46 };
47 
48 void to_json(nlohmann::json &j, const Rga &a);
49 
50 } // namespace ditto
51 
52 #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).
Definition: Rga.hpp:19
Rga(std::vector< nlohmann::json > value=std::vector< nlohmann::json >()) DITTO_DEPRECATED
Construct a new Rga object than can be used as part of a document's context.
Definition: Rga.cpp:15
std::vector< nlohmann::json > get_value() const
Return the array representation of the RGA.
Definition: Rga.cpp:13
basic_json<> json
default JSON class
Definition: json.hpp:2933