16 #if !defined(XALANARRAYALLOCATOR_HEADER_GUARD_1357924680)
17 #define XALANARRAYALLOCATOR_HEADER_GUARD_1357924680
35 XALAN_CPP_NAMESPACE_BEGIN
47 typedef XALAN_STD_QUALIFIER pair<size_type, VectorType * >
ListEntryType;
55 enum { eDefaultBlockSize = 500 };
63 size_type theBlockSize = eDefaultBlockSize) :
65 m_blockSize(theBlockSize),
76 for( iter = m_list.begin(); iter != m_list.end(); ++iter)
78 if( (*iter).second != 0)
80 #if defined(XALAN_REQUIRES_QUALIFIED_DESTRUCTOR)
81 (*iter).second->VectorType::~VectorType();
83 (*iter).second->~VectorType();
85 theManager.deallocate((
void*)(*iter).second);
109 if (m_list.empty() ==
true)
111 m_lastEntryFound = 0;
120 (*theCurrent).first = (*theCurrent).second->size();
123 }
while(theCurrent != theEnd);
125 m_lastEntryFound = &*m_list.begin();
139 if (theCount >= m_blockSize)
141 return createEntry(theCount, theCount);
152 return createEntry(m_blockSize, theCount);
158 assert( theEntry->second != 0);
159 Type*
const thePointer =
160 &*theEntry->second->begin() + (theEntry->second->size() - theEntry->first);
163 theEntry->first -= theCount;
178 assert(theBlockSize >= theCount);
182 m_list.push_back(ListEntryType(0, VectorType::create(m_list.getMemoryManager())));
185 ListEntryType& theNewEntry = m_list.back();
188 assert(theNewEntry.second);
190 theNewEntry.second->resize(theBlockSize, value_type());
193 theNewEntry.first = theBlockSize - theCount;
195 if (theNewEntry.first != 0)
197 m_lastEntryFound = &theNewEntry;
201 return &*theNewEntry.second->begin();
209 if (m_lastEntryFound != 0 && m_lastEntryFound->first >= theCount)
211 return m_lastEntryFound;
215 const ListIteratorType theEnd = m_list.end();
216 ListIteratorType theCurrent = m_list.begin();
218 ListEntryType* theEntry = 0;
220 while(theCurrent != theEnd)
226 if ((*theCurrent).first == theCount)
228 theEntry = &*theCurrent;
232 else if ((*theCurrent).first >= theCount)
242 (*theCurrent).first < theEntry->first)
245 theEntry = &*theCurrent;
257 m_lastEntryFound = theEntry;
278 ListEntryType* m_lastEntryFound;
283 XALAN_CPP_NAMESPACE_END
287 #endif // !defined(XALANARRAYALLOCATOR_HEADER_GUARD_1357924680)