Xalan-C++ API Reference 1.12.0
XalanSourceTreeDocumentAllocator.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
19#if !defined(XALANSOURCETREEDOCUMENTALLOCATOR_INCLUDE_GUARD_12455133)
20#define XALANSOURCETREEDOCUMENTALLOCATOR_INCLUDE_GUARD_12455133
21
22
23
24// Base include file. Must be first.
26
27
28
30
31
32
34
35
36
37namespace XALAN_CPP_NAMESPACE {
38
39
40
42{
43public:
44
46
49
50 enum { eDefaultAttributeAllocatorBlockSize = XalanSourceTreeDocument::eDefaultAttributeAllocatorBlockSize,
51 eDefaultAttributeNSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultAttributeNSAllocatorBlockSize,
52 eDefaultCommentAllocatorBlockSize = XalanSourceTreeDocument::eDefaultCommentAllocatorBlockSize,
53 eDefaultElementAllocatorBlockSize = XalanSourceTreeDocument::eDefaultElementAllocatorBlockSize,
54 eDefaultElementNSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultElementNSAllocatorBlockSize,
55 eDefaultPIAllocatorBlockSize = XalanSourceTreeDocument::eDefaultPIAllocatorBlockSize,
56 eDefaultTextAllocatorBlockSize = XalanSourceTreeDocument::eDefaultTextAllocatorBlockSize,
57 eDefaultTextIWSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultTextIWSAllocatorBlockSize,
58 eDefaultNamesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBlockSize,
59 eDefaultNamesStringPoolBucketCount = XalanSourceTreeDocument::eDefaultNamesStringPoolBucketCount,
60 eDefaultNamesStringPoolBucketSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBucketSize,
61 eDefaultValuesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultValuesStringPoolBlockSize,
62 eDefaultValuesStringPoolBucketCount = XalanSourceTreeDocument::eDefaultValuesStringPoolBucketCount,
63 eDefaultValuesStringPoolBucketSize = XalanSourceTreeDocument::eDefaultValuesStringPoolBucketSize };
64
68
69 /**
70 * Construct an instance that will allocate blocks of the specified size.
71 *
72 * @param theBlockSize The block size.
73 */
75
77
78 /**
79 * Create a XalanSourceTreeDocument object.
80 *
81 * @param fPoolAllText If false, text node data that is not whitespace will not be pooled.
82 * @param theNamesStringPoolBlockSize The block size for allocating strings in the name pool
83 * @param theNamesStringPoolBucketCount The number of buckets for allocating strings in the name pool
84 * @param theNamesStringPoolBucketSize The bucket size for allocating strings in the name pool
85 * @param theValuesStringPoolBlockSize The block size for allocating strings in the values pool
86 * @param theValuesStringPoolBucketCount The number of buckets for allocating strings in the values pool
87 * @param theValuesStringPoolBucketSize The bucket size for allocating strings in the values pool
88 *
89 * @return pointer to a node
90 */
93 bool fPoolAllText = true,
94 block_size_type theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize,
95 bucket_count_type theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount,
96 bucket_size_type theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize,
97 block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize,
98 bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount,
99 bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize);
100
101 /**
102 * Create a XalanSourceTreeDocument object.
103 *
104 * @param fPoolAllText If false, text node data that is not whitespace will not be pooled.
105 * @param theAttributeBlockSize The block size for allocating attribute nodes
106 * @param theAttributeNSBlockSize The block size for allocating attribute NS nodes
107 * @param theCommentBlockSize The block size for allocating comment nodes
108 * @param theElementBlockSize The block size for allocating element nodes
109 * @param theElementNSBlockSize The block size for allocating element nodes
110 * @param theTextBlockSize The block size for allocating text nodes,
111 * @param theTextIWSBlockSize The block size for allocating text IWS nodes,
112 *
113 * @return pointer to a node
114 */
115 data_type*
125 bool fPoolAllText = true);
126
127 /**
128 * Delete a XalanSourceTreeDocument object from allocator.
129 */
130 bool
132
133 /**
134 * Determine if an object is owned by the allocator...
135 */
136 bool
138 {
139 return m_allocator.ownsObject(theObject);
140 }
141
142 /**
143 * Delete all XalanSourceTreeDocument objects from allocator.
144 */
145 void
147
148 /**
149 * Get the number of ArenaBlocks currently allocated.
150 *
151 * @return The number of blocks.
152 */
155 {
156 return m_allocator.getBlockCount();
157 }
158
159 /**
160 * Get size of an ArenaBlock, that is, the number
161 * of objects in each block.
162 *
163 * @return The size of the block
164 */
167 {
168 return m_allocator.getBlockSize();
169 }
170
171private:
172
173 // Not implemented...
175
177 operator=(const XalanSourceTreeDocumentAllocator&);
178
179 // Data members...
180 ArenaAllocatorType m_allocator;
181};
182
183
184
185}
186
187
188
189#endif // XALANSOURCETREEDOCUMENTALLOCATOR_INCLUDE_GUARD_12455133
#define XALAN_XSLT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
XalanSourceTreeDocument::bucket_count_type bucket_count_type
size_type getBlockSize() const
Get size of an ArenaBlock, that is, the number of objects in each block.
void reset()
Delete all XalanSourceTreeDocument objects from allocator.
XalanSourceTreeDocument::bucket_size_type bucket_size_type
bool destroy(data_type *theObject)
Delete a XalanSourceTreeDocument object from allocator.
data_type * create(bool fPoolAllText=true, block_size_type theNamesStringPoolBlockSize=eDefaultNamesStringPoolBlockSize, bucket_count_type theNamesStringPoolBucketCount=eDefaultNamesStringPoolBucketCount, bucket_size_type theNamesStringPoolBucketSize=eDefaultNamesStringPoolBucketSize, block_size_type theValuesStringPoolBlockSize=eDefaultValuesStringPoolBlockSize, bucket_count_type theValuesStringPoolBucketCount=eDefaultValuesStringPoolBucketCount, bucket_size_type theValuesStringPoolBucketSize=eDefaultValuesStringPoolBucketSize)
Create a XalanSourceTreeDocument object.
XalanSourceTreeDocumentAllocator(MemoryManager &theManager, size_type theBlockCount)
Construct an instance that will allocate blocks of the specified size.
data_type * create(size_type theAttributeBlockSize, size_type theAttributeNSBlockSize, size_type theCommentBlockSize, size_type theElementBlockSize, size_type theElementNSBlockSize, size_type thePIBlockSize, size_type theTextBlockSize, size_type theTextIWSBlockSize, bool fPoolAllText=true)
Create a XalanSourceTreeDocument object.
size_type getBlockCount() const
Get the number of ArenaBlocks currently allocated.
XalanSourceTreeDocument::block_size_type block_size_type
bool ownsObject(const data_type *theObject)
Determine if an object is owned by the allocator...
XalanDOMStringPool::block_size_type block_size_type
size_t size_type
Definition XalanMap.hpp:46