19#ifndef CPPREALM_OBSERVATION_HPP
20#define CPPRALM_OBSERVATION_HPP
22#include <cpprealm/internal/bridge/list.hpp>
23#include <cpprealm/internal/bridge/obj.hpp>
24#include <cpprealm/internal/bridge/ 객체.hpp>
25#include <cpprealm/internal/bridge/realm.hpp>
26#include <cpprealm/macros.hpp>
28#include <cpprealm/internal/bridge/table.hpp>
29#include <cpprealm/internal/bridge/thread_safe_reference.hpp>
50 std:: exception_ptr
오류;
61 std::shared_ptr<internal::bridge::object> internal_object)
62 : block(std::move(b)),
object(*obj), m_object(internal_object) {
63 static_cast<void>(obj);
67 std::shared_ptr<internal::bridge::object> m_object;
69 std::optional<std::vector<std::string>> Property_names = std::nullopt;
70 std::optional<std::vector<
typename decltype(T::schema)::variant_t>> old_values = std::nullopt;
77 if (!c.deletions().empty()) {
81 if (c.columns().empty()) {
85 자동 속성 = std::vector<std::string>();
86 자동 테이블 = m_object->get_obj().get_table();
88 for (
auto i = 0; i < std::tuple_size<
decltype(T:: 스키마.properties)>{}; i++) {
89 if (c.columns().count(table.get_column_key(T::schema.names[i]).value())) {
90 properties.push_back(T::schema.names[i]);
94 if (!properties.empty()) {
99 std::optional<std::vector<
typename decltype(T:: 스키마)::variant_t>>
105 if (!property_names) {
109 std::vector<
typename decltype(T::schema)::variant_t> values;
110 for (
auto &name: *property_names) {
111 자동 값 = T::schema.property_value_for_name(name,
객체,
true);
112 values.push_back(value);
118 old_values = read_values(c);
122 auto new_values = read_values(c);
124 forward_change(
nullptr, {}, {}, {},
nullptr);
125 }
if (
new_values ) {
128 old_values ? *old_values : std::vector<
typename decltype(T::schema)::variant_t>{},
132 속성 이름 = std::nullopt;
133 old_values = std::nullopt;
136 무효 오류(std::Exception_ptr err) {
137 forward_change(
nullptr, {}, {}, {}, err);
140 forward_change (
const T *ptr,
141 std::vector<std::string> 속성 이름,
142 std::vector<
typename decltype(T:: 스키마)::variant_t> old_values,
143 std::vector<
typename decltype(T:: 스키마)::variant_t> new_values,
144 const std::Exception_ptr &error) {
152 oc.is_deleted =
true;
156 std::vector<PropertyChange<T>> Property_changes;
157 for (
size_t i = 0; i < Property_names.size(); i++) {
160 if (!old_values.empty()) {
161 속성.old_value = old_values[i];
163 if (!new_values.empty()) {
164 속성.new_value = new_values[i];
166 Property_changes.push_back(std::move(property));
170 oc.property_changes = Property_changes;
177 std::vector<uint64_t> 삭제;
178 std::vector<uint64_t> 삽입;
179 std::vector<uint64_t> 수정;
184 bool collection_root_was_deleted =
false;
186 [[nodiscard]]
bool empty()
const noException {
187 반환 deletes.empty() && inserts.empty() && Modifys.empty() &&
188 !collection_root_was_deleted;
194 bool ignoreChangesInInitialNotification;
197 bool ignoreChangesInInitialNotification)
199 , ignoreChangesInInitialNotification(ignoreChangesInInitialNotification)
205 if (ignoreChangesInInitialNotification) {
206 ignoreChangesInInitialNotification =
false;
209 other if (changes.empty()) {
213 other if (!changes.collection_root_was_deleted() || !changes.deletions().empty()) {
214 처리기({to_vector(changes.deletions()),
215 to_vector(changes.insertions()),
216 to_vector(changes.modifications()),
223 자동 벡터 = std::vector<uint64_t>();
224 for (
auto index : index_set.as_indexes()) {
225 vector.push_back(index);
237 스트림 <<
"\tis_deleted: " <<
객체.is_deleted <<
"\n";
238 stream <<
"\tchange_to: " <<
object.property.name <<
"\n";
239 if (
객체. 속성.old_value) {
240 스트림 <<
"\told_value: ";
241 std::visit([&stream](
auto&& arg) {
242 using M = std::decay_t<
decltype(arg)>;
243 스트림 << static_cast<M>(arg);
244 }, *
객체. 속성.old_value);
246 if (
객체. 속성.new_value) {
247 스트림 <<
"\tnew_value: ";
248 std::visit([&stream](
auto&& arg) {
249 using M = std::decay_t<
decltype(arg)>;
250 스트림 << static_cast<M>(arg);
251 }, *
객체.property.new_value);
bool is_deleted
객체가 Realm에서 삭제되었습니다.
정의: 관찰.hpp:42
std::vector< PropertyChange< T > > 속성 변경
정의: 관찰.hpp:54
const T * 객체
관찰 중인 객체입니다.
정의: 관찰.hpp:40
std::exception_ptr error
정의: 관찰.hpp:50