Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


XalanDOMStringPool.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680)
19 #define XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
32 
33 
34 
35 XALAN_CPP_NAMESPACE_BEGIN
36 
37 
38 
40 {
41 public:
42 
43  enum { eDefaultBlockSize = 32,
46 
48 
50  typedef size_t bucket_count_type;
52 
53  /**
54  * Create a string pool.
55  *
56  * @param theBlockSize The block size for the allocator.
57  * @param theBucketCount The number of buckets to use for the hash table. This should be a prime number for best results.
58  * @param theBucketSize The initial size of each bucket in the hash table.
59  */
60  explicit
62  MemoryManager& theManager,
63  block_size_type theBlockSize = eDefaultBlockSize,
64  bucket_count_type theBucketCount = eDefaultBucketCount,
65  bucket_size_type theBucketSize = eDefaultBucketSize);
66 
67  static XalanDOMStringPool*
68  create(
69  MemoryManager& theManager,
70  block_size_type theBlockSize = eDefaultBlockSize,
71  bucket_count_type theBucketCount = eDefaultBucketCount,
72  bucket_size_type theBucketSize = eDefaultBucketSize);
73 
74 
75  virtual
77 
78  /**
79  * Clear the pool.
80  *
81  */
82  virtual void
83  clear();
84 
85  /**
86  * Get the number of strings in the pool
87  *
88  * @return the size of the pool.
89  */
90  virtual size_t
91  size() const;
92 
93  /**
94  * Get a pooled string. If the string is not pooled, it is added.
95  *
96  * @param theString The string to pool.
97  * @return a const reference to the pooled string.
98  */
99  virtual const XalanDOMString&
100  get(const XalanDOMString& theString);
101 
102  /**
103  * Get a pooled string. If the string is not pooled, it is added.
104  *
105  * @param theString The string to pool.
106  * @param theLength The length of the string. If XalanDOMString::npos, the string is assumed to be null-terminated.
107  * @return a const reference to the pooled string.
108  */
109  virtual const XalanDOMString&
110  get(
111  const XalanDOMChar* theString,
113 
114  /**
115  * Get a reference to the pool's hash table. Useful for diagnostic
116  * purposes.
117  *
118  * @return a const reference to the hash table.
119  */
121  getHashTable() const
122  {
123  return m_hashTable;
124  }
125 
126  MemoryManager&
128  {
129  return m_hashTable.getMemoryManager();
130  }
131 
132  const MemoryManager&
134  {
135  return m_hashTable.getMemoryManager();
136  }
137 
138 private:
139 
140  // Not implemented, for now...
142 
144  operator=(const XalanDOMStringPool&);
145 
146  bool
147  operator==(const XalanDOMStringPool&) const;
148 
149  // Data members...
150  AllocatorType m_stringAllocator;
151 
152  size_t m_stringCount;
153 
154  XalanDOMStringHashTable m_hashTable;
155 
156  static const XalanDOMString s_emptyString;
157 };
158 
159 
160 
161 XALAN_CPP_NAMESPACE_END
162 
163 
164 
165 #endif // !defined(XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680)
BucketType::size_type bucket_size_type
AllocatorType::size_type block_size_type
void clear(XalanDOMString &theString)
Remove all elements from target string.
XalanSize_t size_type
const MemoryManager & getMemoryManager() const
ArenaAllocatorType::size_type size_type
bool operator==(const ElemAttributeSet &theLHS, const ElemAttributeSet &theRHS)
#define XALAN_PLATFORMSUPPORT_EXPORT
MemoryManager & getMemoryManager()
XalanDOMStringAllocator AllocatorType
XalanDOMStringHashTable::bucket_size_type bucket_size_type
const XalanDOMStringHashTable & getHashTable() const
Get a reference to the pool's hash table.

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.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo