Xalan-C++ API Reference  1.12.0
XObjectFactoryDefault.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(XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680)
19 #define XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
29 
30 
31 
32 // Base class header file...
34 
35 
36 
47 
48 
49 
50 
51 namespace XALAN_CPP_NAMESPACE {
52 
53 
54 
55 /**
56  * This class handles the creation of XObjects and manages their lifetime.
57  */
59 {
60 public:
61 
62  // Default block size for strings.
63  enum
64  {
65  eDefaultXStringBlockSize = 10,
66  eDefaultXNumberBlockSize = 10,
67  eDefaultXNodeSetBlockSize = 10,
68  eDefaultXNodeSetNodeProxyBlockSize = 5,
69  eXNumberCacheMax = 40,
70  eXNodeSetCacheMax = 40,
71  eXStringCacheMax = 40,
72  eXResultTreeFragCacheMax = 40
73  };
74 
76 
77  /**
78  * Construct a factory for creating XObjects.
79  *
80  * @param theXStringBlockSize allocation block size
81  * @param theXNumberBlockSize allocation block size
82  * @param theXNodeSetBlockSize allocation block size
83  */
84  explicit
86  MemoryManager& theManager XALAN_DEFAULT_MEMMGR,
87  size_type theXStringBlockSize = eDefaultXStringBlockSize,
88  size_type theXNumberBlockSize = eDefaultXNumberBlockSize,
89  size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize,
90  size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize);
91 
92  static XObjectFactoryDefault*
93  create(
94  MemoryManager& theManager,
95  size_type theXStringBlockSize = eDefaultXStringBlockSize,
96  size_type theXNumberBlockSize = eDefaultXNumberBlockSize,
97  size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize,
98  size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize);
99 
100 
101  virtual
103 
104  MemoryManager&
106  {
107  return m_xobjects.getMemoryManager();
108  }
109  // These methods are inherited from XObjectFactory ...
110 
111  virtual void
112  reset();
113 
114  virtual const XObjectPtr
115  createBoolean(bool theValue);
116 
117  virtual const XObjectPtr
118  createNodeSet(BorrowReturnMutableNodeRefList& theValue);
119 
120  virtual const XObjectPtr
121  createNodeSet(XalanNode* theValue);
122 
123  virtual const XObjectPtr
124  createNumber(double theValue);
125 
126  virtual const XObjectPtr
127  createNumber(const XToken& theValue);
128 
129  virtual const XObjectPtr
130  createString(const XalanDOMString& theValue);
131 
132  virtual const XObjectPtr
133  createString(const XalanDOMChar* theValue);
134 
135  virtual const XObjectPtr
136  createString(
137  const XalanDOMChar* theValue,
138  XalanSize_t theLength);
139 
140  virtual const XObjectPtr
141  createString(const XToken& theValue);
142 
143  virtual const XObjectPtr
144  createStringReference(const XalanDOMString& theValue);
145 
146  virtual const XObjectPtr
147  createStringAdapter(
148  const XObjectPtr& theValue,
149  XPathExecutionContext& theExecutionContext);
150 
151  virtual const XObjectPtr
152  createString(GetCachedString& theValue);
153 
154  virtual const XObjectPtr
155  createUnknown(const XalanDOMString& theValue);
156 
157  virtual void
158  holdReference(XObjectPtr theValue);
159 
164 
165 protected:
166 
167  virtual bool
168  doReturnObject(
169  XObject* theXObject,
170  bool fInReset = false);
171 
172 private:
173 
174  // Not implemented...
176 
178  operator=(const XObjectFactoryDefault&);
179 
180  bool
181  operator==(const XObjectFactoryDefault&) const;
182 
183 
184  // Data members...
185 
186  // This one's first, since it may be be holding references
187  // to objects in other allocators.
188  XStringAdapterAllocator m_xstringAdapterAllocator;
189 
190  XStringAllocator m_xstringAllocator;
191 
192  XStringCachedAllocator m_xstringCachedAllocator;
193 
194  XStringReferenceAllocator m_xstringReferenceAllocator;
195 
196  XNumberAllocator m_xnumberAllocator;
197 
198  XNodeSetAllocator m_xnodesetAllocator;
199 
200  XNodeSetNodeProxyAllocator m_xnodesetNodeProxyAllocator;
201 
202  XTokenNumberAdapterAllocator m_xtokenNumberAdapterAllocator;
203 
204  XTokenStringAdapterAllocator m_xtokenStringAdapterAllocator;
205 
206  XObjectCollectionType m_xobjects;
207 
208  XNumberCacheType m_xnumberCache;
209 
210  XNodeSetCacheType m_xnodesetCache;
211 
212  XStringCacheType m_xstringCache;
213 
214  XBoolean m_xbooleanFalse;
215 
216  XBoolean m_xbooleanTrue;
217 
218  XalanVector<XObjectPtr> m_references;
219 };
220 
221 
222 
223 }
224 
225 
226 
227 #endif // XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
xalanc::XObjectFactoryDefault::XStringCacheType
XalanVector< XString * > XStringCacheType
Definition: XObjectFactoryDefault.hpp:163
xalanc::XNumberAllocator
Definition: XNumberAllocator.hpp:41
XTokenNumberAdapterAllocator.hpp
xalanc::XNodeSetAllocator::size_type
ArenaAllocatorType::size_type size_type
Definition: XNodeSetAllocator.hpp:50
xalanc::XStringCachedAllocator
Definition: XStringCachedAllocator.hpp:41
xalanc::XTokenStringAdapterAllocator
Definition: XTokenStringAdapterAllocator.hpp:41
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XObjectFactoryDefault::size_type
XNodeSetAllocator::size_type size_type
Definition: XObjectFactoryDefault.hpp:75
xalanc::XTokenNumberAdapterAllocator
Definition: XTokenNumberAdapterAllocator.hpp:41
xalanc::XalanNode
Definition: XalanNode.hpp:38
xalanc::XalanVector< XObject * >
XStringReferenceAllocator.hpp
xalanc::XObjectFactoryDefault::XNumberCacheType
XalanVector< XNumber * > XNumberCacheType
Definition: XObjectFactoryDefault.hpp:161
xalanc::XObjectFactoryDefault
This class handles the creation of XObjects and manages their lifetime.
Definition: XObjectFactoryDefault.hpp:58
XALAN_DEFAULT_MEMMGR
#define XALAN_DEFAULT_MEMMGR
Definition: XalanMemoryManagement.hpp:516
XalanVector.hpp
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::XObjectFactoryDefault::XObjectCollectionType
XalanVector< XObject * > XObjectCollectionType
Definition: XObjectFactoryDefault.hpp:160
XALAN_XPATH_EXPORT
#define XALAN_XPATH_EXPORT
Definition: XPathDefinitions.hpp:35
xalanc::XObjectPtr
Class to hold XObjectPtr return types.
Definition: XObject.hpp:883
xalanc::XStringReferenceAllocator
Definition: XStringReferenceAllocator.hpp:41
xalanc::XToken
Definition: XToken.hpp:41
xalanc::XNodeSetNodeProxyAllocator
Definition: XNodeSetNodeProxyAllocator.hpp:41
XNodeSetAllocator.hpp
XStringAllocator.hpp
xalanc::XObject
Class to hold XPath return types.
Definition: XObject.hpp:63
XStringAdapterAllocator.hpp
XBoolean.hpp
XStringCachedAllocator.hpp
XNumberAllocator.hpp
XTokenStringAdapterAllocator.hpp
xalanc::XObjectFactoryDefault::getMemoryManager
MemoryManager & getMemoryManager()
Definition: XObjectFactoryDefault.hpp:105
XObjectFactory.hpp
XNodeSetNodeProxyAllocator.hpp
xalanc::XNodeSetAllocator
Definition: XNodeSetAllocator.hpp:41
xalanc::XStringAdapterAllocator
Definition: XStringAdapterAllocator.hpp:41
xalanc::XPathExecutionContext
Definition: XPathExecutionContext.hpp:82
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::XBoolean
Definition: XBoolean.hpp:37
xalanc::XObjectFactory
This class handles the creation of XObjects and manages their lifetime.
Definition: XObjectFactory.hpp:53
xalanc::XStringAllocator
Definition: XStringAllocator.hpp:41
xalanc::XObjectFactoryDefault::XNodeSetCacheType
XalanVector< XNodeSet * > XNodeSetCacheType
Definition: XObjectFactoryDefault.hpp:162
XPathDefinitions.hpp