锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久99精品成人片三人毛片,人妻无码久久精品,99国产精品久久http://www.shnenglu.com/yy2008/archive/2008/11/13/66837.html絀哄績鑿?/dc:creator>絀哄績鑿?/author>Thu, 13 Nov 2008 09:37:00 GMThttp://www.shnenglu.com/yy2008/archive/2008/11/13/66837.htmlhttp://www.shnenglu.com/yy2008/comments/66837.htmlhttp://www.shnenglu.com/yy2008/archive/2008/11/13/66837.html#Feedback3http://www.shnenglu.com/yy2008/comments/commentRss/66837.htmlhttp://www.shnenglu.com/yy2008/services/trackbacks/66837.html
#ifndef __SharedPtr_H__
#define __SharedPtr_H__
#include "OgrePrerequisites.h"
namespace Ogre {
    template<class T> class SharedPtr {
    protected:
        T* pRep;           
        unsigned int* pUseCount; //鐪嬪埌榪欓噷錛屽簲璇ヨ兘鐭ラ亾錛孲haredPtr鏄氳繃寮曠敤璁℃暟鏉ョ鐞唒Rep鐨勫鍛?nbsp;     
    public:
        OGRE_AUTO_SHARED_MUTEX            
        SharedPtr() : pRep(0), pUseCount(0)
        {
            OGRE_SET_AUTO_SHARED_MUTEX_NULL
        }錛忥紡鍏佽鏈変竴涓┖鐨凷haredPtr,涓嶆寚鍚戜換浣曠殑瀵硅薄銆?br>
        template< class Y>
        explicit SharedPtr(Y* rep) : pRep(rep), pUseCount(new unsigned int(1))
        {
            OGRE_SET_AUTO_SHARED_MUTEX_NULL
            OGRE_NEW_AUTO_SHARED_MUTEX
        }//榪欎釜鍐欐硶鏄疢ember Templates錛屽緢鏈夌敤錛岃繖鏍峰氨鍏佽鐢ㄤ竴涓猋瀵硅薄鐨勬寚閽堟潵鍒濆鍖栦竴涓猄haredPtr<T>
                 //涓嬮潰榪樿兘鐪嬪埌寰堝榪欐牱鐨凪ember Templates
                 //瑕佹槸浠ュ墠娌¤榪囩殑浜猴紝鎺ㄨ崘鐪嬩竴涓婥++ Templates鐨勭5绔犮佺3鑺?br>                 //try this:   vector<int> intvec;
                 //       vector<float> floatvec;
                 //       floatvec = intvec ???????
                 //鎻愪竴涓嬶紝鎵鏈夌殑鍒濆鍖栧嚱鏁伴兘娌℃湁媯鏌ep鏄惁闈炵┖錛屾墍浠haredPtr鎺ュ彈涓涓狽ull鎸囬拡
                 //瀹夊叏媯鏌ュ湪姣忔璋冪敤鐨勬椂鍊?br>                 //榪欓噷榪樹嬌鐢ㄤ簡鍏抽敭瀛梕xplicit錛岀姝簡闅愬紡杞崲

        SharedPtr(const SharedPtr& r)
            : pRep(0), pUseCount(0)
        {
            OGRE_SET_AUTO_SHARED_MUTEX_NULL
            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
            {
                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
                OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
                pRep = r.pRep; //娉ㄦ剰涓嬩笌鍚庨潰鐨勪笉鍚?br>                pUseCount = r.pUseCount;
                // Handle zero pointer gracefully to manage STL containers
                if(pUseCount)
                {
                    ++(*pUseCount); 
                }
            }
        }

        SharedPtr& operator=(const SharedPtr& r) {
            if (pRep == r.pRep)
                return *this;
            SharedPtr<T> tmp(r);
            swap(tmp);
            return *this;
        }//榪欓噷鐨勫啓娉曟湁鐐規剰鎬濓紝鏈潵鍦╬Rep鎸囧悜r.pRep涔嬪墠瀵筽Rep鍋氫竴嬈elease錛?br>                 //浣嗘槸榪欓噷娌$湅鍒幫紝鍏跺疄鏄氳繃tmp榪欎釜灞閮ㄥ彉閲忕殑鑷姩瑙f瀽瀹炵幇鐨勩?br>        template< class Y>
        SharedPtr(const SharedPtr<Y>& r)
            : pRep(0), pUseCount(0)
        {
            OGRE_SET_AUTO_SHARED_MUTEX_NULL
            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
            {
                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
                OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
                pRep = r.getPointer(); //榪欓噷鐢ㄧ殑鏄嚱鏁幫紝鍜屼笂闈㈤偅涓殑鍖哄埆錛燂紵
                pUseCount = r.useCountPointer();
                // Handle zero pointer gracefully to manage STL containers
                if(pUseCount)
                {
                    ++(*pUseCount);
                }
            }
        }
        template< class Y>
        SharedPtr& operator=(const SharedPtr<Y>& r) {
            if (pRep == r.pRep)
                return *this;
            SharedPtr<T> tmp(r);
            swap(tmp);
            return *this;
        }
        virtual ~SharedPtr() {
            release();
        }
        inline T& operator*() const { assert(pRep); return *pRep; }
        inline T* operator->() const { assert(pRep); return pRep; }
                //鍦ㄧ敤鐨勬椂鍊欐鏌Rep鐨勫悎娉曟?br>        inline T* get() const { return pRep; }
        void bind(T* rep) {
            assert(!pRep && !pUseCount);
            OGRE_NEW_AUTO_SHARED_MUTEX
            OGRE_LOCK_AUTO_SHARED_MUTEX
            pUseCount = new unsigned int(1);
            pRep = rep;
        }
        inline bool unique() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount == 1; }
        inline unsigned int useCount() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount; }
        inline unsigned int* useCountPointer() const { return pUseCount; }
        inline T* getPointer() const { return pRep; }
        inline bool isNull(void) const { return pRep == 0; }
        inline void setNull(void) {
            if (pRep)
            {
                // can't scope lock mutex before release incase deleted
                release();
                pRep = 0;
                pUseCount = 0;
            }
        }

    protected:

        inline void release(void)
        {
            bool destroyThis = false;
            OGRE_MUTEX_CONDITIONAL(OGRE_AUTO_MUTEX_NAME)
            {
                OGRE_LOCK_AUTO_SHARED_MUTEX
                if (pUseCount)
                {
                    if (--(*pUseCount) == 0)
                    {
                        destroyThis = true;
                    }
                }
            }
            if (destroyThis)
                destroy();

            OGRE_SET_AUTO_SHARED_MUTEX_NULL
        }

        virtual void destroy(void)
        {
            delete pRep;
            delete pUseCount;
            OGRE_DELETE_AUTO_SHARED_MUTEX
        }

        virtual void swap(SharedPtr<T> &other)
        {
            std::swap(pRep, other.pRep);
            std::swap(pUseCount, other.pUseCount);
#if OGRE_THREAD_SUPPORT
            std::swap(OGRE_AUTO_MUTEX_NAME, other.OGRE_AUTO_MUTEX_NAME);
#endif
        }
    };

    template<class T, class U> inline bool operator==(SharedPtr<T> const& a, SharedPtr<U> const& b)
    {
        return a.get() == b.get();
    }

    template<class T, class U> inline bool operator!=(SharedPtr<T> const& a, SharedPtr<U> const& b)
    {
        return a.get() != b.get();
    }
}
#endif
鏈鍚庢湁娉ㄦ剰鍒幫細
    inline T* get() const { return pRep; }
    inline T* getPointer() const { return pRep; }
