19#ifndef CPPREALM_MANAGED_MIXED_HPP
20#define CPPRALM_MANAGED_MIXED_HPP
22#include <cpprealm/macros.hpp>
23#include <cpprealm/rbool.hpp>
24#include <cpprealm/types.hpp>
28 구조체 managed<T, std::enable_if_t< 영역::internal::type_info::MixedPersistableConcept<T>::value>> :
public managed_base {
29 사용 managed<T>::managed_base:: 연산자=;
49 관리형& 연산자 =(
const T& v) {
50 m_obj-> 설정하다(m_key, std::visit([](
auto&& arg) {
63 [[nodiscard]] stored_type get_stored_type()
const {
68 반환 static_cast<stored_type
>(val.type());
72 [[nodiscard]] T fetch()
const {
76 [[nodiscard]] T 연산자 *()
const {
81 rbool 연산자==(
const T& rhs)
const noException {
82 if (This->m_rbool_query) {
83 return this->m_rbool_query->mixed_equal(m_key, serialize(rhs));
85 return detach() == rhs;
88 rbool 연산자!=(
const T& rhs)
const no exception {
89 if (This->m_rbool_query) {
90 return this->m_rbool_query->mixed_not_equal(m_key, serialize(rhs));
92 return detach() != rhs;
95 rbool 연산자==(
const std::nullopt_t&)
const noException {
96 if (This->m_rbool_query) {
99 return Debug() == T(std::monostate());
102 rbool 연산자!=(
const std::nullopt_t&)
const noException {
103 if (This->m_rbool_query) {
106 return Debug() != T(std::monostate());
109 bool has_link()
const {
110 return (get_stored_type() == stored_type::TypedLink);
115 m_realm->read_group();
119 uint32_t Alternative_key = m_realm->table_for_object_type(
managed<std::remove_pointer_t<U>>:: 스키마.name).get_key();
120 uint32_t stored_table = obj.get_obj().get_table().get_key();
122 if (alternative_key != stored_table) {
123 throw std::runtime_error(
"다른 링크 유형이 혼합 유형에 저장되었습니다. Stored type: " + obj.get_object_schema().get_name());
130 static_assert(
sizeof(
managed<U>),
"Must explain schema for T");
138 o = table.create_object();
141 std:: 적용([&o, &v,
this](
auto && ...p) {
142 (
접근자 <
typename std::decay_t<
decltype(p)>::Result>::set(
143 o, o.get_table().get_column_key(p.name), * this->m_realm, v.*(std::decay_t<
decltype(p)>::ptr)
161 템플릿<
typename,
typename>
165 템플릿<
typename T,
typename types>
167 auto val = v.get_stored_type();
170 만약 constexpr (std::is_same_v<T, int64_t>)
174 만약 constexpr (std::is_same_v<T, bool>)
178 만약 constexpr (std::is_same_v<T, std::string>)
182 만약 constexpr (std::is_same_v<T, std::vector<uint8_t>>)
186 만약 constexpr (std::is_same_v<T, Types>)
190 만약 constexpr (std::is_same_v<T, std::chrono::time_point<std::chrono::system_clock>>)
194 만약 constexpr (std::is_same_v<T, float>)
198 만약 constexpr (std::is_same_v<T, double>)
202 만약 constexpr (std::is_same_v<T, realm::decimal128>)
206 만약 constexpr (std::is_same_v<T, realm::object_id>)
211 만약 constexpr (std::is_same_v<T, realm::uuid>)
215 만약 constexpr (std::is_same_v<T, std::monostate>)
219 만약 constexpr (std::is_pointer_v<T>) {
220 auto m = v.m_obj-> Template get<internal::bridge::mixed>(v.m_key);
221 uint32_t Alternative_key = v.m_realm->table_for_object_type(
managed<std::remove_pointer_t<T>>::schema.name).get_key();
223 return Alternative_key == stored_key;