18 #if !defined(XALANARRAYALLOCATOR_HEADER_GUARD_1357924680)
19 #define XALANARRAYALLOCATOR_HEADER_GUARD_1357924680
37 XALAN_CPP_NAMESPACE_BEGIN
49 typedef XALAN_STD_QUALIFIER pair<size_type, VectorType * >
ListEntryType;
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 #if defined(XALAN_REQUIRES_QUALIFIED_DESTRUCTOR)
83 (*iter).second->VectorType::~VectorType();
85 (*iter).second->~VectorType();
87 theManager.deallocate((
void*)(*iter).second);
100 m_lastEntryFound = 0;
111 if (m_list.empty() ==
true)
113 m_lastEntryFound = 0;
122 (*theCurrent).first = (*theCurrent).second->size();
125 }
while(theCurrent != theEnd);
127 m_lastEntryFound = &*m_list.begin();
141 if (theCount >= m_blockSize)
143 return createEntry(theCount, theCount);
154 return createEntry(m_blockSize, theCount);
160 assert( theEntry->second != 0);
161 Type*
const thePointer =
162 &*theEntry->second->begin() + (theEntry->second->size() - theEntry->first);
165 theEntry->first -= theCount;
180 assert(theBlockSize >= theCount);
184 m_list.push_back(ListEntryType(0, VectorType::create(m_list.getMemoryManager())));
187 ListEntryType& theNewEntry = m_list.back();
190 assert(theNewEntry.second);
192 theNewEntry.second->resize(theBlockSize, value_type());
195 theNewEntry.first = theBlockSize - theCount;
197 if (theNewEntry.first != 0)
199 m_lastEntryFound = &theNewEntry;
203 return &*theNewEntry.second->begin();
211 if (m_lastEntryFound != 0 && m_lastEntryFound->first >= theCount)
213 return m_lastEntryFound;
217 const ListIteratorType theEnd = m_list.end();
218 ListIteratorType theCurrent = m_list.begin();
220 ListEntryType* theEntry = 0;
222 while(theCurrent != theEnd)
228 if ((*theCurrent).first == theCount)
230 theEntry = &*theCurrent;
234 else if ((*theCurrent).first >= theCount)
244 (*theCurrent).first < theEntry->first)
247 theEntry = &*theCurrent;
259 m_lastEntryFound = theEntry;
280 ListEntryType* m_lastEntryFound;
285 XALAN_CPP_NAMESPACE_END
289 #endif // !defined(XALANARRAYALLOCATOR_HEADER_GUARD_1357924680)