You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/10/30 04:57:06 UTC
cvs commit: xml-xalan/c/src/Include XalanObjectCache.hpp
dbertoni 01/10/29 19:57:06
Modified: c/src/Include XalanObjectCache.hpp
Log:
Changed name of class and made it more auto_ptr-like.
Revision Changes Path
1.5 +19 -6 xml-xalan/c/src/Include/XalanObjectCache.hpp
Index: XalanObjectCache.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/Include/XalanObjectCache.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanObjectCache.hpp 2001/05/10 17:46:34 1.4
+++ XalanObjectCache.hpp 2001/10/30 03:57:06 1.5
@@ -363,21 +363,24 @@
template<class XalanObjectCacheType>
-class GetReleaseCachedObject
+class GuardCachedObject
{
public:
typedef typename XalanObjectCacheType::CacheObjectType CacheObjectType;
- GetReleaseCachedObject(XalanObjectCacheType& theCache) :
+ GuardCachedObject(XalanObjectCacheType& theCache) :
m_cache(theCache),
m_cachedObject(theCache.get())
{
}
- ~GetReleaseCachedObject()
+ ~GuardCachedObject()
{
- m_cache.release(m_cachedObject);
+ if (m_cachedObject != 0)
+ {
+ m_cache.release(m_cachedObject);
+ }
}
CacheObjectType*
@@ -386,16 +389,26 @@
return m_cachedObject;
}
+ CacheObjectType*
+ release()
+ {
+ CacheObjectType* const temp = m_cachedObject;
+
+ m_cachedObject = 0;
+
+ return temp;
+ }
+
private:
// Not implemented...
- GetReleaseCachedObject(const GetReleaseCachedObject<XalanObjectCacheType>&);
+ GuardCachedObject(const GuardCachedObject<XalanObjectCacheType>&);
// Data members...
XalanObjectCacheType& m_cache;
- CacheObjectType* const m_cachedObject;
+ CacheObjectType* m_cachedObject;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org