#include <Pool.h>
Public Member Functions | |
AbstractPool () | |
virtual | ~AbstractPool () |
T * | load (const boost::filesystem::path &path) |
Loads a resource if it doesn't exist yet, and return a pointer to it. | |
void | remove (const boost::filesystem::path &path) |
Removes a resource by deallocating the internal copy. | |
void | removeAll () |
Removes all resources. | |
Protected Member Functions | |
virtual T * | loadFromDisk (const boost::filesystem::path &path)=0 |
Loads a ressource from disk. | |
Private Types | |
typedef std::pair < boost::filesystem::path, osg::ref_ptr< T > > | TPair |
Type used to store a resource pair. | |
typedef std::map < boost::filesystem::path, osg::ref_ptr< T > > | TMap |
Private Attributes | |
TMap | map |
Pool storage. |
Resources are identified by their path. Please note that OSG can already cache vertex arrays, nodes and images, so this pool is not useful if the OSG's cache is set for them.
Definition at line 51 of file Pool.h.
typedef std::map<boost::filesystem::path, osg::ref_ptr<T> > Util::AbstractPool< T >::TMap [private] |
typedef std::pair<boost::filesystem::path, osg::ref_ptr<T> > Util::AbstractPool< T >::TPair [private] |
Util::AbstractPool< T >::AbstractPool | ( | ) | [inline] |
virtual Util::AbstractPool< T >::~AbstractPool | ( | ) | [inline, virtual] |
T* Util::AbstractPool< T >::load | ( | const boost::filesystem::path & | path | ) |
Loads a resource if it doesn't exist yet, and return a pointer to it.
virtual T* Util::AbstractPool< T >::loadFromDisk | ( | const boost::filesystem::path & | path | ) | [protected, pure virtual] |
Loads a ressource from disk.
void Util::AbstractPool< T >::remove | ( | const boost::filesystem::path & | path | ) | [inline] |
Removes a resource by deallocating the internal copy.
Definition at line 59 of file Pool.h.
References Util::AbstractPool< T >::map.
void Util::AbstractPool< T >::removeAll | ( | ) | [inline] |
Removes all resources.
Definition at line 61 of file Pool.h.
References Util::AbstractPool< T >::map.
TMap Util::AbstractPool< T >::map [private] |
Pool storage.
Definition at line 74 of file Pool.h.
Referenced by Util::AbstractPool< T >::remove(), and Util::AbstractPool< T >::removeAll().