⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umc_self_destruction_pointer.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
字号:
/* /////////////////////////////////////////////////////////////////////////////////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//          Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.////*/#ifndef __UMC_SELF_DESTRUCTION_POINTER#define __UMC_SELF_DESTRUCTION_POINTERnamespace UMC{template <class T>class SelfDestructionPointer{public:    // Default constructor    SelfDestructionPointer(T *lpItem = 0)    {        m_lpItem = lpItem;    };    // Destructor    virtual ~SelfDestructionPointer(void)    {        Release();    };    SelfDestructionPointer & operator = (T *lpItem)    {        if (lpItem != m_lpItem)            Release();        m_lpItem = lpItem;        return *this;    };    SelfDestructionPointer & operator = (SelfDestructionPointer &Item)    {        if (Item.m_lpItem != m_lpItem)            Release();        m_lpItem = Item.m_lpItem;        Item.m_lpItem = 0;        return *this;    };    operator T * (void)    {        return m_lpItem;    };    T & operator * (void)    {        return *m_lpItem;    };    bool operator == (T *lpItem)    {        return (lpItem == m_lpItem);    };    bool operator == (SelfDestructionPointer &Item)    {        return (Item.m_lpItem == m_lpItem);    };    // extract guarded pointer    T *Extract(void)    {        T *lpReturn = m_lpItem;        m_lpItem = NULL;        return lpReturn;    };protected:    void Release(void)    {        if (m_lpItem)            delete m_lpItem;        m_lpItem = 0;    };    T *m_lpItem;};// comparing operator(s)template <class T>bool operator == (T *lpItem, SelfDestructionPointer<T> &Pointer){    return Pointer.opertator == (lpItem);}/*template <class T>bool operator == (size_t iValue, SelfDestructionPointer<T> &Pointer){    return Pointer.operator == (reinterpret_cast<T *> (iValue));};*/template <class T>bool operator == (void* pvValue, SelfDestructionPointer<T> &Pointer){    return Pointer.operator == (reinterpret_cast<T *> (pvValue));}template <class T>class SelfDestructionObject : public SelfDestructionPointer<T>{public:    T * operator -> (void)    {        return this->m_lpItem;    };    SelfDestructionObject & operator = (T *lpItem)    {        return static_cast<SelfDestructionObject &> (SelfDestructionPointer<T>::operator =(lpItem));    };    SelfDestructionObject & operator = (SelfDestructionObject &Item)    {        return static_cast<SelfDestructionObject &> (SelfDestructionPointer<T>::operator =(Item));    };};} // end namespace UMC#endif //__UMC_SELF_DESTRUCTION_POINTER

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -