55 for ( ; it != itend; ++it) {
56 totalSize += it->second->getSize();
67 for ( ; it != itend; ++it) {
81 for ( ; it != itend; ++it) {
101 FL_WARN(
_log,
LMsg(
"AnimationManager::create(std::string, IResourceLoader* loader) - ") <<
"Resource name " << name <<
" was previously created. Returning original Animation...");
125 FL_WARN(
_log,
LMsg(
"AnimationManager::load(std::string) - ") <<
"Resource name " << name <<
" was not found and could not be loaded.");
138 std::pair<AnimationHandleMapIterator, bool> returnValue;
141 if (returnValue.second) {
145 FL_WARN(
_log,
LMsg(
"AnimationManager::add(IResource*) - ") <<
"Resource " << res->
getName() <<
" already exists.... ignoring.");
148 return returnValue.first->second;
180 FL_WARN(
_log,
LMsg(
"AnimationManager::reload(std::string) - ") <<
"Resource name " << name <<
" not found.");
194 FL_WARN(
_log,
LMsg(
"AnimationManager::reload(ResourceHandle) - ") <<
"Resource handle " << handle <<
" not found.");
202 for ( ; it != itend; ++it) {
215 for ( ; it != itend; ++it) {
221 FL_DBG(
_log,
LMsg(
"AnimationManager::loadUnreferenced() - ") <<
"Loaded " << count <<
" unreferenced resources.");
234 FL_WARN(
_log,
LMsg(
"AnimationManager::free(std::string) - ") <<
"Resource name " << name <<
" not found.");
246 FL_WARN(
_log,
LMsg(
"AnimationManager::free(ResourceHandle) - ") <<
"Resource handle " << handle <<
" not found.");
255 for ( ; it != itend; ++it) {
262 FL_DBG(
_log,
LMsg(
"AnimationManager::freeAll() - ") <<
"Freed all " << count <<
" resources.");
270 for ( ; it != itend; ++it) {
277 FL_DBG(
_log,
LMsg(
"AnimationManager::freeUnreferenced() - ") <<
"Freed " << count <<
" unreferenced resources.");
294 FL_WARN(
_log,
LMsg(
"AnimationManager::remove(ResourcePtr&) - ") <<
"Resource " << resource->
getName() <<
" was not found.");
302 handle = nit->second->getHandle();
306 FL_WARN(
_log,
LMsg(
"AnimationManager::remove(std::string) - ") <<
"Resource " << name <<
" was not found.");
325 name = it->second->getName();
329 FL_WARN(
_log,
LMsg(
"AnimationManager::remove(ResourceHandle) - ") <<
"Resource handle " << handle <<
" was not found.");
351 FL_DBG(
_log,
LMsg(
"AnimationManager::removeAll() - ") <<
"Removed all " << count <<
" resources.");
358 std::vector<int> imgHandles;
361 for ( ; it != itend; ++it) {
362 if ( it->second.useCount() == 2) {
363 imgHandles.push_back(it->second->getHandle());
368 for (std::vector<int>::iterator it = imgHandles.begin(); it != imgHandles.end(); ++it) {
372 FL_DBG(
_log,
LMsg(
"AnimationManager::removeUnreferenced() - ") <<
"Removed " << count <<
" unreferenced resources.");
401 FL_WARN(
_log,
LMsg(
"AnimationManager::get(ResourceHandle) - ") <<
"Resource handle " << handle <<
" is undefined.");
413 FL_WARN(
_log,
LMsg(
"AnimationManager::getPtr(std::string) - ") <<
"Resource " << name <<
" is undefined.");
424 FL_WARN(
_log,
LMsg(
"AnimationManager::getPtr(ResourceHandle) - ") <<
"Resource handle " << handle <<
" is undefined.");
432 return nit->second->getHandle();
435 FL_WARN(
_log,
LMsg(
"AnimationManager::getResourceHandle(std::string) - ") <<
"Resource " << name <<
" is undefined.");
444 it->second.get()->invalidate();
453 it->second.get()->invalidate();
462 for ( ; it != itend; ++it) {
464 it->second.get()->invalidate();
#define FL_WARN(logger, msg)
virtual ResourceState getState()
virtual ResourceHandle getResourceHandle(const std::string &name)
Gets an Animation handle by name.
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
virtual void remove(AnimationPtr &resource)
Removes an Animation from the manager.
static Logger _log(LM_AUDIO)
virtual AnimationPtr getPtr(const std::string &name)
virtual void freeUnreferenced()
Frees all unreferenced Animation.
std::size_t ResourceHandle
virtual size_t getTotalResources() const
Returns the number of defined resources.
virtual size_t getTotalResourcesLoaded() const
Returns the number of loaded resources.
virtual AnimationPtr add(Animation *res)
Add an Animation to the manager.
virtual void removeAll()
Removes all Animations from the manager.
virtual AnimationPtr create(IResourceLoader *loader=0)
Creates a blank Animation but does not load it immediately.
virtual ~AnimationManager()
Destructor.
virtual void loadUnreferenced()
Loads all unreferenced Animations.
std::map< std::string, AnimationPtr >::iterator AnimationNameMapIterator
AnimationHandleMap m_animHandleMap
virtual AnimationPtr load(const std::string &name, IResourceLoader *loader=0)
Creates a blank resource and loads it from disk.
virtual const std::string & getName()
virtual void removeUnreferenced()
Removes all unreferenced Animations.
virtual size_t getMemoryUsed() const
Gets the total amount of memory used by resources.
std::map< ResourceHandle, AnimationPtr >::const_iterator AnimationHandleMapConstIterator
virtual void invalidate(const std::string &name)
SharedPtr< Animation > AnimationPtr
virtual void invalidateAll()
virtual bool exists(const std::string &name)
Checks to see if an Animation exists.
std::map< ResourceHandle, AnimationPtr >::iterator AnimationHandleMapIterator
virtual AnimationPtr get(const std::string &name)
Gets a shared pointer to the Animation.
virtual void reloadAll()
Reloads all Animations.
virtual void reload(const std::string &name)
Reloads an Animation.
virtual size_t getTotalResourcesCreated() const
Returns the number of unloaded resources.
ResourceHandle getHandle()
AnimationNameMap m_animNameMap
std::pair< std::string, AnimationPtr > AnimationNameMapPair
std::pair< ResourceHandle, AnimationPtr > AnimationHandleMapPair
#define FL_DBG(logger, msg)
virtual void free(const std::string &name)
Frees an Animation from memory.
virtual void freeAll()
Frees all Animations.