diff --git a/Foundation/include/Poco/SharedPtr.h b/Foundation/include/Poco/SharedPtr.h index a58ec4de3..e76531038 100644 --- a/Foundation/include/Poco/SharedPtr.h +++ b/Foundation/include/Poco/SharedPtr.h @@ -9,7 +9,7 @@ // // Definition of the SharedPtr template class. // -// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization @@ -75,7 +75,7 @@ private: }; -template +template class SharedPtr /// SharedPtr is a "smart" pointer for classes implementing /// reference counting based garbage collection. @@ -104,16 +104,16 @@ class SharedPtr /// is required. { public: - SharedPtr(): _pCounter(new ReferenceCounter), _ptr(0) + SharedPtr(): _pCounter(new RC), _ptr(0) { } - SharedPtr(C* ptr): _pCounter(new ReferenceCounter), _ptr(ptr) + SharedPtr(C* ptr): _pCounter(new RC), _ptr(ptr) { } template - SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(const_cast(ptr.get())) + SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(const_cast(ptr.get())) { _pCounter->duplicate(); } @@ -132,7 +132,7 @@ public: { if (get() != ptr) { - ReferenceCounter* pTmp = new ReferenceCounter; + RC* pTmp = new RC; release(); _pCounter = pTmp; _ptr = ptr; @@ -151,7 +151,7 @@ public: } template - SharedPtr& assign(const SharedPtr& ptr) + SharedPtr& assign(const SharedPtr& ptr) { if (ptr.get() != _ptr) { @@ -172,7 +172,7 @@ public: } template - SharedPtr& operator = (const SharedPtr& ptr) + SharedPtr& operator = (const SharedPtr& ptr) { return assign(ptr); } @@ -184,7 +184,7 @@ public: } template - SharedPtr cast() const + SharedPtr cast() const /// Casts the SharedPtr via a dynamic cast to the given type. /// Returns an SharedPtr containing NULL if the cast fails. /// Example: (assume class Sub: public Super) @@ -199,7 +199,7 @@ public: } template - SharedPtr unsafeCast() const + SharedPtr unsafeCast() const /// Casts the SharedPtr via a static cast to the given type. /// Example: (assume class Sub: public Super) /// SharedPtr super(new Sub()); @@ -207,7 +207,7 @@ public: /// poco_assert (sub.get()); { Other* pOther = static_cast(_ptr); - return SharedPtr(_pCounter, pOther); + return SharedPtr(_pCounter, pOther); } C* operator -> () @@ -374,7 +374,7 @@ private: } } - SharedPtr(ReferenceCounter* pCounter, C* ptr): _pCounter(pCounter), _ptr(ptr) + SharedPtr(RC* pCounter, C* ptr): _pCounter(pCounter), _ptr(ptr) /// for cast operation { poco_assert_dbg (_pCounter); @@ -382,15 +382,15 @@ private: } private: - ReferenceCounter* _pCounter; - C* _ptr; + RC* _pCounter; + C* _ptr; - template friend class SharedPtr; + template friend class SharedPtr; }; -template -inline void swap(SharedPtr& p1, SharedPtr& p2) +template +inline void swap(SharedPtr& p1, SharedPtr& p2) { p1.swap(p2); }