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 
37 namespace XALAN_CPP_NAMESPACE {
38 
39 
40 
42 {
43 public:
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  */
74  XalanSourceTreeDocumentAllocator(MemoryManager& theManager, size_type theBlockCount);
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  */
91  data_type*
92  create(
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*
116  create(
117  size_type theAttributeBlockSize,
118  size_type theAttributeNSBlockSize,
119  size_type theCommentBlockSize,
120  size_type theElementBlockSize,
121  size_type theElementNSBlockSize,
122  size_type thePIBlockSize,
123  size_type theTextBlockSize,
124  size_type theTextIWSBlockSize,
125  bool fPoolAllText = true);
126 
127  /**
128  * Delete a XalanSourceTreeDocument object from allocator.
129  */
130  bool
131  destroy(data_type* theObject);
132 
133  /**
134  * Determine if an object is owned by the allocator...
135  */
136  bool
137  ownsObject(const data_type* theObject)
138  {
139  return m_allocator.ownsObject(theObject);
140  }
141 
142  /**
143  * Delete all XalanSourceTreeDocument objects from allocator.
144  */
145  void
146  reset();
147 
148  /**
149  * Get the number of ArenaBlocks currently allocated.
150  *
151  * @return The number of blocks.
152  */
153  size_type
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  */
165  size_type
166  getBlockSize() const
167  {
168  return m_allocator.getBlockSize();
169  }
170 
171 private:
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
ReusableArenaAllocator.hpp
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanSourceTreeDocumentAllocator::size_type
ArenaAllocatorType::size_type size_type
Definition: XalanSourceTreeDocumentAllocator.hpp:48
xalanc::XalanSourceTreeDocument::block_size_type
XalanDOMStringPool::block_size_type block_size_type
Definition: XalanSourceTreeDocument.hpp:123
xalanc::ReusableArenaAllocator< data_type >::size_type
ReusableArenaBlockType::size_type size_type
Definition: ReusableArenaAllocator.hpp:45
XalanSourceTreeDocument.hpp
xalanc::ReusableArenaAllocator< data_type >
XALAN_XSLT_EXPORT
#define XALAN_XSLT_EXPORT
Definition: XSLTDefinitions.hpp:27
xalanc::XalanSourceTreeDocumentAllocator::getBlockCount
size_type getBlockCount() const
Get the number of ArenaBlocks currently allocated.
Definition: XalanSourceTreeDocumentAllocator.hpp:154
xalanc::size_type
size_t size_type
Definition: XalanMap.hpp:46
xalanc::XalanSourceTreeDocumentAllocator
Definition: XalanSourceTreeDocumentAllocator.hpp:41
xalanc::XalanSourceTreeDocumentAllocator::block_size_type
XalanSourceTreeDocument::block_size_type block_size_type
Definition: XalanSourceTreeDocumentAllocator.hpp:65
xalanc::XalanSourceTreeDocumentAllocator::data_type
XalanSourceTreeDocument data_type
Definition: XalanSourceTreeDocumentAllocator.hpp:45
xalanc::XalanSourceTreeDocumentAllocator::bucket_size_type
XalanSourceTreeDocument::bucket_size_type bucket_size_type
Definition: XalanSourceTreeDocumentAllocator.hpp:67
xalanc::XalanSourceTreeDocument::bucket_count_type
XalanDOMStringPool::bucket_count_type bucket_count_type
Definition: XalanSourceTreeDocument.hpp:124
xalanc::XalanSourceTreeDocumentAllocator::ownsObject
bool ownsObject(const data_type *theObject)
Determine if an object is owned by the allocator...
Definition: XalanSourceTreeDocumentAllocator.hpp:137
xalanc::XalanSourceTreeDocumentAllocator::ArenaAllocatorType
ReusableArenaAllocator< data_type > ArenaAllocatorType
Definition: XalanSourceTreeDocumentAllocator.hpp:47
XSLTDefinitions.hpp
xalanc::XalanSourceTreeDocumentAllocator::getBlockSize
size_type getBlockSize() const
Get size of an ArenaBlock, that is, the number of objects in each block.
Definition: XalanSourceTreeDocumentAllocator.hpp:166
xalanc::XalanSourceTreeDocument::bucket_size_type
XalanDOMStringPool::bucket_size_type bucket_size_type
Definition: XalanSourceTreeDocument.hpp:125
xalanc::XalanSourceTreeDocumentAllocator::bucket_count_type
XalanSourceTreeDocument::bucket_count_type bucket_count_type
Definition: XalanSourceTreeDocumentAllocator.hpp:66
xalanc::XalanSourceTreeDocument
Definition: XalanSourceTreeDocument.hpp:78