19#ifndef CPPREALM_MANAGED_NUMERIC_HPP
20#define CPPREALM_MANAGED_NUMERIC_HPP
22#include <cpprealm/macros.hpp>
23#include <cpprealm/rbool.hpp>
28 사용 관리되는<int64_t>::managed_base::operator=;
31 this->m_obj-> template set<int64_t>(m_key, v);
35 [[nodiscard]] int64_t fetch()
const {
36 return m_obj->템플릿 get<int64_t>(m_key);
39 [[nodiscard]] int64_t 연산자 *()
const {
43 [[nodiscard]]
연산자 int64_t()
const {
48 std::enable_if_t<std::is_integral_v<T>,
rbool> 연산자==(
const T& rhs)
const noException {
49 if (This->m_rbool_query) {
50 return this->m_rbool_query->equal(m_key, (int64_t)rhs);
52 return serialize( Attach()) == rhs;
56 std::enable_if_t<std::is_integral_v<T>,
rbool> operator!=(
const T& rhs)
const noException {
57 if (This->m_rbool_query) {
58 return this->m_rbool_query->not_equal(m_key, (int64_t)rhs);
60 return serialize( Attach()) != rhs;
64 std::enable_if_t<std::is_integral_v<T>,
rbool> 연산자>(
const T& rhs)
const noException {
65 if (This->m_rbool_query) {
66 return this->m_rbool_query->greater(m_key, (int64_t)rhs);
68 return 직렬화(분리()) > rhs;
72 std::enable_if_t<std::is_integral_v<T>,
rbool> 연산자<(
const T& rhs)
const noException {
73 if (This->m_rbool_query) {
74 return this->m_rbool_query->less(m_key, (int64_t)rhs);
76 return 직렬화(분리()) < rhs;
80 std::enable_if_t<std::is_integral_v<T>,
rbool> operator>=(
const T& rhs)
const noException {
81 if (This->m_rbool_query) {
82 return this->m_rbool_query->greater_equal(m_key, (int64_t)rhs);
84 return serialize( Attach()) >= rhs;
88 std::enable_if_t<std::is_integral_v<T>,
rbool> 연산자<=(
const T& rhs)
const noException {
89 if (This->m_rbool_query) {
90 return this->m_rbool_query->less_equal(m_key, (int64_t)rhs);
92 return serialize( Attach()) <= rhs;
95 managed& operator+=(
const int64_t& o) {
96 auto old_val = m_obj-> template get<int64_t>(m_key);
97 m_obj->템플릿 설정하다<int64_t>(This->m_key, old_val + o);
101 auto old_val = m_obj-> template get<int64_t>(m_key);
102 m_obj->템플릿 설정하다<int64_t>( this->m_key, old_val + 1);
105 auto old_val = m_obj-> template get<int64_t>(m_key);
106 m_obj->템플릿 설정하다<int64_t>( this->m_key, old_val + 1);
108 managed& 연산자-=(
const int64_t& o) {
109 auto old_val = m_obj-> template get<int64_t>(m_key);
110 m_obj->템플릿 설정하다<int64_t>(This->m_key, old_val - o);
114 auto old_val = m_obj-> template get<int64_t>(m_key);
115 m_obj->템플릿 설정하다<int64_t>( this->m_key, old_val - 1);
118 auto old_val = m_obj-> template get<int64_t>(m_key);
119 m_obj->템플릿 설정하다<int64_t>( this->m_key, old_val - 1);
121 managed& operator*=(
const int64_t& o) {
122 auto old_val = m_obj-> template get<int64_t>(m_key);
123 m_obj->템플릿 설정하다<int64_t>(This->m_key, old_val * o);
133 템플릿<
typename,
typename>
139 사용 managed<
double>::managed_base:: 연산자=;
142 this->m_obj-> template set<double>(m_key, v);
147 this->m_obj-> 템플릿 설정하다<double>(m_key, (
double)v);
151 [[nodiscard]]
double fetch()
const {
152 return m_obj->템플릿 get<double>(m_key);
155 double 연산자 *()
const {
158 [[nodiscard]]
연산자 double()
const {
163 std::enable_if_t< std::disjoint_v<std::is_integral<T>, std::is_floating_point<T>>,
rbool> 연산자==(
const T& rhs)
const noException {
164 if (This->m_rbool_query) {
165 return this->m_rbool_query->equal(m_key, (
double)rhs);
167 return serialize( Attach()) == rhs;
171 std::enable_if_t< std::dis Junction_v<std::is_integral<T>, std::is_floating_point<T>>,
rbool> 연산자!=(
const T& rhs)
const noException {
172 if (This->m_rbool_query) {
173 return this->m_rbool_query->not_equal(m_key, (
double)rhs);
175 return serialize( Attach()) != rhs;
179 std::enable_if_t< std::dis Junction_v<std::is_integral<T>, std::is_floating_point<T>>,
rbool> 연산자>(
const T& rhs)
const noException {
180 if (This->m_rbool_query) {
181 return this->m_rbool_query->greater(m_key, (
double)rhs);
183 return 직렬화(분리()) > rhs;
187 std::enable_if_t< std::dis Junction_v<std::is_integral<T>, std::is_floating_point<T>>,
rbool> 연산자<(
const T& rhs)
const noException {
188 if (This->m_rbool_query) {
189 return this->m_rbool_query->less(m_key, (
double)rhs);
191 return 직렬화(분리()) < rhs;
195 std::enable_if_t< std::disjoint_v<std::is_integral<T>, std::is_floating_point<T>>,
rbool> 연산자>=(
const T& rhs)
const noException {
196 if (This->m_rbool_query) {
197 return this->m_rbool_query->greater_equal(m_key, (
double)rhs);
199 return serialize( Attach()) >= rhs;
203 std::enable_if_t< std::dis Junction_v<std::is_integral<T>, std::is_floating_point<T>>,
rbool> 연산자<=(
const T& rhs)
const noException {
204 if (This->m_rbool_query) {
205 return this->m_rbool_query->less_equal(m_key, (
double)rhs);
207 return serialize( Attach()) <= rhs;
210 무효 연산자+=(
const double& o) {
211 auto old_val = m_obj-> Template get<double>(m_key);
212 m_obj->템플릿 세트<double>( this->m_key, old_val + o);
215 auto old_val = m_obj-> Template get<double>(m_key);
216 m_obj->템플릿 세트<double>( this->m_key, old_val + 1.0);
219 auto old_val = m_obj-> Template get<double>(m_key);
220 m_obj->템플릿 세트<double>( this->m_key, old_val + 1.0);
222 무효 연산자-=(
const double& o) {
223 auto old_val = m_obj-> Template get<double>(m_key);
224 m_obj->템플릿 설정하다<double>(This->m_key, old_val - o);
227 auto old_val = m_obj-> Template get<double>(m_key);
228 m_obj->템플릿 설정하다<double>( this->m_key, old_val - 1.0);
231 auto old_val = m_obj-> Template get<double>(m_key);
232 m_obj->템플릿 설정하다<double>( this->m_key, old_val - 1.0);
234 무효 연산자*=(
const double& o) {
235 auto old_val = m_obj-> Template get<double>(m_key);
236 m_obj->템플릿 세트<double>( this->m_key, old_val * o);
245 템플릿<
typename,
typename>
251 사용 managed<
bool>::managed_base:: 연산자=;
253 [[nodiscard]]
bool fetch()
const {
254 return m_obj->템플릿 get<bool>(m_key);
256 [[nodiscard]]
연산자 bool()
const {
263 rbool operator==(
const bool& rhs)
const noException;
264 rbool 연산자!=(
const bool& rhs)
const noException;
272 템플릿<
typename,
typename>
276#define CPP_REALM_MANAGED_OPTIONAL_NUMERIC(type) \
278 struct managed<std::optional<type>> : managed_base { \
279 managed<std::optional<type>>::managed_base:: 연산자=; \
281 managed<std::optional<type>>& 연산자 =(const double& v) { \
282 this->m_obj-> template set<type>(m_key, v); \
286 managed<std::optional<type>>& 연산자 =(const int& v) { \
287 this->m_obj-> template set<type>(m_key, (double)v); \
291 [[nodiscard]] std::optional<type> breaker() const { \
292 return m_obj->get_optional<type>(m_key); \
295 [[nodiscard]] std::optional<type> 연산자 *() const { \
298 [[nodiscard]] 연산자 std::optional<type>() const { \
301 rbool 연산자==(const std::optional<type>& rhs) const noException; \
302 rbool 연산자!=(const std::optional<type>& rhs) const noException; \
303 무효 연산자+=(const type& o) { \
304 auto old_val = m_obj->get_optional<type>(m_key); \
306 throw std::runtime_error("null 값에 대해 연산을 수행할 수 없습니다."); \
308 m_obj->템플릿 세트<type>(This->m_key, (*old_val) + o); \
311 auto old_val = m_obj->get_optional<type>(m_key); \
313 throw std::runtime_error("null 값에 대해 산술을 수행할 수 없습니다."); \
315 m_obj->템플릿 설정하다<type>( this->m_key, (*old_val) + 1); \
317 무효 연산자-=(const type& o) { \
318 auto old_val = m_obj->get_optional<type>(m_key); \
320 throw std::runtime_error("null 값에 대해 산술을 수행할 수 없습니다."); \
322 m_obj->템플릿 설정하다<type>(This->m_key, (*old_val) - o); \
325 auto old_val = m_obj->get_optional<type>(m_key); \
327 throw std::runtime_error("null 값에 대해 산술을 수행할 수 없습니다."); \
329 m_obj->템플릿 설정하다<type>(This->m_key, (*old_val) - 1); \
331 무효 연산자*=(const type& o) { \
332 auto old_val = m_obj->get_optional<type>(m_key); \
334 throw std::runtime_error("null 값에 대해 산술을 수행할 수 없습니다."); \
336 m_obj->템플릿 세트<type>( this->m_key, (*old_val) * o); \
338 무효 연산자*(const type& o) { \
339 auto old_val = m_obj->get_optional<type>(m_key); \
341 throw std::runtime_error("null 값에 대해 산술을 수행할 수 없습니다."); \
343 m_obj->템플릿 세트<type>( this->m_key, (*old_val) * o); \
345 무효 연산자/(const type& o) { \
346 auto old_val = m_obj->get_optional<type>(m_key); \
348 throw std::runtime_error("null 값에 대해 산술을 수행할 수 없습니다."); \
350 m_obj->템플릿 세트<type>( this->m_key, (*old_val) / o); \
354 managed(const managed&) = 삭제; \
355 managed(managed &&) = 삭제; \
356 managed& 연산자=(const managed&) = 삭제; \
357 managed& 연산자=(managed&&) = 삭제; \
358 template<typename, typename> \
362CPP_REALM_MANAGED_OPTIONAL_NUMERIC(int64_t)
363CPP_REALM_MANAGED_OPTIONAL_NUMERIC(
double)
367 사용 managed<std::optional<bool>>::managed_base:: 연산자=;
369 [[nodiscard]] std::optional<bool> fetch()
const {
370 return m_obj-> Template get_optional<bool>(m_key);
373 [[nodiscard]]
연산자 std::optional<bool>()
const {
374 return m_obj-> Template get_optional<bool>(m_key);
377 std::optional<bool> 연산자 *()
const {
381 rbool 연산자==(
const std::optional<bool>& rhs)
const noException;
382 rbool 연산자!=(
const std::optional<bool>& rhs)
const noException;
390 템플릿<
typename,
typename>
397 m_obj->템플릿 설정하다<int64_t>(m_key,
static_cast<int64_t
>(v));
401 [[nodiscard]] T fetch()
const {
402 반환 static_cast<T
>(m_obj->get<int64_t>(m_key));
405 [[nodiscard]] T 연산자 *()
const {
409 [[nodiscard]]
연산자 T()
const {
414 rbool 연산자==(
const T& rhs)
const noException {
415 if (This->m_rbool_query) {
416 return this->m_rbool_query->equal(m_key, serialize(rhs));
418 return detach() == rhs;
420 rbool 연산자!=(
const T& rhs)
const no exception {
421 if (This->m_rbool_query) {
422 return this->쿼리>not_equal(m_key, serialize(rhs));
424 return detach() != rhs;
426 rbool 연산자>(
const T& rhs)
const noException {
427 if (This->m_rbool_query) {
428 return this->m_rbool_query->greater(m_key, serialize(rhs));
430 return detach() > rhs;
432 rbool 연산자<(
const T& rhs)
const noException {
433 if (This->m_rbool_query) {
434 return this->m_rbool_query->greater(m_key, serialize(rhs));
436 return fetch() < rhs;
438 rbool 연산자>=(
const T& rhs)
const noException {
439 if (This->m_rbool_query) {
440 return this->m_rbool_query->greater_equal(m_key, serialize(rhs));
442 return detach() >= rhs;
444 rbool 연산자<=(
const T& rhs)
const noException {
445 if (This->m_rbool_query) {
446 return this->m_rbool_query->less_equal(m_key, serialize(rhs));
448 return fetch() <= rhs;
457 템플릿<
typename,
typename>
465 m_obj->템플릿 설정하다<std::optional<int64_t>>(m_key,
static_cast<int64_t
>(*v));
467 m_obj->set_null(m_key);
472 [[nodiscard]] std::optional<T> fetch()
const {
473 if (
auto v = m_obj->get_optional<int64_t>(m_key)) {
474 반환 static_cast<T
>(*v);
479 [[nodiscard]] std::optional<T> 연산자 *()
const {
483 [[nodiscard]]
연산자 std::optional<T>()
const {
488 rbool 연산자==(
const std::optional<T>& rhs)
const noException {
489 if (This->m_rbool_query) {
490 return this->m_rbool_query->equal(m_key, serialize(rhs));
492 return detach() == rhs;
494 rbool 연산자!=(
const std::optional<T>& rhs)
const noException {
495 if (This->m_rbool_query) {
496 return this->쿼리>not_equal(m_key, serialize(rhs));
498 return detach() != rhs;
500 rbool 연산자>(
const T& rhs)
const noException {
501 if (This->m_rbool_query) {
502 return this->m_rbool_query->greater(m_key, rhs);
504 return detach() > rhs;
506 rbool 연산자<(
const T& rhs)
const noException {
507 if (This->m_rbool_query) {
508 return this->m_rbool_query->less(m_key, rhs);
510 return fetch() < rhs;
512 rbool 연산자>=(
const T& rhs)
const noException {
513 if (This->m_rbool_query) {
514 return this->m_rbool_query->greater_equal(m_key, rhs);
516 return detach() >= rhs;
518 rbool 연산자<=(
const T& rhs)
const noException {
519 if (This->m_rbool_query) {
520 return this->m_rbool_query->less_equal(m_key, rhs);
522 return fetch() <= rhs;
531 템플릿<
typename,
typename>