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