diff --git a/src/xercesc/util/NameIdPool.c b/src/xercesc/util/NameIdPool.c index fd33b77edccbe2d28fb7e7f3b53103b5435ec3b4..39224bbfdcbd86ee3be685d6cb9d0452e2b973c2 100644 --- a/src/xercesc/util/NameIdPool.c +++ b/src/xercesc/util/NameIdPool.c @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.7 2003/10/29 16:18:05 peiyongz + * size() added and Reset() bug fixed + * * Revision 1.6 2003/05/16 06:01:52 knoaman * Partial implementation of the configurable memory manager. * @@ -374,14 +377,7 @@ NameIdPoolEnumerator(NameIdPool<TElem>* const toEnum) : , fCurIndex(0) , fToEnum(toEnum) { - // - // Find the next available bucket element in the pool. We use the id - // array since its very easy to enumerator through by just maintaining - // an index. If the id counter is zero, then its empty and we leave the - // current index to zero. - // - if (toEnum->fIdCounter) - fCurIndex = 1; + Reset(); } template <class TElem> NameIdPoolEnumerator<TElem>:: @@ -438,7 +434,18 @@ template <class TElem> TElem& NameIdPoolEnumerator<TElem>::nextElement() template <class TElem> void NameIdPoolEnumerator<TElem>::Reset() { - fCurIndex = 0; + // + // Find the next available bucket element in the pool. We use the id + // array since its very easy to enumerator through by just maintaining + // an index. If the id counter is zero, then its empty and we leave the + // current index to zero. + // + fCurIndex = fToEnum->fIdCounter ? 1:0; +} + +template <class TElem> int NameIdPoolEnumerator<TElem>::size() const +{ + return fToEnum->fIdCounter; } XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/util/RefHash3KeysIdPool.c b/src/xercesc/util/RefHash3KeysIdPool.c index bd2ea313cf4533017a2b3a28cb66dd2cf99e83d9..614c83a4acdf5ad9120d093374494a9cb209b7ee 100644 --- a/src/xercesc/util/RefHash3KeysIdPool.c +++ b/src/xercesc/util/RefHash3KeysIdPool.c @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.7 2003/10/29 16:18:05 peiyongz + * size() added and Reset() bug fixed + * * Revision 1.6 2003/06/02 15:18:08 neilg * fix for bug #20092; thanks to Berin Lautenbach * @@ -443,14 +446,7 @@ RefHash3KeysIdPoolEnumerator(RefHash3KeysIdPool<TVal>* const toEnum, const bool if (!toEnum) ThrowXML(NullPointerException, XMLExcepts::CPtr_PointerIsZero); - // - // Find the next available bucket element in the pool. We use the id - // array since its very easy to enumerator through by just maintaining - // an index. If the id counter is zero, then its empty and we leave the - // current index to zero. - // - if (toEnum->fIdCounter) - fCurIndex = 1; + Reset(); } template <class TVal> RefHash3KeysIdPoolEnumerator<TVal>::~RefHash3KeysIdPoolEnumerator() @@ -483,7 +479,19 @@ template <class TVal> TVal& RefHash3KeysIdPoolEnumerator<TVal>::nextElement() template <class TVal> void RefHash3KeysIdPoolEnumerator<TVal>::Reset() { - fCurIndex = 0; + // + // Find the next available bucket element in the pool. We use the id + // array since its very easy to enumerator through by just maintaining + // an index. If the id counter is zero, then its empty and we leave the + // current index to zero. + // + fCurIndex = fToEnum->fIdCounter ? 1:0; + +} + +template <class TVal> int RefHash3KeysIdPoolEnumerator<TVal>::size() const +{ + return fToEnum->fIdCounter; } XERCES_CPP_NAMESPACE_END