涓嶇煡閬撲負鍟ヨ榪欐牱錛屾湁涓涓笉灝辮浜嗕箞銆?br>鏇村鐨勭粏鑺傘佷嬌鐢ㄦ柟娉曟斁鍒頒笅嬈℃妸銆?br>

]]>
久久99国产精品二区不卡| 亚洲综合久久夜AV | 国产精品久久久久…| 亚洲伊人久久大香线蕉苏妲己| 精品久久人人爽天天玩人人妻| 久久精品视频一| 久久这里只精品国产99热 | 国内精品人妻无码久久久影院导航| 久久精品国产色蜜蜜麻豆| 99久久久国产精品免费无卡顿| 久久播电影网| 精品国产乱码久久久久久1区2区 | 亚洲综合精品香蕉久久网| 91久久精一区二区三区大全| 午夜精品久久久久久久无码| 99久久国产热无码精品免费 | 国产激情久久久久影院| 久久精品国产AV一区二区三区| 青青草原综合久久| 久久久久久久人妻无码中文字幕爆 | 久久久久亚洲国产| 欧美精品一区二区精品久久| 国内精品久久久久久久久电影网| 国产精品美女久久久网AV| 97久久超碰成人精品网站| 久久99久国产麻精品66| 日日狠狠久久偷偷色综合96蜜桃| 97久久国产亚洲精品超碰热| 亚洲国产精品无码久久SM| 久久精品青青草原伊人| 精品国产99久久久久久麻豆| 日本精品久久久久影院日本| 久久免费国产精品| 久久久精品人妻无码专区不卡| 精品乱码久久久久久夜夜嗨| 岛国搬运www久久| 激情久久久久久久久久| 久久精品国产一区二区电影| 久久久久这里只有精品| 亚洲AⅤ优女AV综合久久久| 日韩美女18网站久久精品|