19 #if !defined(REUSABLEARENABLOCK_INCLUDE_GUARD_1357924680) 20 #define REUSABLEARENABLOCK_INCLUDE_GUARD_1357924680 31 XALAN_CPP_NAMESPACE_BEGIN
35 template <
class ObjectType,
36 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS) 39 class SizeType =
unsigned short>
69 ( next <= rightBorder ) ) ? true : false ;
81 MemoryManager& theManager,
82 size_type theBlockSize) :
83 BaseClassType(theManager, theBlockSize),
88 XALAN_STATIC_ASSERT(
sizeof(ObjectType) >=
sizeof(
NextBlock));
98 size_type removedObjects = 0;
100 for (size_type i = 0;
116 MemoryManager& theManager,
117 size_type theBlockSize)
119 ThisType* theInstance;
139 assert ( this->m_firstFreeBlock == (this->
m_blockSize + 1) );
147 ObjectType* theResult = 0;
149 assert ( this->m_firstFreeBlock <= this->m_blockSize );
150 assert ( this->m_nextFreeBlock <= this->m_blockSize );
153 if(this->m_firstFreeBlock != this->m_nextFreeBlock)
167 this->m_nextFreeBlock = theBlock->next;
169 assert(theBlock->isValidFor(this->m_blockSize));
170 assert(this->m_nextFreeBlock <= this->m_blockSize);
187 assert ( this->m_objectCount <= this->
m_blockSize );
189 this->m_firstFreeBlock = this->m_nextFreeBlock;
202 assert(theObject != 0);
205 if ( this->m_firstFreeBlock != this->m_nextFreeBlock )
208 void*
const p = this->
m_objectBlock + this->m_firstFreeBlock;
210 new (p)
NextBlock(this->m_nextFreeBlock);
212 this->m_nextFreeBlock = this->m_firstFreeBlock;
220 new (theObject)
NextBlock(this->m_firstFreeBlock);
223 this->m_nextFreeBlock =
226 assert (this->m_firstFreeBlock <= this->
m_blockSize);
243 assert ( theObject != 0 );
264 return !isOnFreeList(theObject);
297 isOnFreeList(
const ObjectType* theObject)
const 305 ObjectType* pRunPtr = this->
m_objectBlock + this->m_firstFreeBlock;
307 for (size_type i = 0;
313 if (pRunPtr == theObject)
321 assert(p->isValidFor(this->m_blockSize));
332 size_type m_firstFreeBlock;
334 size_type m_nextFreeBlock;
339 XALAN_CPP_NAMESPACE_END
343 #endif // !defined(REUSABLEARENABLOCK_INCLUDE_GUARD_1357924680) bool isValidFor(size_type rightBorder) const
ReusableArenaBlock(MemoryManager &theManager, size_type theBlockSize)
BaseClassType::size_type size_type
ReusableArenaBlock< ObjectType, SizeType > ThisType
ObjectType * m_objectBlock
void destroyObject(ObjectType *theObject)
static ThisType * create(MemoryManager &theManager, size_type theBlockSize)
NextBlock(size_type _next)
void XalanDestroy(Type &theArg)
void commitAllocation(ObjectType *)
bool shouldDestroyBlock(const ObjectType *theObject) const
ObjectType * allocateBlock()
bool operator==(const ElemAttributeSet &theLHS, const ElemAttributeSet &theRHS)
const size_type m_blockSize
ArenaBlockBase< ObjectType, SizeType > BaseClassType
bool ownsObject(const ObjectType *theObject) const
bool ownsBlock(const ObjectType *theObject) const
Type * XalanConstruct(MemoryManager &theMemoryManager, Type *&theInstance)
bool isOccupiedBlock(const ObjectType *block) const
const int verificationStamp