Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XalanDOMStringHashTable.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #if !defined(XALANDOMSTRINGHASHTABLE_HEADER_GUARD_1357924680)
00017 #define XALANDOMSTRINGHASHTABLE_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 // Base include file.  Must be first.
00022 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
00023 
00024 
00025 
00026 #include <xalanc/Include/XalanVector.hpp>
00027 
00028 
00029 #include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
00030 
00031 
00032 
00033 
00034 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00035 
00036 
00037 
00038 XALAN_CPP_NAMESPACE_BEGIN
00039 
00040 
00041 
00042 class XALAN_PLATFORMSUPPORT_EXPORT XalanDOMStringHashTable
00043 {
00044 public:
00045 
00046     typedef XalanVector<const XalanDOMString*>  BucketType;
00047     typedef BucketType::size_type               bucket_size_type;
00048     typedef XalanVector<bucket_size_type>       BucketCountsType;
00049 
00050     enum { eDefaultBucketCount = 101, eDefaultBucketSize = 15 };
00051 
00052 
00059     explicit
00060     XalanDOMStringHashTable(
00061             MemoryManagerType&  theManager,
00062             size_t              theBucketCount = eDefaultBucketCount,
00063             bucket_size_type    theBucketSize = eDefaultBucketSize);
00064 
00065     ~XalanDOMStringHashTable() { }
00066 
00070     void
00071     clear();
00072 
00078     size_t
00079     size() const
00080     {
00081         return m_count;
00082     }
00083 
00089     size_t
00090     bucketCount() const
00091     {
00092         return m_bucketCount;
00093     }
00094 
00100     void
00101     getBucketCounts(BucketCountsType&   theVector) const;
00102 
00109     size_t
00110     collisions() const
00111     {
00112         return m_collisions;
00113     }
00114 
00122     const XalanDOMString*
00123     find(
00124             const XalanDOMString&   theString,
00125             size_t*                 theBucketIndex = 0) const;
00126 
00139     const XalanDOMString*
00140     find(
00141             const XalanDOMChar*         theString,
00142             XalanDOMString::size_type   theLength = XalanDOMString::npos,
00143             size_t*                     theBucketIndex = 0) const;
00144 
00157     void
00158     insert(const XalanDOMString&    theString);
00159 
00175     void
00176     insert(
00177             const XalanDOMString&   theString,
00178             size_t                  theBucketIndex);
00179 
00180 #if defined(XALAN_NEEDS_EXPLICIT_TEMPLATE_INSTANTIATION)
00181     struct
00182     equalsXalanDOMString
00183     {
00184         equalsXalanDOMString(
00185                 const XalanDOMChar*         theString,
00186                 XalanDOMString::size_type   theLength) :
00187             m_string(theString),
00188             m_length(theLength)
00189         {
00190         }
00191 
00192         bool
00193         operator()(const XalanDOMString*    theString) const;
00194 
00195     private:
00196 
00197         const XalanDOMChar* const           m_string;
00198 
00199         const XalanDOMString::size_type     m_length;
00200     };
00201 #endif
00202 
00203     MemoryManagerType&
00204     getMemoryManager()
00205     {
00206         assert(m_buckets.getMemoryManager() != 0);
00207 
00208         return *m_buckets.getMemoryManager();
00209     }
00210 
00211     const MemoryManagerType&
00212     getMemoryManager() const
00213     {
00214         assert(m_buckets.getMemoryManager() != 0);
00215 
00216         return *m_buckets.getMemoryManager();
00217     }
00218 
00219 private:
00220 
00221     // Not implemented, for now...
00222     XalanDOMStringHashTable(const XalanDOMStringHashTable&);
00223 
00224     XalanDOMStringHashTable&
00225     operator=(const XalanDOMStringHashTable&);
00226 
00227     bool
00228     operator==(const XalanDOMStringHashTable&) const;
00229 
00230 
00231     // Data members...
00232     const size_t                    m_bucketCount;
00233 
00234     const bucket_size_type          m_bucketSize;
00235 
00236     XalanMemMgrAutoPtrArray<BucketType> m_buckets;
00237 
00238     size_t                          m_count;
00239 
00240     unsigned int                    m_collisions;       
00241 };
00242 
00243 
00244 
00245 XALAN_CPP_NAMESPACE_END
00246 
00247 
00248 
00249 #endif  // !defined(XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680)

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo