00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680) 00019 #define XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/XPath/XPathDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/Include/XalanVector.hpp> 00029 00030 00031 00032 // Base class header file... 00033 #include <xalanc/XPath/XObjectFactory.hpp> 00034 00035 00036 00037 #include <xalanc/XPath/XBoolean.hpp> 00038 #include <xalanc/XPath/XNodeSetAllocator.hpp> 00039 #include <xalanc/XPath/XNodeSetNodeProxyAllocator.hpp> 00040 #include <xalanc/XPath/XNumberAllocator.hpp> 00041 #include <xalanc/XPath/XStringAllocator.hpp> 00042 #include <xalanc/XPath/XStringAdapterAllocator.hpp> 00043 #include <xalanc/XPath/XStringCachedAllocator.hpp> 00044 #include <xalanc/XPath/XStringReferenceAllocator.hpp> 00045 #include <xalanc/XPath/XTokenNumberAdapterAllocator.hpp> 00046 #include <xalanc/XPath/XTokenStringAdapterAllocator.hpp> 00047 00048 00049 00050 00051 XALAN_CPP_NAMESPACE_BEGIN 00052 00053 00054 00055 /** 00056 * This class handles the creation of XObjects and manages their lifetime. 00057 */ 00058 class XALAN_XPATH_EXPORT XObjectFactoryDefault : public XObjectFactory 00059 { 00060 public: 00061 00062 // Default block size for strings. 00063 enum 00064 { 00065 eDefaultXStringBlockSize = 10, 00066 eDefaultXNumberBlockSize = 10, 00067 eDefaultXNodeSetBlockSize = 10, 00068 eDefaultXNodeSetNodeProxyBlockSize = 5, 00069 eXNumberCacheMax = 40, 00070 eXNodeSetCacheMax = 40, 00071 eXStringCacheMax = 40, 00072 eXResultTreeFragCacheMax = 40 00073 }; 00074 00075 typedef XNodeSetAllocator::size_type size_type; 00076 00077 /** 00078 * Construct a factory for creating XObjects. 00079 * 00080 * @param theXStringBlockSize allocation block size 00081 * @param theXNumberBlockSize allocation block size 00082 * @param theXNodeSetBlockSize allocation block size 00083 */ 00084 explicit 00085 XObjectFactoryDefault( 00086 MemoryManager& theManager XALAN_DEFAULT_MEMMGR, 00087 size_type theXStringBlockSize = eDefaultXStringBlockSize, 00088 size_type theXNumberBlockSize = eDefaultXNumberBlockSize, 00089 size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize, 00090 size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize); 00091 00092 static XObjectFactoryDefault* 00093 create( 00094 MemoryManager& theManager, 00095 size_type theXStringBlockSize = eDefaultXStringBlockSize, 00096 size_type theXNumberBlockSize = eDefaultXNumberBlockSize, 00097 size_type theXNodeSetBlockSize = eDefaultXNodeSetBlockSize, 00098 size_type theXNodeSetNodeProxyBlockSize = eDefaultXNodeSetNodeProxyBlockSize); 00099 00100 00101 virtual 00102 ~XObjectFactoryDefault(); 00103 00104 MemoryManager& 00105 getMemoryManager() 00106 { 00107 return m_xobjects.getMemoryManager(); 00108 } 00109 // These methods are inherited from XObjectFactory ... 00110 00111 virtual void 00112 reset(); 00113 00114 virtual const XObjectPtr 00115 createBoolean(bool theValue); 00116 00117 virtual const XObjectPtr 00118 createNodeSet(BorrowReturnMutableNodeRefList& theValue); 00119 00120 virtual const XObjectPtr 00121 createNodeSet(XalanNode* theValue); 00122 00123 virtual const XObjectPtr 00124 createNumber(double theValue); 00125 00126 virtual const XObjectPtr 00127 createNumber(const XToken& theValue); 00128 00129 virtual const XObjectPtr 00130 createString(const XalanDOMString& theValue); 00131 00132 virtual const XObjectPtr 00133 createString(const XalanDOMChar* theValue); 00134 00135 virtual const XObjectPtr 00136 createString( 00137 const XalanDOMChar* theValue, 00138 XalanSize_t theLength); 00139 00140 virtual const XObjectPtr 00141 createString(const XToken& theValue); 00142 00143 virtual const XObjectPtr 00144 createStringReference(const XalanDOMString& theValue); 00145 00146 virtual const XObjectPtr 00147 createStringAdapter( 00148 const XObjectPtr& theValue, 00149 XPathExecutionContext& theExecutionContext); 00150 00151 virtual const XObjectPtr 00152 createString(GetCachedString& theValue); 00153 00154 virtual const XObjectPtr 00155 createUnknown(const XalanDOMString& theValue); 00156 00157 virtual void 00158 holdReference(XObjectPtr theValue); 00159 00160 typedef XalanVector<XObject*> XObjectCollectionType; 00161 typedef XalanVector<XNumber*> XNumberCacheType; 00162 typedef XalanVector<XNodeSet*> XNodeSetCacheType; 00163 typedef XalanVector<XString*> XStringCacheType; 00164 00165 protected: 00166 00167 virtual bool 00168 doReturnObject( 00169 XObject* theXObject, 00170 bool fInReset = false); 00171 00172 private: 00173 00174 // Not implemented... 00175 XObjectFactoryDefault(const XObjectFactoryDefault&); 00176 00177 XObjectFactoryDefault& 00178 operator=(const XObjectFactoryDefault&); 00179 00180 bool 00181 operator==(const XObjectFactoryDefault&) const; 00182 00183 00184 // Data members... 00185 00186 // This one's first, since it may be be holding references 00187 // to objects in other allocators. 00188 XStringAdapterAllocator m_xstringAdapterAllocator; 00189 00190 XStringAllocator m_xstringAllocator; 00191 00192 XStringCachedAllocator m_xstringCachedAllocator; 00193 00194 XStringReferenceAllocator m_xstringReferenceAllocator; 00195 00196 XNumberAllocator m_xnumberAllocator; 00197 00198 XNodeSetAllocator m_xnodesetAllocator; 00199 00200 XNodeSetNodeProxyAllocator m_xnodesetNodeProxyAllocator; 00201 00202 XTokenNumberAdapterAllocator m_xtokenNumberAdapterAllocator; 00203 00204 XTokenStringAdapterAllocator m_xtokenStringAdapterAllocator; 00205 00206 XObjectCollectionType m_xobjects; 00207 00208 XNumberCacheType m_xnumberCache; 00209 00210 XNodeSetCacheType m_xnodesetCache; 00211 00212 XStringCacheType m_xstringCache; 00213 00214 XBoolean m_xbooleanFalse; 00215 00216 XBoolean m_xbooleanTrue; 00217 00218 XalanVector<XObjectPtr> m_references; 00219 }; 00220 00221 00222 00223 XALAN_CPP_NAMESPACE_END 00224 00225 00226 00227 #endif // XOBJECTFACTORYDEFAULT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|