Realm C++ SDK Version v2.2.0

thread_safe_reference.hpp

1
2//
3// Copyright 2024 Realm Inc.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
18
19#ifndef CPPREALM_BRIDGE_THREAD_SAFE_REFERENCE_HPP
20#define CPPREALM_BRIDGE_THREAD_SAFE_REFERENCE_HPP
21
22#include <cpprealm/internal/bridge/utils.hpp>
23
24namespace realm {
25 class ThreadSafeReference;
26}
27namespace realm::internal::bridge {
28 struct object;
29 struct dictionary;
30 struct realm;
31
34 thread_safe_reference(const thread_safe_reference& other) = delete;
35 thread_safe_reference& operator=(const thread_safe_reference& other) = delete;
39 thread_safe_reference(const object&);
41 thread_safe_reference(ThreadSafeReference&&);
42 operator ThreadSafeReference&&();
43 operator bool() const; //NOLINT(google-explicit-constructor)
44 private:
45 friend struct realm;
46 template <typename T>
47 friend T resolve(const realm&, thread_safe_reference&& tsr);
48#ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
49 storage::ThreadSafeReference m_thread_safe_reference[1];
50#else
51 std::shared_ptr<ThreadSafeReference> m_thread_safe_reference;
52#endif
53 };
54
55}
56
57#endif //CPPREALM_BRIDGE_THREAD_SAFE_REFERENCE_HPP
Definition: dictionary.hpp:138
Definition: realm.hpp:67
Definition: thread_safe_reference.hpp:32