Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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 <vector>
00027 
00028 
00029 
00030 #include <xalanc/Include/XalanAutoPtr.hpp>
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 #if defined(XALAN_NO_STD_NAMESPACE)
00047     typedef vector<const XalanDOMString*>   BucketType;
00048     typedef BucketType::size_type           bucket_size_type;
00049     typedef vector<bucket_size_type>        BucketCountsType;
00050 #else
00051     typedef std::vector<const XalanDOMString*>  BucketType;
00052     typedef BucketType::size_type               bucket_size_type;
00053     typedef std::vector<bucket_size_type>       BucketCountsType;
00054 #endif
00055 
00056 
00057     enum { eDefaultBucketCount = 101, eDefaultBucketSize = 15 };
00058 
00059 
00066     explicit
00067     XalanDOMStringHashTable(
00068             size_t              theBucketCount = eDefaultBucketCount,
00069             bucket_size_type    theBucketSize = eDefaultBucketSize);
00070 
00071     ~XalanDOMStringHashTable() { }
00072 
00076     void
00077     clear();
00078 
00084     size_t
00085     size() const
00086     {
00087         return m_count;
00088     }
00089 
00095     size_t
00096     bucketCount() const
00097     {
00098         return m_bucketCount;
00099     }
00100 
00106     void
00107     getBucketCounts(BucketCountsType&   theVector) const;
00108 
00115     size_t
00116     collisions() const
00117     {
00118         return m_collisions;
00119     }
00120 
00128     const XalanDOMString*
00129     find(
00130             const XalanDOMString&   theString,
00131             size_t*                 theBucketIndex = 0) const;
00132 
00145     const XalanDOMString*
00146     find(
00147             const XalanDOMChar*         theString,
00148             XalanDOMString::size_type   theLength = XalanDOMString::npos,
00149             size_t*                     theBucketIndex = 0) const;
00150 
00163     void
00164     insert(const XalanDOMString&    theString);
00165 
00181     void
00182     insert(
00183             const XalanDOMString&   theString,
00184             size_t                  theBucketIndex);
00185 
00186 #if defined(XALAN_NEEDS_EXPLICIT_TEMPLATE_INSTANTIATION)
00187     struct
00188     equalsXalanDOMString
00189     {
00190         equalsXalanDOMString(
00191                 const XalanDOMChar*         theString,
00192                 XalanDOMString::size_type   theLength) :
00193             m_string(theString),
00194             m_length(theLength)
00195         {
00196         }
00197 
00198         bool
00199         operator()(const XalanDOMString*    theString) const;
00200 
00201     private:
00202 
00203         const XalanDOMChar* const           m_string;
00204 
00205         const XalanDOMString::size_type     m_length;
00206     };
00207 #endif
00208 
00209 private:
00210 
00211     // Not implemented, for now...
00212     XalanDOMStringHashTable(const XalanDOMStringHashTable&);
00213 
00214     XalanDOMStringHashTable&
00215     operator=(const XalanDOMStringHashTable&);
00216 
00217     bool
00218     operator==(const XalanDOMStringHashTable&) const;
00219 
00220 
00221     // Data members...
00222     const size_t                    m_bucketCount;
00223 
00224     const bucket_size_type          m_bucketSize;
00225 
00226     XalanArrayAutoPtr<BucketType>   m_buckets;
00227 
00228     size_t                          m_count;
00229 
00230     unsigned int                    m_collisions;       
00231 };
00232 
00233 
00234 
00235 XALAN_CPP_NAMESPACE_END
00236 
00237 
00238 
00239 #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.

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