18 #if !defined(XALANARRAYALLOCATOR_HEADER_GUARD_1357924680)
19 #define XALANARRAYALLOCATOR_HEADER_GUARD_1357924680
57 enum { eDefaultBlockSize = 500 };
65 size_type theBlockSize = eDefaultBlockSize) :
67 m_blockSize(theBlockSize),
76 MemoryManager& theManager = m_list.getMemoryManager();
78 for( iter = m_list.begin(); iter != m_list.end(); ++iter)
80 if( (*iter).second != 0)
82 (*iter).second->VectorType::~VectorType();
83 theManager.deallocate((
void*)(*iter).second);
107 if (m_list.empty() ==
true)
109 m_lastEntryFound = 0;
118 (*theCurrent).first = (*theCurrent).second->size();
121 }
while(theCurrent != theEnd);
123 m_lastEntryFound = &*m_list.begin();
137 if (theCount >= m_blockSize)
139 return createEntry(theCount, theCount);
150 return createEntry(m_blockSize, theCount);
156 assert( theEntry->second != 0);
157 Type*
const thePointer =
158 &*theEntry->second->begin() + (theEntry->second->size() - theEntry->first);
161 theEntry->first -= theCount;
176 assert(theBlockSize >= theCount);
180 m_list.push_back(ListEntryType(0, VectorType::create(m_list.getMemoryManager())));
183 ListEntryType& theNewEntry = m_list.back();
186 assert(theNewEntry.second);
188 theNewEntry.second->resize(theBlockSize, value_type());
191 theNewEntry.first = theBlockSize - theCount;
193 if (theNewEntry.first != 0)
195 m_lastEntryFound = &theNewEntry;
199 return &*theNewEntry.second->begin();
207 if (m_lastEntryFound != 0 && m_lastEntryFound->first >= theCount)
209 return m_lastEntryFound;
213 const ListIteratorType theEnd = m_list.end();
214 ListIteratorType theCurrent = m_list.begin();
216 ListEntryType* theEntry = 0;
218 while(theCurrent != theEnd)
224 if ((*theCurrent).first == theCount)
226 theEntry = &*theCurrent;
230 else if ((*theCurrent).first >= theCount)
240 (*theCurrent).first < theEntry->first)
243 theEntry = &*theCurrent;
255 m_lastEntryFound = theEntry;
262 XalanArrayAllocator(
const XalanArrayAllocator<Type>& theSource);
264 XalanArrayAllocator<Type>&
265 operator=(
const XalanArrayAllocator<Type>& theSource);
268 operator==(
const XalanArrayAllocator<Type>& theRHS)
const;
276 ListEntryType* m_lastEntryFound;
285 #endif // !defined(XALANARRAYALLOCATOR_HEADER_GUARD_1357924680)