16 #if !defined(XALAN_OBJECTCACHE_HEADER_GUARD)
17 #define XALAN_OBJECTCACHE_HEADER_GUARD
31 XALAN_CPP_NAMESPACE_BEGIN
35 template<
class ObjectType>
43 typedef ObjectType ThisType;
47 ThisType* theResult = theGuard.
get();
49 new (theResult) ThisType();
58 template<
class ObjectType>
66 typedef ObjectType ThisType;
70 ThisType* theResult = theGuard.
get();
72 new (theResult) ThisType(theManager);
81 template<
class ObjectType>
94 template<
class ObjectType>
102 theInstance->clear();
108 #if defined(XALAN_OBJECT_CACHE_KEEP_BUSY_LIST)
112 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
113 class CreateFunctorType,
114 class DeleteFunctorType,
115 class ResetFunctorType>
132 unsigned int initialListSize = 0) :
133 m_availableList(theManager),
134 m_busyList(theManager)
136 m_availableList.
reserve(initialListSize);
138 m_busyList.reserve(initialListSize);
145 #if !defined(XALAN_NO_STD_NAMESPACE)
150 m_availableList.
begin(),
151 m_availableList.
end(),
160 if (m_availableList.
empty() ==
true)
164 m_busyList.push_back(theNewObject);
170 ObjectType*
const theObject = m_availableList.
back();
172 m_busyList.push_back(theObject);
181 release(ObjectType* theInstance)
183 #if !defined(XALAN_NO_STD_NAMESPACE)
189 const IteratorType i =
195 if (i == m_busyList.end())
214 while (m_busyList.empty() ==
false)
216 ObjectType*
const theInstance = m_busyList.back();
222 m_busyList.pop_back();
256 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
257 class CreateFunctorType,
258 class DeleteFunctorType,
259 class ResetFunctorType>
275 unsigned int initialListSize = 0) :
277 m_availableList(theManager)
279 m_availableList.
reserve(initialListSize);
286 #if !defined(XALAN_NO_STD_NAMESPACE)
291 m_availableList.
begin(),
292 m_availableList.
end(),
301 if (m_availableList.
empty() ==
true)
307 ObjectType*
const theObject = m_availableList.
back();
356 template<
class XalanObjectCacheType>
365 m_cachedObject(theCache.
get())
371 if (m_cachedObject != 0)
373 m_cache.release(m_cachedObject);
380 return m_cachedObject;
400 XalanObjectCacheType& m_cache;
407 template<
class ObjectType>
411 DefaultCacheCreateFunctor<ObjectType>,
412 DeleteFunctor<ObjectType>,
413 DefaultCacheResetFunctor<ObjectType> >
426 unsigned int initialListSize = 0) :
434 template<
class ObjectType>
438 DefaultCacheCreateFunctorMemMgr<ObjectType>,
439 DeleteFunctor<ObjectType>,
440 DefaultCacheResetFunctor<ObjectType> >
453 unsigned int initialListSize = 0) :
461 XALAN_CPP_NAMESPACE_END