1 #ifndef __FACE_SDK__PBIO__LIGHT_SHARED_PTR_H__56133c8ad934432e86a8b16f11bb18d7
2 #define __FACE_SDK__PBIO__LIGHT_SHARED_PTR_H__56133c8ad934432e86a8b16f11bb18d7
4 #include "object_with_ref_counter.h"
6 #ifdef __FACE_SDK_PBIO_LIGHT_SHARED_PTR_CHECK_NULL_USE__e8dbe74d9bf04bfa9d97e90c29e858f5
16 class light_shared_ptr
21 light_shared_ptr() : ptr(NULL) {}
24 light_shared_ptr(
const light_shared_ptr &a) : ptr(a.ptr)
28 ptr->increment_refcounter();
33 light_shared_ptr(light_shared_ptr&& a) noexcept :
36 (*this) = std::move(a);
44 ptr->decrement_refcounter();
49 light_shared_ptr& operator=(
const light_shared_ptr &a)
58 ptr->decrement_refcounter();
65 ptr->increment_refcounter();
72 light_shared_ptr& operator=(light_shared_ptr&& a) noexcept
81 ptr->decrement_refcounter();
117 ptr->decrement_refcounter();
122 T* operator -> ()
const
124 #ifdef __FACE_SDK_PBIO_LIGHT_SHARED_PTR_CHECK_NULL_USE__e8dbe74d9bf04bfa9d97e90c29e858f5
127 throw pbio::Error(0xef621abe,
"Error: Ptr::operator-> called with NULL pointer stored, error code: 0xef621abe.");
134 T& operator * ()
const
136 #ifdef __FACE_SDK_PBIO_LIGHT_SHARED_PTR_CHECK_NULL_USE__e8dbe74d9bf04bfa9d97e90c29e858f5
139 throw pbio::Error(0xb3fe4d07,
"Error: Ptr::operator* called with NULL pointer stored, error code: 0xb3fe4d07.");
146 static inline light_shared_ptr make()
147 {
return light_shared_ptr(
new object_with_ref_counter<T>()); }
149 template<
typename t1>
150 static inline light_shared_ptr make(t1 a1)
151 {
return light_shared_ptr(
new object_with_ref_counter<T>(a1)); }
153 template<
typename t2,
typename t1>
154 static inline light_shared_ptr make(t2 a2, t1 a1)
155 {
return light_shared_ptr(
new object_with_ref_counter<T>(a2, a1)); }
157 template<
typename t3,
typename t2,
typename t1>
158 static inline light_shared_ptr make(t3 a3, t2 a2, t1 a1)
159 {
return light_shared_ptr(
new object_with_ref_counter<T>(a3, a2, a1)); }
161 template<
typename t4,
typename t3,
typename t2,
typename t1>
162 static inline light_shared_ptr make(t4 a4, t3 a3, t2 a2, t1 a1)
163 {
return light_shared_ptr(
new object_with_ref_counter<T>(a4, a3, a2, a1)); }
165 template<
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
166 static inline light_shared_ptr make(t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
167 {
return light_shared_ptr(
new object_with_ref_counter<T>(a5, a4, a3, a2, a1)); }
169 template<
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
170 static inline light_shared_ptr make(t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
171 {
return light_shared_ptr(
new object_with_ref_counter<T>(a6, a5, a4, a3, a2, a1)); }
173 template<
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
174 static inline light_shared_ptr make(t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
175 {
return light_shared_ptr(
new object_with_ref_counter<T>(a7, a6, a5, a4, a3, a2, a1)); }
177 template<
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
178 static inline light_shared_ptr make(t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
179 {
return light_shared_ptr(
new object_with_ref_counter<T>(a8, a7, a6, a5, a4, a3, a2, a1)); }
181 template<
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
182 static inline light_shared_ptr make(t9 a9, t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
183 {
return light_shared_ptr(
new object_with_ref_counter<T>(a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
185 template<
typename t10,
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
186 static inline light_shared_ptr make(t10 a10, t9 a9, t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
187 {
return light_shared_ptr(
new object_with_ref_counter<T>(a10, a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
189 template<
typename t11,
typename t10,
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
190 static inline light_shared_ptr make(t11 a11, t10 a10, t9 a9, t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
191 {
return light_shared_ptr(
new object_with_ref_counter<T>(a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
193 template<
typename t12,
typename t11,
typename t10,
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
194 static inline light_shared_ptr make(t12 a12, t11 a11, t10 a10, t9 a9, t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
195 {
return light_shared_ptr(
new object_with_ref_counter<T>(a12, a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
199 light_shared_ptr(object_with_ref_counter<T>* ptr) :
204 ptr->increment_refcounter();
208 object_with_ref_counter<T> *ptr;
215 bool operator == (
const light_shared_ptr<T> &a,
const light_shared_ptr<T> &b)
217 return a.get() == b.get();
222 bool operator != (
const light_shared_ptr<T> &a,
const light_shared_ptr<T> &b)
224 return a.get() != b.get();
231 #endif // __FACE_SDK__PBIO__LIGHT_SHARED_PTR_H__56133c8ad934432e86a8b16f11bb18d7
Класс исключений, выбрасываемых при возникновении ошибок.
Definition: Error.h:26