Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


XalanDiagnosticMemoryManager.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(XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680)
19 #define XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
27 #include <cstddef>
28 
29 
30 
31 #if defined(XALAN_CLASSIC_IOSTREAMS)
32 #include <iostream.h>
33 #else
34 #include <iosfwd>
35 #include <ios>
36 #endif
37 
38 
39 
42 
43 
44 
45 XALAN_CPP_NAMESPACE_BEGIN
46 
47 
48 
50 {
51 public:
52 
53 #if defined(XALAN_NO_STD_NAMESPACE)
54  typedef ostream StreamType;
55 #else
56  typedef std::ostream StreamType;
57 #endif
58 
60  {
61  public:
62 
64  {
65  }
66 
68  {
69  }
70  };
71 
73  MemoryManager& theMemoryManager,
74  bool fAssertErrors = false,
75  StreamType* theStream = 0);
76 
77  virtual
79 
80  virtual void*
81  allocate(size_type size);
82 
83  virtual void
84  deallocate(void* pointer);
85 
86  virtual MemoryManager*
88 
89  bool
91  {
92  return m_assertErrors;
93  }
94 
95  void
96  setAssertErrors(bool fFlag)
97  {
98  m_assertErrors = fFlag;
99  }
100 
101  // Get the high-water mark (the highest amount
102  // that was allocated at any particular point).
103  size_type
105  {
106  return m_highWaterMark;
107  }
108 
109  // Get the number of bytes currently allocated.
110  size_type
111  getAllocated() const
112  {
113  return m_currentAllocated;
114  }
115 
116  // Get the current number of outstanding allocations.
117  size_type
119  {
120  return m_allocations.size();
121  }
122 
123  struct Data
124  {
125  Data() :
126  m_size(0),
127  m_sequence(0)
128  {
129  }
130 
132  size_type theSize,
133  size_type theSequence) :
134  m_size(theSize),
135  m_sequence(theSequence)
136  {
137  }
138 
140 
142  };
143 
145 
147 
150  {
151  return m_allocations.begin();
152  }
153 
154  void
156  {
157  m_locked = true;
158  }
159 
160  void
162  {
163  m_locked = false;
164  }
165 
166  enum
167  {
168  defaultBytesToDump = 20u
169  };
170 
171  void
172  dumpStatistics(
173  StreamType* theStream = 0,
174  size_type theBytesToDump = defaultBytesToDump);
175 
176 private:
177 
179 
182 
183  MemoryManager& m_memoryManager;
184 
185  bool m_assertErrors;
186 
187  bool m_locked;
188 
189  size_type m_sequence;
190 
191  size_type m_highWaterMark;
192 
193  size_type m_currentAllocated;
194 
195  MapType m_allocations;
196 
197  StreamType* m_stream;
198 };
199 
200 
201 
202 XALAN_CPP_NAMESPACE_END
203 
204 
205 
206 #endif // XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680
XALAN_HARNESS_EXPORT
#define XALAN_HARNESS_EXPORT
Definition: XalanHarnessDefinitions.hpp:27
XalanMemoryManager
Definition: XalanMemoryManagement.hpp:46
XalanDiagnosticMemoryManager::Data::m_sequence
size_type m_sequence
Definition: XalanDiagnosticMemoryManager.hpp:141
XalanDiagnosticMemoryManager::Data::Data
Data(size_type theSize, size_type theSequence)
Definition: XalanDiagnosticMemoryManager.hpp:131
XalanDiagnosticMemoryManager::StreamType
std::ostream StreamType
Definition: XalanDiagnosticMemoryManager.hpp:56
XalanDiagnosticMemoryManager::Data::Data
Data()
Definition: XalanDiagnosticMemoryManager.hpp:125
XalanMemoryManager::allocate
virtual void * allocate(size_type size)=0
XalanMap< void *, Data >
XalanDiagnosticMemoryManager::getAllocationsIterator
const_iterator getAllocationsIterator() const
Definition: XalanDiagnosticMemoryManager.hpp:149
XalanDiagnosticMemoryManager
Definition: XalanDiagnosticMemoryManager.hpp:49
XalanHarnessDefinitions.hpp
XalanMemoryManagement.hpp
XalanDiagnosticMemoryManager::MapType
XalanMap< void *, Data > MapType
Definition: XalanDiagnosticMemoryManager.hpp:144
XalanDiagnosticMemoryManager::lock
void lock()
Definition: XalanDiagnosticMemoryManager.hpp:155
XalanDiagnosticMemoryManager::Data::m_size
size_type m_size
Definition: XalanDiagnosticMemoryManager.hpp:139
XalanMapIterator
Definition: XalanMap.hpp:115
XalanDiagnosticMemoryManager::getAllocations
size_type getAllocations() const
Definition: XalanDiagnosticMemoryManager.hpp:118
XalanDiagnosticMemoryManager::getAllocated
size_type getAllocated() const
Definition: XalanDiagnosticMemoryManager.hpp:111
size_type
XALAN_CPP_NAMESPACE_BEGIN typedef size_t size_type
Definition: XalanMap.hpp:46
XalanMemoryManager::getExceptionMemoryManager
virtual MemoryManager * getExceptionMemoryManager()=0
XalanDiagnosticMemoryManager::LockException
Definition: XalanDiagnosticMemoryManager.hpp:59
XalanMap.hpp
XalanDiagnosticMemoryManager::const_iterator
MapType::const_iterator const_iterator
Definition: XalanDiagnosticMemoryManager.hpp:146
XalanDiagnosticMemoryManager::getAssertErrors
bool getAssertErrors() const
Definition: XalanDiagnosticMemoryManager.hpp:90
XalanDiagnosticMemoryManager::setAssertErrors
void setAssertErrors(bool fFlag)
Definition: XalanDiagnosticMemoryManager.hpp:96
XalanDiagnosticMemoryManager::unlock
void unlock()
Definition: XalanDiagnosticMemoryManager.hpp:161
XalanDiagnosticMemoryManager::Data
Definition: XalanDiagnosticMemoryManager.hpp:123
XalanDiagnosticMemoryManager::LockException::~LockException
~LockException()
Definition: XalanDiagnosticMemoryManager.hpp:67
XalanMemoryManager::size_type
size_t size_type
Definition: XalanMemoryManagement.hpp:54
XalanMemoryManager::deallocate
virtual void deallocate(void *pointer)=0
XalanDiagnosticMemoryManager::getHighWaterMark
size_type getHighWaterMark() const
Definition: XalanDiagnosticMemoryManager.hpp:104
XalanDiagnosticMemoryManager::LockException::LockException
LockException()
Definition: XalanDiagnosticMemoryManager.hpp:63
XalanMemoryManager::operator=
XalanMemoryManager & operator=(const XalanMemoryManager &)
Definition: XalanMemoryManagement.hpp:92

Interpreting class diagrams

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

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

Apache Logo