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  

XalanDiagnosticMemoryManager.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2005 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 #if !defined(XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680)
00017 #define XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 #include "xalanc/Harness/XalanHarnessDefinitions.hpp"
00022 
00023 
00024 
00025 #include <cstddef>
00026 
00027 
00028 
00029 #if defined(XALAN_CLASSIC_IOSTREAMS)
00030 #include <iostream.h>
00031 #else
00032 #include <iosfwd>
00033 #include <ios>
00034 #endif
00035 
00036 
00037 
00038 #include "xercesc/framework/MemoryManager.hpp"
00039 
00040 
00041 
00042 #include "xalanc/Include/XalanMap.hpp"
00043 
00044 
00045 
00046 XALAN_CPP_NAMESPACE_BEGIN
00047 
00048 
00049 
00050 XALAN_USING_XERCES(MemoryManager)
00051 
00052 
00053 
00054 class XALAN_HARNESS_EXPORT XalanDiagnosticMemoryManager : public MemoryManager
00055 {
00056 public:
00057 
00058     typedef unsigned int int_type;
00059 
00060 #if defined(XALAN_NO_STD_NAMESPACE)
00061     typedef ostream             StreamType;
00062 #else
00063     typedef std::ostream        StreamType;
00064 #endif
00065 
00066 #if defined(XALAN_STRICT_ANSI_HEADERS)
00067     typedef std::size_t     size_type;
00068 #else
00069     typedef size_t          size_type;
00070 #endif
00071 
00072     class LockException
00073     {
00074     public:
00075 
00076         LockException()
00077         {
00078         }
00079 
00080         ~LockException()
00081         {
00082         }
00083     };
00084 
00085     XalanDiagnosticMemoryManager(
00086                 MemoryManager&  theMemoryManager,
00087                 bool            fAssertErrors = false,
00088                 StreamType*     theStream = 0);
00089 
00090     virtual
00091     ~XalanDiagnosticMemoryManager();
00092 
00093     virtual void*
00094     allocate(size_type  size);
00095 
00096     virtual void
00097     deallocate(void*    pointer);
00098 
00099     bool
00100     getAssertErrors() const
00101     {
00102         return m_assertErrors;
00103     }
00104 
00105     void
00106     setAssertErrors(bool    fFlag)
00107     {
00108         m_assertErrors = fFlag;
00109     }
00110 
00111     // Get the high-water mark (the highest amount
00112     // that was allocated at any particular point).
00113     size_type
00114     getHighWaterMark() const
00115     {
00116         return m_highWaterMark;
00117     }
00118 
00119     // Get the number of bytes currently allocated.
00120     size_type
00121     getAllocated() const
00122     {
00123         return m_currentAllocated;
00124     }
00125 
00126     // Get the current number of outstanding allocations.
00127     size_type
00128     getAllocations() const
00129     {
00130         return m_allocations.size();
00131     }
00132 
00133     struct Data
00134     {
00135         Data() :
00136             m_size(0),
00137             m_sequence(0)
00138         {
00139         }
00140 
00141         Data(
00142                 size_type   theSize,
00143                 size_type   theSequence) :
00144             m_size(theSize),
00145             m_sequence(theSequence)
00146         {
00147         }
00148 
00149         size_type   m_size;
00150 
00151         size_type   m_sequence;
00152     };
00153 
00154     typedef XalanMap<void*, Data>   MapType;
00155 
00156     typedef MapType::const_iterator     const_iterator;
00157 
00158     const_iterator
00159     getAllocationsIterator() const
00160     {
00161         return m_allocations.begin();
00162     }
00163 
00164     void
00165     lock()
00166     {
00167         m_locked = true;
00168     }
00169 
00170     void
00171     unlock()
00172     {
00173         m_locked = false;
00174     }
00175 
00176     enum
00177     {
00178         defaultBytesToDump = 20u
00179     };
00180 
00181     void
00182     dumpStatistics(
00183                 StreamType*  theStream = 0,
00184                 size_type    theBytesToDump = defaultBytesToDump);
00185 
00186 private:
00187 
00188     XalanDiagnosticMemoryManager(const XalanDiagnosticMemoryManager&);
00189 
00190     XalanDiagnosticMemoryManager&
00191     operator=(const XalanDiagnosticMemoryManager&);
00192 
00193     MemoryManager&  m_memoryManager;
00194 
00195     bool            m_assertErrors;
00196 
00197     bool            m_locked;
00198 
00199     size_type       m_sequence;
00200 
00201     size_type       m_highWaterMark;
00202 
00203     size_type       m_currentAllocated;
00204 
00205     MapType         m_allocations;
00206 
00207     StreamType*     m_stream;
00208 };
00209 
00210 
00211 
00212 XALAN_CPP_NAMESPACE_END
00213 
00214 
00215 
00216 #endif  // XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680

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