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 ( )

Definition at line 37 of file memorycounter.h.

38  { }

Member Function Documentation

◆ calcMemory()

int MemoryCounter::calcMemory ( const int  level) const

Definition at line 36 of file memorycounter.cpp.

37 {
38  const int sumLocal = calcMemoryLocal();
39  const int sumChilds = calcMemoryChilds(level);
41  level,
42  sumLocal,
43  sumChilds);
44  return sumLocal + sumChilds;
45 }

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

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

◆ calcMemoryChilds()

int MemoryCounter::calcMemoryChilds ( const int  level) const

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

Definition at line 47 of file memorycounter.cpp.

48 {
49  return 0;
50 }

Referenced by calcMemory().

◆ calcMemoryLocal()

int MemoryCounter::calcMemoryLocal ( ) const

◆ getCounterName()

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

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

Definition at line 47 of file memorycounter.h.

48  { return "unknown"; }

Referenced by calcMemory().

The documentation for this class was generated from the following files:
static void printMemory(const std::string &name, const int level, const int localSum, const int childsSum)
Definition: memorymanager.cpp:58
virtual int calcMemoryLocal() const
Definition: memorycounter.cpp:31
virtual std::string getCounterName() const
Definition: memorycounter.h:47
virtual int calcMemoryChilds(const int level) const
Definition: memorycounter.cpp:47