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*
87  getExceptionMemoryManager();
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 
148  const_iterator
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 
181  operator=(const XalanDiagnosticMemoryManager&);
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
#define XALAN_HARNESS_EXPORT
XALAN_CPP_NAMESPACE_BEGIN typedef size_t size_type
Definition: XalanMap.hpp:46
Data(size_type theSize, size_type theSequence)

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