Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XalanDOMStringReusableAllocator.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #if !defined(XALANDOMSTRINGREUSABLEALLOCATOR_INCLUDE_GUARD_12455133)
00018 #define XALANDOMSTRINGREUSABLEALLOCATOR_INCLUDE_GUARD_12455133
00019 
00020 
00021 
00022 // Base include file.  Must be first.
00023 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
00024 
00025 
00026 
00027 #include <xalanc/PlatformSupport/ReusableArenaAllocator.hpp>
00028 
00029 
00030 
00031 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00032 
00033 
00034 
00035 XALAN_CPP_NAMESPACE_BEGIN
00036 
00037 
00038 
00039 class XALAN_PLATFORMSUPPORT_EXPORT XalanDOMStringReusableAllocator
00040 {
00041 public:
00042 
00043     typedef XalanDOMString                  data_type;
00044     typedef data_type::size_type            data_type_size_type;
00045 
00046 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
00047     typedef ReusableArenaBlock<data_type>   ArenaBlockType;
00048 
00049     typedef ReusableArenaBlock<data_type,
00050                            ArenaBlockType>  ArenaAllocatorType;
00051 #else
00052     typedef ReusableArenaAllocator<data_type>   ArenaAllocatorType;
00053 #endif
00054 
00055     typedef ArenaAllocatorType::size_type   size_type;
00056 
00057     enum { eDefaultBlockSize = 32 };
00058 
00059 
00065     XalanDOMStringReusableAllocator(MemoryManagerType&      theManager, size_type   theBlockCount);
00066 
00067     ~XalanDOMStringReusableAllocator();
00068 
00074     data_type&
00075     create();
00076 
00085     data_type&
00086     create(
00087             const char*             theString,
00088 #if defined(_MSC_VER) && (_MSC_VER <= 1300)
00089             // $$$ ToDo: Some strange bug in MSVC++ complains when using data_type::npos here.
00090             data_type_size_type     theCount = data_type_size_type(-1));
00091 #else
00092             data_type_size_type     theCount = data_type_size_type(data_type::npos));
00093 #endif
00094 
00104     data_type&
00105     create(
00106             const data_type&        theSource,
00107             data_type_size_type     theStartPosition = 0,
00108             data_type_size_type     theCount = data_type_size_type(data_type::npos));
00109 
00118     data_type&
00119     create(
00120             const XalanDOMChar*     theString,
00121             data_type_size_type     theCount = data_type_size_type(data_type::npos));
00122 
00131     data_type&
00132     create(
00133             data_type_size_type     theCount,
00134             XalanDOMChar            theChar);
00135 
00136     /*
00137      * Destroy a XalanDOMString object.
00138      *
00139      */
00140     bool
00141     destroy(XalanDOMString&     theDOMString)
00142     {
00143         return m_allocator.destroyObject(&theDOMString);
00144     }
00145 
00149     bool
00150     ownsObject(const data_type*     theObject)
00151     {
00152         return m_allocator.ownsObject(theObject);
00153     }
00154     
00158     void
00159     reset()
00160     {
00161         m_allocator.reset();
00162     }
00163 
00169     size_type
00170     getBlockCount() const
00171     {
00172         return m_allocator.getBlockCount();
00173     }
00174 
00181     size_type
00182     getBlockSize() const
00183     {
00184         return m_allocator.getBlockSize();
00185     }
00186 
00193     MemoryManagerType&
00194     getMemoryManager()
00195     {
00196         return m_allocator.getMemoryManager();
00197     }
00198 
00205     const MemoryManagerType&
00206     getMemoryManager() const
00207     {
00208         return m_allocator.getMemoryManager();
00209     }
00210 
00211 private:
00212 
00213     // Not implemented...
00214     XalanDOMStringReusableAllocator(const XalanDOMStringReusableAllocator&);
00215 
00216     XalanDOMStringReusableAllocator&
00217     operator=(const XalanDOMStringReusableAllocator&);
00218 
00219     // Data members...
00220     ArenaAllocatorType  m_allocator;
00221 };
00222 
00223 
00224 
00225 XALAN_CPP_NAMESPACE_END
00226 
00227 
00228 
00229 #endif  // XALANDOMSTRINGREUSABLEALLOCATOR_INCLUDE_GUARD_12455133

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo