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();
37 ptr->decrement_refcounter();
42 light_shared_ptr& operator=(
const light_shared_ptr &a)
51 ptr->decrement_refcounter();
58 ptr->increment_refcounter();
90 ptr->decrement_refcounter();
95 T* operator -> ()
const
97 #ifdef __FACE_SDK_PBIO_LIGHT_SHARED_PTR_CHECK_NULL_USE__e8dbe74d9bf04bfa9d97e90c29e858f5
100 throw pbio::Error(0xef621abe,
"Error: Ptr::operator-> called with NULL pointer stored, error code: 0xef621abe.");
107 T& operator * ()
const
109 #ifdef __FACE_SDK_PBIO_LIGHT_SHARED_PTR_CHECK_NULL_USE__e8dbe74d9bf04bfa9d97e90c29e858f5
112 throw pbio::Error(0xb3fe4d07,
"Error: Ptr::operator* called with NULL pointer stored, error code: 0xb3fe4d07.");
119 static inline light_shared_ptr make()
120 {
return light_shared_ptr(
new object_with_ref_counter<T>()); }
122 template<
typename t1>
123 static inline light_shared_ptr make(t1 a1)
124 {
return light_shared_ptr(
new object_with_ref_counter<T>(a1)); }
126 template<
typename t2,
typename t1>
127 static inline light_shared_ptr make(t2 a2, t1 a1)
128 {
return light_shared_ptr(
new object_with_ref_counter<T>(a2, a1)); }
130 template<
typename t3,
typename t2,
typename t1>
131 static inline light_shared_ptr make(t3 a3, t2 a2, t1 a1)
132 {
return light_shared_ptr(
new object_with_ref_counter<T>(a3, a2, a1)); }
134 template<
typename t4,
typename t3,
typename t2,
typename t1>
135 static inline light_shared_ptr make(t4 a4, t3 a3, t2 a2, t1 a1)
136 {
return light_shared_ptr(
new object_with_ref_counter<T>(a4, a3, a2, a1)); }
138 template<
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
139 static inline light_shared_ptr make(t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
140 {
return light_shared_ptr(
new object_with_ref_counter<T>(a5, a4, a3, a2, a1)); }
142 template<
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
143 static inline light_shared_ptr make(t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
144 {
return light_shared_ptr(
new object_with_ref_counter<T>(a6, a5, a4, a3, a2, a1)); }
146 template<
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
147 static inline light_shared_ptr make(t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
148 {
return light_shared_ptr(
new object_with_ref_counter<T>(a7, a6, a5, a4, a3, a2, a1)); }
150 template<
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
151 static inline light_shared_ptr make(t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
152 {
return light_shared_ptr(
new object_with_ref_counter<T>(a8, a7, a6, a5, a4, a3, a2, a1)); }
154 template<
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
155 static inline light_shared_ptr make(t9 a9, t8 a8, t7 a7, t6 a6, t5 a5, t4 a4, t3 a3, t2 a2, t1 a1)
156 {
return light_shared_ptr(
new object_with_ref_counter<T>(a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
158 template<
typename t10,
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
159 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)
160 {
return light_shared_ptr(
new object_with_ref_counter<T>(a10, a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
162 template<
typename t11,
typename t10,
typename t9,
typename t8,
typename t7,
typename t6,
typename t5,
typename t4,
typename t3,
typename t2,
typename t1>
163 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)
164 {
return light_shared_ptr(
new object_with_ref_counter<T>(a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
166 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>
167 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)
168 {
return light_shared_ptr(
new object_with_ref_counter<T>(a12, a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1)); }
172 light_shared_ptr(object_with_ref_counter<T>* ptr) :
177 ptr->increment_refcounter();
181 object_with_ref_counter<T> *ptr;
188 bool operator == (
const light_shared_ptr<T> &a,
const light_shared_ptr<T> &b)
190 return a.get() == b.get();
195 bool operator != (
const light_shared_ptr<T> &a,
const light_shared_ptr<T> &b)
197 return a.get() != b.get();
204 #endif // __FACE_SDK__PBIO__LIGHT_SHARED_PTR_H__56133c8ad934432e86a8b16f11bb18d7
The class of exceptions thrown when errors occur.
Definition: Error.h:26