File indexing completed on 2025-01-30 10:27:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #if !defined(XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP)
0032 #define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP
0033
0034
0035 #include <xercesc/util/Hashers.hpp>
0036 #include <xercesc/util/IllegalArgumentException.hpp>
0037 #include <xercesc/util/NoSuchElementException.hpp>
0038 #include <xercesc/util/RuntimeException.hpp>
0039 #include <xercesc/util/XMLExceptMsgs.hpp>
0040 #include <xercesc/util/XMLEnumerator.hpp>
0041
0042 XERCES_CPP_NAMESPACE_BEGIN
0043
0044
0045
0046
0047
0048 template <class TVal>
0049 struct DOMDeepNodeListPoolTableBucketElem : public XMemory
0050 {
0051 DOMDeepNodeListPoolTableBucketElem
0052 (
0053 void* key1
0054 , XMLCh* key2
0055 , XMLCh* key3
0056 , TVal* const value
0057 , DOMDeepNodeListPoolTableBucketElem<TVal>* next
0058 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0059 ) :
0060 fData(value)
0061 , fNext(next)
0062 , fKey1(key1)
0063 , fKey2(0)
0064 , fKey3(0)
0065 {
0066 if (key2)
0067 fKey2 = XMLString::replicate(key2, manager);
0068
0069 if (key3)
0070 fKey3 = XMLString::replicate(key3, manager);
0071 }
0072
0073 TVal* fData;
0074 DOMDeepNodeListPoolTableBucketElem<TVal>* fNext;
0075 void* fKey1;
0076 XMLCh* fKey2;
0077 XMLCh* fKey3;
0078
0079 ~DOMDeepNodeListPoolTableBucketElem() {};
0080 };
0081
0082
0083 template <class TVal, class THasher = PtrHasher>
0084 class DOMDeepNodeListPool
0085 {
0086 public:
0087
0088
0089
0090 DOMDeepNodeListPool
0091 (
0092 const XMLSize_t modulus
0093 , const XMLSize_t initSize = 128
0094 );
0095
0096 DOMDeepNodeListPool
0097 (
0098 const XMLSize_t modulus
0099 , const bool adoptElems
0100 , const XMLSize_t initSize = 128
0101 );
0102
0103 DOMDeepNodeListPool
0104 (
0105 const XMLSize_t modulus
0106 , const bool adoptElems
0107 , const THasher& hasher
0108 , const XMLSize_t initSize = 128
0109 );
0110
0111 ~DOMDeepNodeListPool();
0112
0113
0114
0115
0116 bool isEmpty() const;
0117 bool containsKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const;
0118 void removeAll();
0119 void cleanup();
0120
0121
0122
0123
0124
0125 TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3);
0126 const TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const;
0127
0128 TVal* getById(const XMLSize_t elemId);
0129 const TVal* getById(const XMLSize_t elemId) const;
0130
0131
0132
0133
0134 XMLSize_t put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt);
0135
0136 private:
0137
0138
0139
0140
0141 DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal);
0142 const DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) const;
0143 void initialize(const XMLSize_t modulus);
0144
0145
0146
0147
0148 DOMDeepNodeListPool(const DOMDeepNodeListPool<TVal, THasher> &);
0149 DOMDeepNodeListPool<TVal, THasher> & operator = (const DOMDeepNodeListPool<TVal, THasher> &);
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 bool fAdoptedElems;
0185 DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList;
0186 XMLSize_t fHashModulus;
0187 TVal** fIdPtrs;
0188 XMLSize_t fIdPtrsCount;
0189 XMLSize_t fIdCounter;
0190 MemoryManager* fMemoryManager;
0191 THasher fHasher;
0192 };
0193
0194 XERCES_CPP_NAMESPACE_END
0195
0196 #if !defined(XERCES_TMPLSINC)
0197 #include <xercesc/dom/impl/DOMDeepNodeListPool.c>
0198 #endif
0199
0200 #endif