Ditto 2.0.2
MutableRga.hpp
1
2#ifndef _DITTO_MUTABLE_RGA_
3#define _DITTO_MUTABLE_RGA_
4
5#include "MutableDocumentPath.hpp"
6#include "Rga.hpp"
7
8#include "Helpers.hpp"
9#include "json.hpp"
10
11#include <cstddef>
12#include <vector>
13
14namespace ditto {
15
16class MutableRga : public Rga {
17 friend class MutableDocumentPath;
18
19public:
28 void set(std::size_t index, nlohmann::json value) DITTO_DEPRECATED;
29
35 void remove(std::size_t index) DITTO_DEPRECATED;
36
43 void insert(std::size_t index, nlohmann::json value) DITTO_DEPRECATED;
44
50 void push(nlohmann::json value) DITTO_DEPRECATED;
51
57 nlohmann::json pop() DITTO_DEPRECATED;
58
59private:
60 std::string indexed_path(std::size_t index);
61 MutableRga(const nlohmann::json &info, MutableDocumentPath doc_path);
62 MutableDocumentPath doc_path;
63};
64
65} // namespace ditto
66
67#endif
Provides an interface to specify a path to a key in a document that you can then call various update ...
Definition: MutableDocumentPath.hpp:32
Definition: MutableRga.hpp:16
nlohmann::json pop() DITTO_DEPRECATED
Pop a value off the end of the Rga.
Definition: MutableRga.cpp:49
void insert(std::size_t index, nlohmann::json value) DITTO_DEPRECATED
Inserts a value into the Rga at the index specified.
Definition: MutableRga.cpp:39
void remove(std::size_t index) DITTO_DEPRECATED
Removes a value at the specified index.
Definition: MutableRga.cpp:34
void push(nlohmann::json value) DITTO_DEPRECATED
Push a value on to the end of the Rga.
Definition: MutableRga.cpp:44
void set(std::size_t index, nlohmann::json value) DITTO_DEPRECATED
Set the element at the given index. Enables indexed modifications to the Rga values.
Definition: MutableRga.cpp:21
Represents a CRDT Replicated Growable Array (RGA) that can be upserted as part of a document or assig...
Definition: Rga.hpp:18
basic_json<> json
default JSON class
Definition: json.hpp:2933