Overload  1.1
Game engine with editor
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
OvCore::ResourceManagement::AResourceManager< T > Class Template Referenceabstract

#include <AResourceManager.h>

Public Member Functions

T * LoadResource (const std::string &p_path)
 
void UnloadResource (const std::string &p_path)
 
bool MoveResource (const std::string &p_previousPath, const std::string &p_newPath)
 
bool IsResourceRegistered (const std::string &p_path)
 
void UnloadResources ()
 
T * RegisterResource (const std::string &p_path, T *p_instance)
 
void UnregisterResource (const std::string &p_path)
 
T * GetResource (const std::string &p_path, bool p_tryToLoadIfNotFound=true)
 
T * operator[] (const std::string &p_path)
 
std::unordered_map< std::string, T * > & GetResources ()
 

Static Public Member Functions

static void ProvideAssetPaths (const std::string &p_projectAssetsPath, const std::string &p_engineAssetsPath)
 

Protected Member Functions

virtual T * CreateResource (const std::string &p_path)=0
 
virtual void DestroyResource (T *p_resource)=0
 
std::string GetRealPath (const std::string &p_path) const
 

Detailed Description

template<typename T>
class OvCore::ResourceManagement::AResourceManager< T >

Handle the management of various resources of variable type

Member Function Documentation

◆ CreateResource()

template<typename T>
virtual T* OvCore::ResourceManagement::AResourceManager< T >::CreateResource ( const std::string &  p_path)
protectedpure virtual

◆ DestroyResource()

template<typename T>
virtual void OvCore::ResourceManagement::AResourceManager< T >::DestroyResource ( T *  p_resource)
protectedpure virtual

◆ GetRealPath()

template<typename T >
std::string OvCore::ResourceManagement::AResourceManager< T >::GetRealPath ( const std::string &  p_path) const
inlineprotected

◆ GetResource()

template<typename T >
T * OvCore::ResourceManagement::AResourceManager< T >::GetResource ( const std::string &  p_path,
bool  p_tryToLoadIfNotFound = true 
)
inline

Return the instance linked to the given path or try to load it if not registered. Otherwise it will return nullptr.

Parameters
p_path
p_tryToLoadIfNotFound

◆ GetResources()

template<typename T >
std::unordered_map< std::string, T * > & OvCore::ResourceManagement::AResourceManager< T >::GetResources ( )
inline

Returns the resource map

◆ IsResourceRegistered()

template<typename T >
bool OvCore::ResourceManagement::AResourceManager< T >::IsResourceRegistered ( const std::string &  p_path)
inline

Return true if the resource exists (= Is registered)

Parameters
p_path

◆ LoadResource()

template<typename T >
T * OvCore::ResourceManagement::AResourceManager< T >::LoadResource ( const std::string &  p_path)
inline

Handle the creation of a resource and register it

Parameters
p_path

◆ MoveResource()

template<typename T >
bool OvCore::ResourceManagement::AResourceManager< T >::MoveResource ( const std::string &  p_previousPath,
const std::string &  p_newPath 
)
inline

Move a resource to the new given id (path)

Parameters
p_previousPath
p_newPath

◆ operator[]()

template<typename T >
T * OvCore::ResourceManagement::AResourceManager< T >::operator[] ( const std::string &  p_path)
inline

Operator overload to get an instance linked to the given path.

Note
See GetResource for more informations
Parameters
p_path

◆ ProvideAssetPaths()

template<typename T >
void OvCore::ResourceManagement::AResourceManager< T >::ProvideAssetPaths ( const std::string &  p_projectAssetsPath,
const std::string &  p_engineAssetsPath 
)
inlinestatic

Provide asset paths for the resource managers @important This method MUST be called before trying to access any resource from any resource manager

Parameters
p_projectAssetsPath
p_engineAssetsPath

◆ RegisterResource()

template<typename T>
T * OvCore::ResourceManagement::AResourceManager< T >::RegisterResource ( const std::string &  p_path,
T *  p_instance 
)
inline

Register a resource and associate it with a given path. After this method is called, the memory managment of the resource belong the the Resource Manager (Pointer memory deallocation)

Parameters
p_path
p_instance

◆ UnloadResource()

template<typename T >
void OvCore::ResourceManagement::AResourceManager< T >::UnloadResource ( const std::string &  p_path)
inline

Handle the destruction of a resource and unregister it

Parameters
p_path

◆ UnloadResources()

template<typename T >
void OvCore::ResourceManagement::AResourceManager< T >::UnloadResources ( )
inline

Destroy and unregister every resources

◆ UnregisterResource()

template<typename T >
void OvCore::ResourceManagement::AResourceManager< T >::UnregisterResource ( const std::string &  p_path)
inline

Unregister a resource (You have to destroy the resource before calling this method to prevent memory leaks)

Parameters
p_path

The documentation for this class was generated from the following files: