1 #ifndef CORE_MemoryStack_H
2 #define CORE_MemoryStack_H
29 std::map<std::string,const T*> mObjects;
75 return mObjects.size()*(
sizeof(tString)+
sizeof(T*));
83 mObjects[functions_type::pointerToString(obj)]=obj;
91 typename std::map<std::string,const T*>::iterator iter=mObjects.find(functions_type::pointerToString(obj));
92 if (iter!=mObjects.end()) {
105 return mObjects.size();
114 std::stringstream cstr;
116 cstr<<
"registered objects:"<<std::endl;
120 std::for_each(mObjects.cbegin(),mObjects.cend(),
121 [&](
const auto& obj) {
122 cstr<<
"\t"<<obj.first<<
"->"<<obj.second->getIdentityString();
126 cstr<<
"number of registered objects :"<<n<<std::endl;
CORE_MemoryStack is the class to register all the created classes to detect not destroyed classes.
Definition: CORE_MemoryStack.h:14
void unregisterClass(const T *obj)
unregister the object
Definition: CORE_MemoryStack.h:89
tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: CORE_MemoryStack.h:74
void registerClass(const T *obj)
register the object
Definition: CORE_MemoryStack.h:81
std::string toString() const
print all the registred classes
Definition: CORE_MemoryStack.h:113
tMemSize getMemorySize() const
return the memory size in byte
Definition: CORE_MemoryStack.h:63
CORE_MemoryStack()
build an instance of the object
Definition: CORE_MemoryStack.h:37
tIndex getRegistredClassesNumber() const
retunr the number of registred elements
Definition: CORE_MemoryStack.h:104
virtual ~CORE_MemoryStack()
destroy the instance of object
Definition: CORE_MemoryStack.h:43