锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久99精品成人片三人毛片,人妻无码久久精品,99国产精品久久http://m.shnenglu.com/yy2008/archive/2008/11/13/66837.html絀哄績鑿?/dc:creator>絀哄績鑿?/author>Thu, 13 Nov 2008 09:37:00 GMThttp://m.shnenglu.com/yy2008/archive/2008/11/13/66837.htmlhttp://m.shnenglu.com/yy2008/comments/66837.htmlhttp://m.shnenglu.com/yy2008/archive/2008/11/13/66837.html#Feedback3http://m.shnenglu.com/yy2008/comments/commentRss/66837.htmlhttp://m.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久久成人国产精品免费 | 热re99久久6国产精品免费| 伊人久久一区二区三区无码| 狠狠色丁香久久婷婷综合_中| 99久久这里只精品国产免费| 久久久久无码精品国产不卡| 国产精品99久久久久久www| 亚洲综合久久夜AV | 91精品国产9l久久久久| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 精品乱码久久久久久夜夜嗨| 久久精品国产欧美日韩99热| 久久亚洲国产精品一区二区| 综合久久精品色| 国产精品一区二区久久精品无码 | 久久99精品久久久久久hb无码 | 久久强奷乱码老熟女| 久久99精品久久久久婷婷| 欧美精品丝袜久久久中文字幕 | 亚洲国产精品一区二区久久| 久久久久久伊人高潮影院| 久久精品人人做人人爽97| 看全色黄大色大片免费久久久| MM131亚洲国产美女久久| 亚洲国产成人久久一区久久| 亚洲国产精品久久久久网站 | 久久这里有精品视频| 久久精品国产精品亚洲毛片| 伊人久久精品影院| 欧美激情精品久久久久久| 国产精品99久久精品爆乳| 久久综合久久自在自线精品自| 最新久久免费视频| 久久香综合精品久久伊人| 久久亚洲中文字幕精品一区| 狠狠色综合久久久久尤物| 97精品久久天干天天天按摩| 久久精品aⅴ无码中文字字幕不卡 久久精品成人欧美大片 | 亚洲AV日韩精品久久久久| 精品久久久久久国产三级| 国产成年无码久久久久毛片|