17 #if !defined(REUSABLEARENABLOCK_INCLUDE_GUARD_1357924680)
18 #define REUSABLEARENABLOCK_INCLUDE_GUARD_1357924680
29 XALAN_CPP_NAMESPACE_BEGIN
33 template <
class ObjectType,
34 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
37 class SizeType =
unsigned short>
67 (
next <= rightBorder ) ) ?
true : false ;
73 return reinterpret_cast<NextBlock*
>(thePointer);
77 cast(
const void* thePointer)
79 return reinterpret_cast<const NextBlock*
>(thePointer);
98 XALAN_STATIC_ASSERT(
sizeof(ObjectType) >=
sizeof(NextBlock));
115 NextBlock*
const pStruct =
152 assert ( this->m_firstFreeBlock == (this->
m_blockSize + 1) );
160 ObjectType* theResult = 0;
162 assert ( this->m_firstFreeBlock <= this->m_blockSize );
163 assert ( this->m_nextFreeBlock <= this->m_blockSize );
166 if(this->m_firstFreeBlock != this->m_nextFreeBlock)
180 assert(this->m_nextFreeBlock <= this->m_blockSize);
197 assert ( this->m_objectCount <= this->
m_blockSize );
199 this->m_firstFreeBlock = this->m_nextFreeBlock;
212 assert(theObject != 0);
215 if ( this->m_firstFreeBlock != this->m_nextFreeBlock )
218 void*
const p = this->
m_objectBlock + this->m_firstFreeBlock;
220 new (p) NextBlock(this->m_nextFreeBlock);
222 this->m_nextFreeBlock = this->m_firstFreeBlock;
230 new (theObject) NextBlock(this->m_firstFreeBlock);
233 this->m_nextFreeBlock =
236 assert (this->m_firstFreeBlock <= this->
m_blockSize);
253 assert ( theObject != 0 );
274 return !isOnFreeList(theObject);
282 return !(this->
ownsBlock(reinterpret_cast<const ObjectType*>(block)) &&
307 isOnFreeList(
const ObjectType* theObject)
const
315 ObjectType* pRunPtr = this->
m_objectBlock + this->m_firstFreeBlock;
323 if (pRunPtr == theObject)
329 NextBlock*
const p =
reinterpret_cast<NextBlock*
>(pRunPtr);
331 assert(p->isValidFor(this->m_blockSize));
349 XALAN_CPP_NAMESPACE_END
353 #endif // !defined(REUSABLEARENABLOCK_INCLUDE_GUARD_1357924680)
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
Definition: ReusableArenaBlock.hpp:52
BaseClassType::size_type size_type
Definition: ReusableArenaBlock.hpp:46
static ThisType * create(MemoryManagerType &theManager, size_type theBlockSize)
Definition: ReusableArenaBlock.hpp:128
ReusableArenaBlock< ObjectType, SizeType > ThisType
Definition: ReusableArenaBlock.hpp:48
bool shouldDestroyBlock(const ObjectType *theObject) const
Definition: ReusableArenaBlock.hpp:270
ObjectType * m_objectBlock
Definition: ArenaBlockBase.hpp:283
bool ownsBlock(const ObjectType *theObject) const
Definition: ArenaBlockBase.hpp:180
void destroyObject(ObjectType *theObject)
Definition: ReusableArenaBlock.hpp:210
~ReusableArenaBlock()
Definition: ReusableArenaBlock.hpp:106
bool ownsObject(const ObjectType *theObject) const
Definition: ReusableArenaBlock.hpp:251
NextBlock(size_type _next)
Definition: ReusableArenaBlock.hpp:57
void XalanDestroy(Type &theArg)
Definition: XalanMemoryManagement.hpp:102
void commitAllocation(ObjectType *)
Definition: ReusableArenaBlock.hpp:195
size_type m_objectCount
Definition: ArenaBlockBase.hpp:279
ReusableArenaBlock(MemoryManagerType &theManager, size_type theBlockSize)
Definition: ReusableArenaBlock.hpp:90
ObjectType * allocateBlock()
Definition: ReusableArenaBlock.hpp:148
bool isValidFor(size_type rightBorder) const
Definition: ReusableArenaBlock.hpp:64
Definition: ReusableArenaBlock.hpp:39
const size_type m_blockSize
Definition: ArenaBlockBase.hpp:281
ArenaBlockBase< ObjectType, SizeType > BaseClassType
Definition: ReusableArenaBlock.hpp:44
Definition: ArenaBlockBase.hpp:105
bool isOccupiedBlock(const NextBlock *block) const
Definition: ReusableArenaBlock.hpp:278
Type * XalanConstruct(MemoryManager &theMemoryManager, Type *&theInstance)
Definition: XalanMemoryManagement.hpp:152
static NextBlock * cast(void *thePointer)
Definition: ReusableArenaBlock.hpp:71
static const NextBlock * cast(const void *thePointer)
Definition: ReusableArenaBlock.hpp:77
Definition: ReusableArenaBlock.hpp:50
size_type next
Definition: ReusableArenaBlock.hpp:54
const int verificationStamp
Definition: ReusableArenaBlock.hpp:55
SizeType size_type
Definition: ArenaBlockBase.hpp:117