3DiVi Face SDK  3.24.1
 Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Свойства Группы
SmartPtr.h
См. документацию.
1 
6 #ifndef __PBIO_API__PBIO__SMART_PTR_H_
7 #define __PBIO_API__PBIO__SMART_PTR_H_
8 
9 
10 
11 #define __FACE_SDK_PBIO_LIGHT_SHARED_PTR_CHECK_NULL_USE__e8dbe74d9bf04bfa9d97e90c29e858f5
12 // #define __FACE_SDK_PBIO_LIGHT_SHARED_PTR_NEED_REFCOUNTER__d213e87df35b4d47af0999a1192bce7d
13 
14 #if defined( PBIO_OPENCV_SMART_POINTER )
15 
16 // for cv::Ptr
17 #include <opencv2/core/core.hpp>
18 
19 #elif defined( PBIO_BOOST_SMART_POINTER )
20 
21 // for boost::shared_ptr
22 #include <boost/shared_ptr.hpp>
23 
24 #elif defined( PBIO_CXX11_SMART_POINTER )
25 
26 // for std::shared_ptr
27 #include <memory>
28 
29 #else
30 
31 // default implementation of heavy pointer
32 #include "shared_ptr/heavy_shared_ptr.h"
33 
34 #endif
35 
36 #include "shared_ptr/light_shared_ptr.h"
37 
38 namespace pbio{
39 
40 // HeavySmartPtr is a proper shared ptr, that allow storing different types according to inheritance
41 // BUT: this cause it to use a lot more memory
42 // and this is very inconvenient for sets of many object (database of millions of pbio::Template, for example)
43 // so this must be used only when it is really needed
44 template<typename T>
46 public:
47 
48 
49 #if defined( PBIO_OPENCV_SMART_POINTER )
50 
51  typedef cv::Ptr<T> tPtr;
52 
53 #elif defined( PBIO_BOOST_SMART_POINTER )
54 
55  typedef boost::shared_ptr<T> tPtr;
56 
57 #elif defined( PBIO_CXX11_SMART_POINTER )
58 
59  typedef std::shared_ptr<T> tPtr;
60 
61 #else
62 
63  typedef pbio::cv_smart_ptr::cv::Ptr<T> tPtr;
64 
65 #endif
66 
67 
68 };
69 
70 // for backward compatibility in case someone used this
71 // (which actually is not good - these classes are internal api, do not use them directly)
72 template<typename T>
73 class SmartPtr{
74 public:
75  typedef typename HeavySmartPtr<T>::tPtr tPtr;
76 };
77 
78 
79 // SmartPtr is a light shared ptr
80 // is allow storing only type T
81 // no inheritance, no specific deleters
82 // as simple as it can be in order to use less memory
83 template<typename T>
85 public:
86 
87  typedef pbio::light_shared_ptr<T> tPtr;
88 
89 };
90 
91 } // pbio namespace
92 
93 
94 
95 #endif // __PBIO_API__PBIO__SMART_PTR_H_
Definition: SmartPtr.h:84
Definition: SmartPtr.h:45
Definition: SmartPtr.h:73