ManaPlus
|
#include <resource.h>
Public Member Functions | |
Resource () | |
~Resource () | |
virtual void | incRef () |
virtual void | decRef () |
int | calcMemoryLocal () const |
std::string | getCounterName () const |
Public Member Functions inherited from MemoryCounter | |
MemoryCounter () | |
virtual | ~MemoryCounter () |
int | calcMemory (const int level) const |
virtual int | calcMemoryChilds (const int level) const |
Data Fields | |
time_t | mTimeStamp |
std::string | mIdPath |
std::string | mSource |
unsigned int | mRefCount |
bool | mProtected |
bool | mNotCount |
A generic reference counted resource object.
Definition at line 34 of file resource.h.
|
inline |
Resource::~Resource | ( | ) |
|
virtual |
Reimplemented from MemoryCounter.
Reimplemented in SpriteDef, SoundEffect, and SDLMusic.
Definition at line 76 of file resource.cpp.
References CAST_S32, mIdPath, and mSource.
Referenced by AtlasResource::calcMemoryLocal(), ImageSet::calcMemoryLocal(), WalkLayer::calcMemoryLocal(), SDLMusic::calcMemoryLocal(), SoundEffect::calcMemoryLocal(), and SpriteDef::calcMemoryLocal().
|
virtual |
Decrements the reference count and deletes the object if no references are left.
true
if the object was deleted false
otherwise. Reimplemented in AtlasResource.
Definition at line 50 of file resource.cpp.
References Logger::log(), logger, mIdPath, mNotCount, mRefCount, and ResourceManager::release().
Referenced by Particle::addEffect(), ParticleEngine::addEffect(), ResourceManager::cleanProtected(), ShadersManager::createProgram(), AtlasResource::decRef(), SubImage::decRef(), ResourceManager::decRefDelete(), EquipmentWindow::fillBoxes(), EquipmentWindow::fillDefault(), SoundManager::haltMusic(), SpriteDef::includeSprite(), SpriteDef::load(), Theme::loadColors(), Button::loadImage(), Button::loadImageSet(), Theme::loadInfo(), SoundManager::logic(), ResourceManager::moveToDeleted(), SoundManager::playGuiSfx(), SoundManager::playSfx(), ProgressIndicator::ProgressIndicator(), Theme::readSkin(), Button::setImage(), Gui::setUseCustomCursor(), MapReader::unloadEmptyAtlas(), AnimatedSprite::~AnimatedSprite(), BrowserBox::~BrowserBox(), Button::~Button(), EmotePage::~EmotePage(), EmoteWindow::~EmoteWindow(), EquipmentWindow::~EquipmentWindow(), Gui::~Gui(), Map::~Map(), ShaderProgram::~ShaderProgram(), SimpleAnimation::~SimpleAnimation(), StaticBrowserBox::~StaticBrowserBox(), and WindowMenu::~WindowMenu().
|
inlinevirtual |
Reimplemented from MemoryCounter.
Reimplemented in SoundEffect, and SDLMusic.
Definition at line 79 of file resource.h.
|
virtual |
Increments the internal reference count.
Reimplemented in AtlasResource.
Definition at line 38 of file resource.cpp.
References Logger::log(), logger, and mRefCount.
Referenced by ResourceManager::addResource(), AnimatedSprite::AnimatedSprite(), ResourceManager::get(), ResourceManager::getFromCache(), AtlasResource::incRef(), SpriteDef::load(), AtlasManager::loadEmptyImages(), and AtlasManager::loadImages().
std::string Resource::mIdPath |
Path identifying this resource.
Definition at line 84 of file resource.h.
Referenced by ResourceManager::addResource(), calcMemoryLocal(), ResourceManager::cleanUp(), ShadersManager::createProgram(), decRef(), ResourceManager::decRefDelete(), ResourceManager::deleteInstance(), ResourceManager::get(), getCounterName(), AnimatedSprite::getIdPath(), SpriteDef::getImageSet(), SpriteDef::loadAction(), SpriteDef::loadAnimation(), ResourceManager::logResource(), ResourceManager::moveToDeleted(), and ResourceManager::release().
bool Resource::mNotCount |
Definition at line 89 of file resource.h.
Referenced by decRef().
bool Resource::mProtected |
Definition at line 88 of file resource.h.
Referenced by ResourceManager::cleanProtected(), and SpriteDef::load().
unsigned int Resource::mRefCount |
Reference count.
Definition at line 87 of file resource.h.
Referenced by ResourceManager::cleanUp(), AtlasResource::decRef(), decRef(), ResourceManager::decRefDelete(), ResourceManager::deleteInstance(), AtlasResource::incRef(), incRef(), ResourceManager::logResource(), and ResourceManager::moveToDeleted().
std::string Resource::mSource |
Definition at line 85 of file resource.h.
Referenced by SpriteDef::addSequence(), calcMemoryLocal(), getCounterName(), SpriteDef::getImageSet(), SpriteDef::includeSprite(), SpriteDef::load(), SpriteDef::loadAction(), SpriteDef::loadAnimation(), SpriteDef::loadImageSet(), and ResourceManager::logResource().
time_t Resource::mTimeStamp |
Time at which the resource was orphaned.
Definition at line 82 of file resource.h.
Referenced by ResourceManager::cleanOrphans(), and ResourceManager::release().