锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品视频免费,久久天天躁狠狠躁夜夜96流白浆,日韩精品久久久久久久电影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> 
]]>
一本色综合网久久|
人人妻久久人人澡人人爽人人精品|
久久人妻少妇嫩草AV蜜桃|
jizzjizz国产精品久久|
亚洲精品99久久久久中文字幕|
人妻无码αv中文字幕久久琪琪布|
曰曰摸天天摸人人看久久久|
亚洲国产欧美国产综合久久|
久久久久综合中文字幕|
久久亚洲欧美日本精品|
久久综合九色综合网站|
女人香蕉久久**毛片精品|
人妻中文久久久久|
漂亮人妻被中出中文字幕久久|
久久精品人人做人人爽电影|
色综合久久综合网观看|
亚洲国产成人精品女人久久久|
久久久久久亚洲精品无码|
97久久超碰成人精品网站|
欧美一区二区三区久久综合|
久久se精品一区二区影院|
国产99久久久国产精免费|
久久国产视频网|
久久精品aⅴ无码中文字字幕不卡|
久久人人爽人人爽人人片av麻烦|
狠狠色丁香婷婷综合久久来|
香蕉久久夜色精品国产2020
|
欧美激情精品久久久久久|
精品国产乱码久久久久久人妻|
狠狠久久综合伊人不卡|
久久综合久久综合九色|
精品久久久久久成人AV|
亚洲AV无一区二区三区久久|
国产精品成人久久久|
欧美日韩精品久久久免费观看|
久久综合色区|
亚洲国产精品成人久久蜜臀|
久久无码精品一区二区三区|
久久伊人色|
久久精品免费一区二区|
久久久国产精华液|