PixelLightAPI
.
|
Abstract resource manager template. More...
#include <ResourceManager.h>
Public Member Functions | |
String | GetManagerName () const |
Returns the name of the manager. | |
bool | SetManagerName (const String &sName="") |
Sets the name of the manager. | |
bool | Clear (bool bProtectedToo=true) |
Clear the manager, delete all resources. | |
AType * | Create (const String &sName="") |
Creates a new resource. | |
bool | Unload (AType &cResource) |
Unload a resource. | |
uint32 | UnloadUnused () |
Unload unused resources. | |
bool | GetUnloadUnused () const |
Returns whether unused resource are unloaded automatically or not. | |
void | SetUnloadUnused (bool bUnloadUnused=false) |
Sets whether unused resource are unloaded automatically or not. | |
AType * | GetStandard () const |
Get the standard resource. | |
bool | SetStandard (AType *pResource=nullptr) |
Set the standard resource. | |
uint32 | GetNumOfElements () const |
Returns the number of resources within the manager. | |
virtual AType * | LoadResource (const String &sFilename) |
Loads a resource. | |
virtual bool | Init () |
Initializes the manager. | |
virtual bool | DeInit () |
De-initializes the manager. | |
virtual bool | Update () |
Updates the manager. | |
virtual ResourceManager< AType > & | operator= (const ResourceManager< AType > &cSource) |
Copy operator. | |
virtual AType * | GetByIndex (uint32 nIndex=0) const |
Returns the resource at the given index. | |
virtual AType * | GetByName (const String &sName) const |
Returns the resource with the given name. | |
Public Attributes | |
PLCore::Event< AType & > | EventResourceRemoved |
Protected Member Functions | |
ResourceManager () | |
Constructor. | |
virtual | ~ResourceManager () |
Destructor. | |
bool | SetResourceName (AType &cResource, const String &sName) |
Sets the resource name. | |
virtual AType * | CreateResource (const String &sName="")=0 |
Creates a new resource. | |
Protected Attributes | |
String | m_sManagerName |
AType * | m_pStandardResource |
bool | m_bUnloadUnused |
Array< AType * > | m_lstResources |
HashMap< String, AType * > | m_mapResources |
Abstract resource manager template.
PLCore::ResourceManager< AType >::ResourceManager | ( | ) | [protected] |
PLCore::ResourceManager< AType >::~ResourceManager | ( | ) | [protected, virtual] |
Destructor.
String PLCore::ResourceManager< AType >::GetManagerName | ( | ) | const |
Returns the name of the manager.
bool PLCore::ResourceManager< AType >::SetManagerName | ( | const String & | sName = "" | ) |
Sets the name of the manager.
[in] | sName | New manager name |
bool PLCore::ResourceManager< AType >::Clear | ( | bool | bProtectedToo = true | ) |
Clear the manager, delete all resources.
[in] | bProtectedToo | Delete protected resources, too? |
AType * PLCore::ResourceManager< AType >::Create | ( | const String & | sName = "" | ) |
Creates a new resource.
[in] | sName | Resource name, if "" an unused name is set automatically |
bool PLCore::ResourceManager< AType >::Unload | ( | AType & | cResource | ) |
Unload a resource.
[in] | cResource | Resource which should be unloaded |
uint32 PLCore::ResourceManager< AType >::UnloadUnused | ( | ) |
bool PLCore::ResourceManager< AType >::GetUnloadUnused | ( | ) | const |
Returns whether unused resource are unloaded automatically or not.
void PLCore::ResourceManager< AType >::SetUnloadUnused | ( | bool | bUnloadUnused = false | ) |
Sets whether unused resource are unloaded automatically or not.
[in] | bUnloadUnused | Unload unused resources automatically? |
AType * PLCore::ResourceManager< AType >::GetStandard | ( | ) | const |
Get the standard resource.
bool PLCore::ResourceManager< AType >::SetStandard | ( | AType * | pResource = nullptr | ) |
Set the standard resource.
[in] | pResource | Resource which should be the standard resource, a null pointer to set no such resource |
uint32 PLCore::ResourceManager< AType >::GetNumOfElements | ( | ) | const |
Returns the number of resources within the manager.
AType * PLCore::ResourceManager< AType >::LoadResource | ( | const String & | sFilename | ) | [virtual] |
Loads a resource.
[in] | sFilename | Filename of the resource to load |
bool PLCore::ResourceManager< AType >::Init | ( | ) | [virtual] |
Initializes the manager.
bool PLCore::ResourceManager< AType >::DeInit | ( | ) | [virtual] |
De-initializes the manager.
bool PLCore::ResourceManager< AType >::Update | ( | ) | [virtual] |
Updates the manager.
ResourceManager< AType > & PLCore::ResourceManager< AType >::operator= | ( | const ResourceManager< AType > & | cSource | ) | [virtual] |
Copy operator.
[in] | cSource | Source to copy from |
AType * PLCore::ResourceManager< AType >::GetByIndex | ( | uint32 | nIndex = 0 | ) | const [virtual] |
Returns the resource at the given index.
[in] | nIndex | Index of the resource |
AType * PLCore::ResourceManager< AType >::GetByName | ( | const String & | sName | ) | const [virtual] |
Returns the resource with the given name.
[in] | sName | Resource name |
bool PLCore::ResourceManager< AType >::SetResourceName | ( | AType & | cResource, |
const String & | sName | ||
) | [protected] |
Sets the resource name.
Sets the unique resource name.
[in] | cResource | Resource to set the name |
[in] | sName | New resource name |
virtual AType* PLCore::ResourceManager< AType >::CreateResource | ( | const String & | sName = "" | ) | [protected, pure virtual] |
PLCore::Event<AType&> PLCore::ResourceManager< AType >::EventResourceRemoved |
Resource removed event, removed resource as parameter
String PLCore::ResourceManager< AType >::m_sManagerName [protected] |
Manager name
AType* PLCore::ResourceManager< AType >::m_pStandardResource [protected] |
Standard resource, can be a null pointer
bool PLCore::ResourceManager< AType >::m_bUnloadUnused [protected] |
Unload unused resources?
Array<AType*> PLCore::ResourceManager< AType >::m_lstResources [protected] |
Resource list
Reimplemented in PLSound::SoundManager.
HashMap<String, AType*> PLCore::ResourceManager< AType >::m_mapResources [protected] |
Resource map
|