ManaPlus
Public Member Functions
MemoryCounter Class Reference

#include <memorycounter.h>

Inheritance diagram for MemoryCounter:
Action AmbientLayer Animation AtlasItem Map MapHeights MapLayer ObjectsLayer Resource SpecialLayer TextureAtlas

Public Member Functions

 MemoryCounter ()
 
virtual ~MemoryCounter ()
 
int calcMemory (const int level) const
 
virtual int calcMemoryLocal () const
 
virtual int calcMemoryChilds (const int level) const
 
virtual std::string getCounterName () const
 

Detailed Description

Definition at line 28 of file memorycounter.h.

Constructor & Destructor Documentation

◆ MemoryCounter()

MemoryCounter::MemoryCounter ( )

Definition at line 27 of file memorycounter.cpp.

28 {
29 }

◆ ~MemoryCounter()

virtual MemoryCounter::~MemoryCounter ( )
inlinevirtual

Definition at line 37 of file memorycounter.h.

References calcMemory(), calcMemoryChilds(), calcMemoryLocal(), and PRAGMACLANG.

38  { }

Member Function Documentation

◆ calcMemory()

int MemoryCounter::calcMemory ( const int  level) const

Definition at line 36 of file memorycounter.cpp.

References calcMemoryChilds(), calcMemoryLocal(), getCounterName(), memoryManager, and MemoryManager::printMemory().

Referenced by AtlasResource::calcMemoryChilds(), TextureAtlas::calcMemoryChilds(), Action::calcMemoryChilds(), SpriteDef::calcMemoryChilds(), MapLayer::calcMemoryChilds(), Map::calcMemoryChilds(), and ~MemoryCounter().

37 {
38  const int sumLocal = calcMemoryLocal();
39  const int sumChilds = calcMemoryChilds(level);
41  level,
42  sumLocal,
43  sumChilds);
44  return sumLocal + sumChilds;
45 }
virtual int calcMemoryLocal() const
void printMemory(const std::string &name, const int level, const int localSum, const int childsSum)
MemoryManager memoryManager
virtual std::string getCounterName() const
Definition: memorycounter.h:47
virtual int calcMemoryChilds(const int level) const

◆ calcMemoryChilds()

int MemoryCounter::calcMemoryChilds ( const int  level) const
virtual

Reimplemented in Map, MapLayer, SpriteDef, Action, TextureAtlas, and AtlasResource.

Definition at line 47 of file memorycounter.cpp.

Referenced by calcMemory(), and ~MemoryCounter().

48 {
49  return 0;
50 }

◆ calcMemoryLocal()

int MemoryCounter::calcMemoryLocal ( ) const
virtual

◆ getCounterName()

virtual std::string MemoryCounter::getCounterName ( ) const
inlinevirtual

Reimplemented in Map, MapLayer, Animation, Resource, SDLMusic, AmbientLayer, SoundEffect, TextureAtlas, Action, SpecialLayer, MapHeights, AtlasItem, ObjectsLayer, and WalkLayer.

Definition at line 47 of file memorycounter.h.

Referenced by calcMemory().

48  { return "unknown"; }

The documentation for this class was generated from the following files: