Ditto 4.5.2
Loading...
Searching...
No Matches
StoreObserver.hpp
1#ifndef _DITTO_STORE_OBSERVER_
2#define _DITTO_STORE_OBSERVER_
3
4#include "Ditto.hpp"
5#include "Document.hpp"
6#include "Helpers.hpp"
7#include "Observer.hpp"
8#include "json.hpp"
9
10#include <functional>
11#include <memory>
12#include <string>
13#include <vector>
14
15#include "dittoffi.hpp"
16
17namespace ditto {
18class Store;
19class DittoHandleWrapper;
20class QueryResult;
21
26typedef std::function<void(QueryResult)> StoreObservationHandler;
27
28typedef std::function<void()> NextSignal;
29
35typedef std::function<void(QueryResult, NextSignal)>
36 StoreObservationHandlerWithNextSignal;
37
45 public std::enable_shared_from_this<StoreObserver> {
46 friend class Store;
47
48public:
50
51 void cancel();
52 bool is_cancelled();
53
54private:
55 void on_stop() override;
56 StoreObserver(std::weak_ptr<Ditto::Fields> weak_ditto_fields,
57 std::string query, nlohmann::json query_args,
58 LiveQueryAvailability_t,
59 StoreObservationHandlerWithNextSignal event_callback);
60 int64_t id();
61 class StoreObserverCtx;
62 StoreObserverCtx *ctx;
63};
64
65} // namespace ditto
66
67#endif
An observation token returned by any observation API in the Ditto SDK. Retain this object to continue...
Definition Observer.hpp:11
Provides access to Collections and a write transaction API.
Definition Store.hpp:25
Definition StoreObserver.hpp:45
basic_json<> json
default JSON class
Definition json.hpp:2933