Last change
on this file since 17b3a5c was 17b3a5c, checked in by Frederik Heber <heber@…>, 16 years ago |
forward declarations used to untangle interdependet classes.
- basically, everywhere in header files we removed '#include' lines were only pointer to the respective classes were used and the include line was moved to the implementation file.
- as a sidenote, lots of funny errors happened because headers were included via a nesting over three other includes. Now, all should be declared directly as needed, as only very little include lines remain in header files.
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /*
|
---|
2 | * \file memoryusageobserver.hpp
|
---|
3 | *
|
---|
4 | * This class represents a Singleton for observing memory usage.
|
---|
5 | */
|
---|
6 | #ifndef MEMORYUSAGEOBSERVER_HPP_
|
---|
7 | #define MEMORYUSAGEOBSERVER_HPP_
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | /*********************************************** includes ***********************************/
|
---|
12 |
|
---|
13 | // include config.h
|
---|
14 | #ifdef HAVE_CONFIG_H
|
---|
15 | #include <config.h>
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | #include <map>
|
---|
19 | #include <iostream>
|
---|
20 | #include <iomanip>
|
---|
21 | #include <fstream>
|
---|
22 | #include <sstream>
|
---|
23 | #include <math.h>
|
---|
24 | #include <string>
|
---|
25 | #include <typeinfo>
|
---|
26 |
|
---|
27 | /********************************************** declarations *******************************/
|
---|
28 |
|
---|
29 | class MemoryUsageObserver {
|
---|
30 | public:
|
---|
31 | static MemoryUsageObserver* getInstance();
|
---|
32 | static void purgeInstance();
|
---|
33 | void addMemory(void* pointer, size_t size);
|
---|
34 | void removeMemory(void* pointer, const char *msg = NULL);
|
---|
35 | size_t getUsedMemorySize();
|
---|
36 | size_t getMaximumUsedMemory();
|
---|
37 |
|
---|
38 | protected:
|
---|
39 | /** Do not call this constructor directly, use getInstance() instead. */
|
---|
40 | MemoryUsageObserver();
|
---|
41 | /** Do not call this destructor directly, use purgeInstance() instead. */
|
---|
42 | ~MemoryUsageObserver();
|
---|
43 |
|
---|
44 | private:
|
---|
45 | static MemoryUsageObserver* instance;
|
---|
46 | map<void*, size_t> memoryUsers;
|
---|
47 | size_t totalSize, maximumSize;
|
---|
48 | };
|
---|
49 | #endif /*MEMORYUSAGEOBSERVER_HPP_*/
|
---|
Note:
See
TracBrowser
for help on using the repository browser.