| 1785 | |
| 1786 | template <typename T> |
| 1787 | class Wrapper |
| 1788 | { |
| 1789 | public: |
| 1790 | typedef T cl_type; |
| 1791 | |
| 1792 | protected: |
| 1793 | cl_type object_; |
| 1794 | |
| 1795 | public: |
| 1796 | Wrapper() : object_(NULL) { } |
| 1797 | |
| 1798 | Wrapper(const cl_type &obj) : object_(obj) { } |
| 1799 | |
| 1800 | ~Wrapper() |
| 1801 | { |
| 1802 | if (object_ != NULL) { release(); } |
| 1803 | } |
| 1804 | |
| 1805 | Wrapper(const Wrapper<cl_type>& rhs) |
| 1806 | { |
| 1807 | object_ = rhs.object_; |
| 1808 | if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); } |
| 1809 | } |
| 1810 | |
| 1811 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED) |
| 1812 | Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT |
| 1813 | { |
| 1814 | object_ = rhs.object_; |
| 1815 | rhs.object_ = NULL; |
| 1816 | } |
| 1817 | #endif |
| 1818 | |
| 1819 | Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs) |
| 1820 | { |
| 1821 | if (this != &rhs) { |
| 1822 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); } |
| 1823 | object_ = rhs.object_; |
| 1824 | if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); } |
| 1825 | } |
| 1826 | return *this; |
| 1827 | } |
| 1828 | |
| 1829 | #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED) |
| 1830 | Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs) |
| 1831 | { |
| 1832 | if (this != &rhs) { |
| 1833 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); } |
| 1834 | object_ = rhs.object_; |
| 1835 | rhs.object_ = NULL; |
| 1836 | } |
| 1837 | return *this; |
| 1838 | } |
| 1839 | #endif |
| 1840 | |
| 1841 | Wrapper<cl_type>& operator = (const cl_type &rhs) |
| 1842 | { |
| 1843 | if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); } |
| 1844 | object_ = rhs; |
nothing calls this directly
no test coverage detected