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 // Class header file.
20 #include "XalanSourceTreeElementNANSAllocator.hpp"
21
22
23
24 namespace XALAN_CPP_NAMESPACE {
25
26
27
XalanSourceTreeElementNANSAllocator(MemoryManager & theManager,size_type theBlockCount)28 XalanSourceTreeElementNANSAllocator::XalanSourceTreeElementNANSAllocator(
29 MemoryManager& theManager,
30 size_type theBlockCount) :
31 m_allocator(theManager, theBlockCount)
32 {
33 }
34
35
36
~XalanSourceTreeElementNANSAllocator()37 XalanSourceTreeElementNANSAllocator::~XalanSourceTreeElementNANSAllocator()
38 {
39 }
40
41
42
43 XalanSourceTreeElementNANSAllocator::ObjectType*
create(const XalanDOMString & theTagName,const XalanDOMString & theLocalName,const XalanDOMString & theNamespaceURI,const XalanDOMString & thePrefix,XalanSourceTreeDocument * theOwnerDocument,XalanNode * theParentNode,XalanNode * thePreviousSibling,XalanNode * theNextSibling,IndexType theIndex)44 XalanSourceTreeElementNANSAllocator::create(
45 const XalanDOMString& theTagName,
46 const XalanDOMString& theLocalName,
47 const XalanDOMString& theNamespaceURI,
48 const XalanDOMString& thePrefix,
49 XalanSourceTreeDocument* theOwnerDocument,
50 XalanNode* theParentNode,
51 XalanNode* thePreviousSibling,
52 XalanNode* theNextSibling,
53 IndexType theIndex)
54 {
55 ObjectType* const theBlock = m_allocator.allocateBlock();
56 assert(theBlock != 0);
57
58 new(theBlock) ObjectType(
59 m_allocator.getMemoryManager(),
60 theTagName,
61 theLocalName,
62 theNamespaceURI,
63 thePrefix,
64 theOwnerDocument,
65 theParentNode,
66 thePreviousSibling,
67 theNextSibling,
68 theIndex);
69
70 m_allocator.commitAllocation(theBlock);
71
72 return theBlock;
73 }
74
75
76
77 void
reset()78 XalanSourceTreeElementNANSAllocator::reset()
79 {
80 m_allocator.reset();
81 }
82
83
84
85 }
86