Joe Verbout
/
main
opencv on mbed
opencv2/core/ptr.inl.hpp@0:ea44dc9ed014, 2016-03-31 (annotated)
- Committer:
- joeverbout
- Date:
- Thu Mar 31 21:16:38 2016 +0000
- Revision:
- 0:ea44dc9ed014
OpenCV on mbed attempt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joeverbout | 0:ea44dc9ed014 | 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// |
joeverbout | 0:ea44dc9ed014 | 2 | // |
joeverbout | 0:ea44dc9ed014 | 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. |
joeverbout | 0:ea44dc9ed014 | 4 | // |
joeverbout | 0:ea44dc9ed014 | 5 | // By downloading, copying, installing or using the software you agree to this license. |
joeverbout | 0:ea44dc9ed014 | 6 | // If you do not agree to this license, do not download, install, |
joeverbout | 0:ea44dc9ed014 | 7 | // copy or use the software. |
joeverbout | 0:ea44dc9ed014 | 8 | // |
joeverbout | 0:ea44dc9ed014 | 9 | // |
joeverbout | 0:ea44dc9ed014 | 10 | // License Agreement |
joeverbout | 0:ea44dc9ed014 | 11 | // For Open Source Computer Vision Library |
joeverbout | 0:ea44dc9ed014 | 12 | // |
joeverbout | 0:ea44dc9ed014 | 13 | // Copyright (C) 2013, NVIDIA Corporation, all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 14 | // Third party copyrights are property of their respective owners. |
joeverbout | 0:ea44dc9ed014 | 15 | // |
joeverbout | 0:ea44dc9ed014 | 16 | // Redistribution and use in source and binary forms, with or without modification, |
joeverbout | 0:ea44dc9ed014 | 17 | // are permitted provided that the following conditions are met: |
joeverbout | 0:ea44dc9ed014 | 18 | // |
joeverbout | 0:ea44dc9ed014 | 19 | // * Redistribution's of source code must retain the above copyright notice, |
joeverbout | 0:ea44dc9ed014 | 20 | // this list of conditions and the following disclaimer. |
joeverbout | 0:ea44dc9ed014 | 21 | // |
joeverbout | 0:ea44dc9ed014 | 22 | // * Redistribution's in binary form must reproduce the above copyright notice, |
joeverbout | 0:ea44dc9ed014 | 23 | // this list of conditions and the following disclaimer in the documentation |
joeverbout | 0:ea44dc9ed014 | 24 | // and/or other materials provided with the distribution. |
joeverbout | 0:ea44dc9ed014 | 25 | // |
joeverbout | 0:ea44dc9ed014 | 26 | // * The name of the copyright holders may not be used to endorse or promote products |
joeverbout | 0:ea44dc9ed014 | 27 | // derived from this software without specific prior written permission. |
joeverbout | 0:ea44dc9ed014 | 28 | // |
joeverbout | 0:ea44dc9ed014 | 29 | // This software is provided by the copyright holders and contributors "as is" and |
joeverbout | 0:ea44dc9ed014 | 30 | // any express or implied warranties, including, but not limited to, the implied |
joeverbout | 0:ea44dc9ed014 | 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. |
joeverbout | 0:ea44dc9ed014 | 32 | // In no event shall the copyright holders or contributors be liable for any direct, |
joeverbout | 0:ea44dc9ed014 | 33 | // indirect, incidental, special, exemplary, or consequential damages |
joeverbout | 0:ea44dc9ed014 | 34 | // (including, but not limited to, procurement of substitute goods or services; |
joeverbout | 0:ea44dc9ed014 | 35 | // loss of use, data, or profits; or business interruption) however caused |
joeverbout | 0:ea44dc9ed014 | 36 | // and on any theory of liability, whether in contract, strict liability, |
joeverbout | 0:ea44dc9ed014 | 37 | // or tort (including negligence or otherwise) arising in any way out of |
joeverbout | 0:ea44dc9ed014 | 38 | // the use of this software, even if advised of the possibility of such damage. |
joeverbout | 0:ea44dc9ed014 | 39 | // |
joeverbout | 0:ea44dc9ed014 | 40 | //M*/ |
joeverbout | 0:ea44dc9ed014 | 41 | |
joeverbout | 0:ea44dc9ed014 | 42 | #ifndef __OPENCV_CORE_PTR_INL_HPP__ |
joeverbout | 0:ea44dc9ed014 | 43 | #define __OPENCV_CORE_PTR_INL_HPP__ |
joeverbout | 0:ea44dc9ed014 | 44 | |
joeverbout | 0:ea44dc9ed014 | 45 | #include <algorithm> |
joeverbout | 0:ea44dc9ed014 | 46 | |
joeverbout | 0:ea44dc9ed014 | 47 | //! @cond IGNORED |
joeverbout | 0:ea44dc9ed014 | 48 | |
joeverbout | 0:ea44dc9ed014 | 49 | namespace cv { |
joeverbout | 0:ea44dc9ed014 | 50 | |
joeverbout | 0:ea44dc9ed014 | 51 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 52 | void DefaultDeleter<Y>::operator () (Y* p) const |
joeverbout | 0:ea44dc9ed014 | 53 | { |
joeverbout | 0:ea44dc9ed014 | 54 | delete p; |
joeverbout | 0:ea44dc9ed014 | 55 | } |
joeverbout | 0:ea44dc9ed014 | 56 | |
joeverbout | 0:ea44dc9ed014 | 57 | namespace detail |
joeverbout | 0:ea44dc9ed014 | 58 | { |
joeverbout | 0:ea44dc9ed014 | 59 | |
joeverbout | 0:ea44dc9ed014 | 60 | struct PtrOwner |
joeverbout | 0:ea44dc9ed014 | 61 | { |
joeverbout | 0:ea44dc9ed014 | 62 | PtrOwner() : refCount(1) |
joeverbout | 0:ea44dc9ed014 | 63 | {} |
joeverbout | 0:ea44dc9ed014 | 64 | |
joeverbout | 0:ea44dc9ed014 | 65 | void incRef() |
joeverbout | 0:ea44dc9ed014 | 66 | { |
joeverbout | 0:ea44dc9ed014 | 67 | CV_XADD(&refCount, 1); |
joeverbout | 0:ea44dc9ed014 | 68 | } |
joeverbout | 0:ea44dc9ed014 | 69 | |
joeverbout | 0:ea44dc9ed014 | 70 | void decRef() |
joeverbout | 0:ea44dc9ed014 | 71 | { |
joeverbout | 0:ea44dc9ed014 | 72 | if (CV_XADD(&refCount, -1) == 1) deleteSelf(); |
joeverbout | 0:ea44dc9ed014 | 73 | } |
joeverbout | 0:ea44dc9ed014 | 74 | |
joeverbout | 0:ea44dc9ed014 | 75 | protected: |
joeverbout | 0:ea44dc9ed014 | 76 | /* This doesn't really need to be virtual, since PtrOwner is never deleted |
joeverbout | 0:ea44dc9ed014 | 77 | directly, but it doesn't hurt and it helps avoid warnings. */ |
joeverbout | 0:ea44dc9ed014 | 78 | virtual ~PtrOwner() |
joeverbout | 0:ea44dc9ed014 | 79 | {} |
joeverbout | 0:ea44dc9ed014 | 80 | |
joeverbout | 0:ea44dc9ed014 | 81 | virtual void deleteSelf() = 0; |
joeverbout | 0:ea44dc9ed014 | 82 | |
joeverbout | 0:ea44dc9ed014 | 83 | private: |
joeverbout | 0:ea44dc9ed014 | 84 | unsigned int refCount; |
joeverbout | 0:ea44dc9ed014 | 85 | |
joeverbout | 0:ea44dc9ed014 | 86 | // noncopyable |
joeverbout | 0:ea44dc9ed014 | 87 | PtrOwner(const PtrOwner&); |
joeverbout | 0:ea44dc9ed014 | 88 | PtrOwner& operator = (const PtrOwner&); |
joeverbout | 0:ea44dc9ed014 | 89 | }; |
joeverbout | 0:ea44dc9ed014 | 90 | |
joeverbout | 0:ea44dc9ed014 | 91 | template<typename Y, typename D> |
joeverbout | 0:ea44dc9ed014 | 92 | struct PtrOwnerImpl : PtrOwner |
joeverbout | 0:ea44dc9ed014 | 93 | { |
joeverbout | 0:ea44dc9ed014 | 94 | PtrOwnerImpl(Y* p, D d) : owned(p), deleter(d) |
joeverbout | 0:ea44dc9ed014 | 95 | {} |
joeverbout | 0:ea44dc9ed014 | 96 | |
joeverbout | 0:ea44dc9ed014 | 97 | void deleteSelf() |
joeverbout | 0:ea44dc9ed014 | 98 | { |
joeverbout | 0:ea44dc9ed014 | 99 | deleter(owned); |
joeverbout | 0:ea44dc9ed014 | 100 | delete this; |
joeverbout | 0:ea44dc9ed014 | 101 | } |
joeverbout | 0:ea44dc9ed014 | 102 | |
joeverbout | 0:ea44dc9ed014 | 103 | private: |
joeverbout | 0:ea44dc9ed014 | 104 | Y* owned; |
joeverbout | 0:ea44dc9ed014 | 105 | D deleter; |
joeverbout | 0:ea44dc9ed014 | 106 | }; |
joeverbout | 0:ea44dc9ed014 | 107 | |
joeverbout | 0:ea44dc9ed014 | 108 | |
joeverbout | 0:ea44dc9ed014 | 109 | } |
joeverbout | 0:ea44dc9ed014 | 110 | |
joeverbout | 0:ea44dc9ed014 | 111 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 112 | Ptr<T>::Ptr() : owner(NULL), stored(NULL) |
joeverbout | 0:ea44dc9ed014 | 113 | {} |
joeverbout | 0:ea44dc9ed014 | 114 | |
joeverbout | 0:ea44dc9ed014 | 115 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 116 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 117 | Ptr<T>::Ptr(Y* p) |
joeverbout | 0:ea44dc9ed014 | 118 | : owner(p |
joeverbout | 0:ea44dc9ed014 | 119 | ? new detail::PtrOwnerImpl<Y, DefaultDeleter<Y> >(p, DefaultDeleter<Y>()) |
joeverbout | 0:ea44dc9ed014 | 120 | : NULL), |
joeverbout | 0:ea44dc9ed014 | 121 | stored(p) |
joeverbout | 0:ea44dc9ed014 | 122 | {} |
joeverbout | 0:ea44dc9ed014 | 123 | |
joeverbout | 0:ea44dc9ed014 | 124 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 125 | template<typename Y, typename D> |
joeverbout | 0:ea44dc9ed014 | 126 | Ptr<T>::Ptr(Y* p, D d) |
joeverbout | 0:ea44dc9ed014 | 127 | : owner(p |
joeverbout | 0:ea44dc9ed014 | 128 | ? new detail::PtrOwnerImpl<Y, D>(p, d) |
joeverbout | 0:ea44dc9ed014 | 129 | : NULL), |
joeverbout | 0:ea44dc9ed014 | 130 | stored(p) |
joeverbout | 0:ea44dc9ed014 | 131 | {} |
joeverbout | 0:ea44dc9ed014 | 132 | |
joeverbout | 0:ea44dc9ed014 | 133 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 134 | Ptr<T>::Ptr(const Ptr& o) : owner(o.owner), stored(o.stored) |
joeverbout | 0:ea44dc9ed014 | 135 | { |
joeverbout | 0:ea44dc9ed014 | 136 | if (owner) owner->incRef(); |
joeverbout | 0:ea44dc9ed014 | 137 | } |
joeverbout | 0:ea44dc9ed014 | 138 | |
joeverbout | 0:ea44dc9ed014 | 139 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 140 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 141 | Ptr<T>::Ptr(const Ptr<Y>& o) : owner(o.owner), stored(o.stored) |
joeverbout | 0:ea44dc9ed014 | 142 | { |
joeverbout | 0:ea44dc9ed014 | 143 | if (owner) owner->incRef(); |
joeverbout | 0:ea44dc9ed014 | 144 | } |
joeverbout | 0:ea44dc9ed014 | 145 | |
joeverbout | 0:ea44dc9ed014 | 146 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 147 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 148 | Ptr<T>::Ptr(const Ptr<Y>& o, T* p) : owner(o.owner), stored(p) |
joeverbout | 0:ea44dc9ed014 | 149 | { |
joeverbout | 0:ea44dc9ed014 | 150 | if (owner) owner->incRef(); |
joeverbout | 0:ea44dc9ed014 | 151 | } |
joeverbout | 0:ea44dc9ed014 | 152 | |
joeverbout | 0:ea44dc9ed014 | 153 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 154 | Ptr<T>::~Ptr() |
joeverbout | 0:ea44dc9ed014 | 155 | { |
joeverbout | 0:ea44dc9ed014 | 156 | release(); |
joeverbout | 0:ea44dc9ed014 | 157 | } |
joeverbout | 0:ea44dc9ed014 | 158 | |
joeverbout | 0:ea44dc9ed014 | 159 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 160 | Ptr<T>& Ptr<T>::operator = (const Ptr<T>& o) |
joeverbout | 0:ea44dc9ed014 | 161 | { |
joeverbout | 0:ea44dc9ed014 | 162 | Ptr(o).swap(*this); |
joeverbout | 0:ea44dc9ed014 | 163 | return *this; |
joeverbout | 0:ea44dc9ed014 | 164 | } |
joeverbout | 0:ea44dc9ed014 | 165 | |
joeverbout | 0:ea44dc9ed014 | 166 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 167 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 168 | Ptr<T>& Ptr<T>::operator = (const Ptr<Y>& o) |
joeverbout | 0:ea44dc9ed014 | 169 | { |
joeverbout | 0:ea44dc9ed014 | 170 | Ptr(o).swap(*this); |
joeverbout | 0:ea44dc9ed014 | 171 | return *this; |
joeverbout | 0:ea44dc9ed014 | 172 | } |
joeverbout | 0:ea44dc9ed014 | 173 | |
joeverbout | 0:ea44dc9ed014 | 174 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 175 | void Ptr<T>::release() |
joeverbout | 0:ea44dc9ed014 | 176 | { |
joeverbout | 0:ea44dc9ed014 | 177 | if (owner) owner->decRef(); |
joeverbout | 0:ea44dc9ed014 | 178 | owner = NULL; |
joeverbout | 0:ea44dc9ed014 | 179 | stored = NULL; |
joeverbout | 0:ea44dc9ed014 | 180 | } |
joeverbout | 0:ea44dc9ed014 | 181 | |
joeverbout | 0:ea44dc9ed014 | 182 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 183 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 184 | void Ptr<T>::reset(Y* p) |
joeverbout | 0:ea44dc9ed014 | 185 | { |
joeverbout | 0:ea44dc9ed014 | 186 | Ptr(p).swap(*this); |
joeverbout | 0:ea44dc9ed014 | 187 | } |
joeverbout | 0:ea44dc9ed014 | 188 | |
joeverbout | 0:ea44dc9ed014 | 189 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 190 | template<typename Y, typename D> |
joeverbout | 0:ea44dc9ed014 | 191 | void Ptr<T>::reset(Y* p, D d) |
joeverbout | 0:ea44dc9ed014 | 192 | { |
joeverbout | 0:ea44dc9ed014 | 193 | Ptr(p, d).swap(*this); |
joeverbout | 0:ea44dc9ed014 | 194 | } |
joeverbout | 0:ea44dc9ed014 | 195 | |
joeverbout | 0:ea44dc9ed014 | 196 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 197 | void Ptr<T>::swap(Ptr<T>& o) |
joeverbout | 0:ea44dc9ed014 | 198 | { |
joeverbout | 0:ea44dc9ed014 | 199 | std::swap(owner, o.owner); |
joeverbout | 0:ea44dc9ed014 | 200 | std::swap(stored, o.stored); |
joeverbout | 0:ea44dc9ed014 | 201 | } |
joeverbout | 0:ea44dc9ed014 | 202 | |
joeverbout | 0:ea44dc9ed014 | 203 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 204 | T* Ptr<T>::get() const |
joeverbout | 0:ea44dc9ed014 | 205 | { |
joeverbout | 0:ea44dc9ed014 | 206 | return stored; |
joeverbout | 0:ea44dc9ed014 | 207 | } |
joeverbout | 0:ea44dc9ed014 | 208 | |
joeverbout | 0:ea44dc9ed014 | 209 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 210 | typename detail::RefOrVoid<T>::type Ptr<T>::operator * () const |
joeverbout | 0:ea44dc9ed014 | 211 | { |
joeverbout | 0:ea44dc9ed014 | 212 | return *stored; |
joeverbout | 0:ea44dc9ed014 | 213 | } |
joeverbout | 0:ea44dc9ed014 | 214 | |
joeverbout | 0:ea44dc9ed014 | 215 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 216 | T* Ptr<T>::operator -> () const |
joeverbout | 0:ea44dc9ed014 | 217 | { |
joeverbout | 0:ea44dc9ed014 | 218 | return stored; |
joeverbout | 0:ea44dc9ed014 | 219 | } |
joeverbout | 0:ea44dc9ed014 | 220 | |
joeverbout | 0:ea44dc9ed014 | 221 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 222 | Ptr<T>::operator T* () const |
joeverbout | 0:ea44dc9ed014 | 223 | { |
joeverbout | 0:ea44dc9ed014 | 224 | return stored; |
joeverbout | 0:ea44dc9ed014 | 225 | } |
joeverbout | 0:ea44dc9ed014 | 226 | |
joeverbout | 0:ea44dc9ed014 | 227 | |
joeverbout | 0:ea44dc9ed014 | 228 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 229 | bool Ptr<T>::empty() const |
joeverbout | 0:ea44dc9ed014 | 230 | { |
joeverbout | 0:ea44dc9ed014 | 231 | return !stored; |
joeverbout | 0:ea44dc9ed014 | 232 | } |
joeverbout | 0:ea44dc9ed014 | 233 | |
joeverbout | 0:ea44dc9ed014 | 234 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 235 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 236 | Ptr<Y> Ptr<T>::staticCast() const |
joeverbout | 0:ea44dc9ed014 | 237 | { |
joeverbout | 0:ea44dc9ed014 | 238 | return Ptr<Y>(*this, static_cast<Y*>(stored)); |
joeverbout | 0:ea44dc9ed014 | 239 | } |
joeverbout | 0:ea44dc9ed014 | 240 | |
joeverbout | 0:ea44dc9ed014 | 241 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 242 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 243 | Ptr<Y> Ptr<T>::constCast() const |
joeverbout | 0:ea44dc9ed014 | 244 | { |
joeverbout | 0:ea44dc9ed014 | 245 | return Ptr<Y>(*this, const_cast<Y*>(stored)); |
joeverbout | 0:ea44dc9ed014 | 246 | } |
joeverbout | 0:ea44dc9ed014 | 247 | |
joeverbout | 0:ea44dc9ed014 | 248 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 249 | template<typename Y> |
joeverbout | 0:ea44dc9ed014 | 250 | Ptr<Y> Ptr<T>::dynamicCast() const |
joeverbout | 0:ea44dc9ed014 | 251 | { |
joeverbout | 0:ea44dc9ed014 | 252 | return Ptr<Y>(*this, dynamic_cast<Y*>(stored)); |
joeverbout | 0:ea44dc9ed014 | 253 | } |
joeverbout | 0:ea44dc9ed014 | 254 | |
joeverbout | 0:ea44dc9ed014 | 255 | #ifdef CV_CXX_MOVE_SEMANTICS |
joeverbout | 0:ea44dc9ed014 | 256 | |
joeverbout | 0:ea44dc9ed014 | 257 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 258 | Ptr<T>::Ptr(Ptr&& o) : owner(o.owner), stored(o.stored) |
joeverbout | 0:ea44dc9ed014 | 259 | { |
joeverbout | 0:ea44dc9ed014 | 260 | o.owner = NULL; |
joeverbout | 0:ea44dc9ed014 | 261 | o.stored = NULL; |
joeverbout | 0:ea44dc9ed014 | 262 | } |
joeverbout | 0:ea44dc9ed014 | 263 | |
joeverbout | 0:ea44dc9ed014 | 264 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 265 | Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o) |
joeverbout | 0:ea44dc9ed014 | 266 | { |
joeverbout | 0:ea44dc9ed014 | 267 | release(); |
joeverbout | 0:ea44dc9ed014 | 268 | owner = o.owner; |
joeverbout | 0:ea44dc9ed014 | 269 | stored = o.stored; |
joeverbout | 0:ea44dc9ed014 | 270 | o.owner = NULL; |
joeverbout | 0:ea44dc9ed014 | 271 | o.stored = NULL; |
joeverbout | 0:ea44dc9ed014 | 272 | return *this; |
joeverbout | 0:ea44dc9ed014 | 273 | } |
joeverbout | 0:ea44dc9ed014 | 274 | |
joeverbout | 0:ea44dc9ed014 | 275 | #endif |
joeverbout | 0:ea44dc9ed014 | 276 | |
joeverbout | 0:ea44dc9ed014 | 277 | |
joeverbout | 0:ea44dc9ed014 | 278 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 279 | void swap(Ptr<T>& ptr1, Ptr<T>& ptr2){ |
joeverbout | 0:ea44dc9ed014 | 280 | ptr1.swap(ptr2); |
joeverbout | 0:ea44dc9ed014 | 281 | } |
joeverbout | 0:ea44dc9ed014 | 282 | |
joeverbout | 0:ea44dc9ed014 | 283 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 284 | bool operator == (const Ptr<T>& ptr1, const Ptr<T>& ptr2) |
joeverbout | 0:ea44dc9ed014 | 285 | { |
joeverbout | 0:ea44dc9ed014 | 286 | return ptr1.get() == ptr2.get(); |
joeverbout | 0:ea44dc9ed014 | 287 | } |
joeverbout | 0:ea44dc9ed014 | 288 | |
joeverbout | 0:ea44dc9ed014 | 289 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 290 | bool operator != (const Ptr<T>& ptr1, const Ptr<T>& ptr2) |
joeverbout | 0:ea44dc9ed014 | 291 | { |
joeverbout | 0:ea44dc9ed014 | 292 | return ptr1.get() != ptr2.get(); |
joeverbout | 0:ea44dc9ed014 | 293 | } |
joeverbout | 0:ea44dc9ed014 | 294 | |
joeverbout | 0:ea44dc9ed014 | 295 | template<typename T> |
joeverbout | 0:ea44dc9ed014 | 296 | Ptr<T> makePtr() |
joeverbout | 0:ea44dc9ed014 | 297 | { |
joeverbout | 0:ea44dc9ed014 | 298 | return Ptr<T>(new T()); |
joeverbout | 0:ea44dc9ed014 | 299 | } |
joeverbout | 0:ea44dc9ed014 | 300 | |
joeverbout | 0:ea44dc9ed014 | 301 | template<typename T, typename A1> |
joeverbout | 0:ea44dc9ed014 | 302 | Ptr<T> makePtr(const A1& a1) |
joeverbout | 0:ea44dc9ed014 | 303 | { |
joeverbout | 0:ea44dc9ed014 | 304 | return Ptr<T>(new T(a1)); |
joeverbout | 0:ea44dc9ed014 | 305 | } |
joeverbout | 0:ea44dc9ed014 | 306 | |
joeverbout | 0:ea44dc9ed014 | 307 | template<typename T, typename A1, typename A2> |
joeverbout | 0:ea44dc9ed014 | 308 | Ptr<T> makePtr(const A1& a1, const A2& a2) |
joeverbout | 0:ea44dc9ed014 | 309 | { |
joeverbout | 0:ea44dc9ed014 | 310 | return Ptr<T>(new T(a1, a2)); |
joeverbout | 0:ea44dc9ed014 | 311 | } |
joeverbout | 0:ea44dc9ed014 | 312 | |
joeverbout | 0:ea44dc9ed014 | 313 | template<typename T, typename A1, typename A2, typename A3> |
joeverbout | 0:ea44dc9ed014 | 314 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3) |
joeverbout | 0:ea44dc9ed014 | 315 | { |
joeverbout | 0:ea44dc9ed014 | 316 | return Ptr<T>(new T(a1, a2, a3)); |
joeverbout | 0:ea44dc9ed014 | 317 | } |
joeverbout | 0:ea44dc9ed014 | 318 | |
joeverbout | 0:ea44dc9ed014 | 319 | template<typename T, typename A1, typename A2, typename A3, typename A4> |
joeverbout | 0:ea44dc9ed014 | 320 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4) |
joeverbout | 0:ea44dc9ed014 | 321 | { |
joeverbout | 0:ea44dc9ed014 | 322 | return Ptr<T>(new T(a1, a2, a3, a4)); |
joeverbout | 0:ea44dc9ed014 | 323 | } |
joeverbout | 0:ea44dc9ed014 | 324 | |
joeverbout | 0:ea44dc9ed014 | 325 | template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5> |
joeverbout | 0:ea44dc9ed014 | 326 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) |
joeverbout | 0:ea44dc9ed014 | 327 | { |
joeverbout | 0:ea44dc9ed014 | 328 | return Ptr<T>(new T(a1, a2, a3, a4, a5)); |
joeverbout | 0:ea44dc9ed014 | 329 | } |
joeverbout | 0:ea44dc9ed014 | 330 | |
joeverbout | 0:ea44dc9ed014 | 331 | template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> |
joeverbout | 0:ea44dc9ed014 | 332 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) |
joeverbout | 0:ea44dc9ed014 | 333 | { |
joeverbout | 0:ea44dc9ed014 | 334 | return Ptr<T>(new T(a1, a2, a3, a4, a5, a6)); |
joeverbout | 0:ea44dc9ed014 | 335 | } |
joeverbout | 0:ea44dc9ed014 | 336 | |
joeverbout | 0:ea44dc9ed014 | 337 | template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> |
joeverbout | 0:ea44dc9ed014 | 338 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7) |
joeverbout | 0:ea44dc9ed014 | 339 | { |
joeverbout | 0:ea44dc9ed014 | 340 | return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7)); |
joeverbout | 0:ea44dc9ed014 | 341 | } |
joeverbout | 0:ea44dc9ed014 | 342 | |
joeverbout | 0:ea44dc9ed014 | 343 | template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> |
joeverbout | 0:ea44dc9ed014 | 344 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) |
joeverbout | 0:ea44dc9ed014 | 345 | { |
joeverbout | 0:ea44dc9ed014 | 346 | return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8)); |
joeverbout | 0:ea44dc9ed014 | 347 | } |
joeverbout | 0:ea44dc9ed014 | 348 | |
joeverbout | 0:ea44dc9ed014 | 349 | template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> |
joeverbout | 0:ea44dc9ed014 | 350 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9) |
joeverbout | 0:ea44dc9ed014 | 351 | { |
joeverbout | 0:ea44dc9ed014 | 352 | return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9)); |
joeverbout | 0:ea44dc9ed014 | 353 | } |
joeverbout | 0:ea44dc9ed014 | 354 | |
joeverbout | 0:ea44dc9ed014 | 355 | template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10> |
joeverbout | 0:ea44dc9ed014 | 356 | Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10) |
joeverbout | 0:ea44dc9ed014 | 357 | { |
joeverbout | 0:ea44dc9ed014 | 358 | return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)); |
joeverbout | 0:ea44dc9ed014 | 359 | } |
joeverbout | 0:ea44dc9ed014 | 360 | |
joeverbout | 0:ea44dc9ed014 | 361 | } // namespace cv |
joeverbout | 0:ea44dc9ed014 | 362 | |
joeverbout | 0:ea44dc9ed014 | 363 | //! @endcond |
joeverbout | 0:ea44dc9ed014 | 364 | |
joeverbout | 0:ea44dc9ed014 | 365 | #endif // __OPENCV_CORE_PTR_INL_HPP__ |
joeverbout | 0:ea44dc9ed014 | 366 |