Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
Fling::ResourceManager Class Reference

The resource manager handles loading of files off disk. More...

#include <ResourceManager.h>

Inherits Fling::Singleton< ResourceManager >.

Public Member Functions

virtual void Init () override
 
virtual void Shutdown () override
 
template<class T >
std::shared_ptr< T > GetResourceOfType (Guid_Handle t_ID) const
 
std::shared_ptr< ResourceGetResource (Guid_Handle t_ID) const
 Get the already loaded resouce with this Guid. More...
 
bool IsLoaded (Guid_Handle t_ID) const
 Check if there is a resource with this ID loaded or not. More...
 

Static Public Member Functions

template<class T , class ... ARGS>
static std::shared_ptr< T > LoadResource (Guid t_ID, ARGS &&... args)
 
- Static Public Member Functions inherited from Fling::Singleton< ResourceManager >
static ResourceManagerGet ()
 

Private Types

typedef std::map< Fling::Guid_Handle, std::shared_ptr< Resource > >::iterator ResourceMapIt
 
typedef std::map< Fling::Guid_Handle, std::shared_ptr< Resource > >::const_iterator ResourceMapConstIt
 

Private Member Functions

template<class T , class ... ARGS>
std::shared_ptr< T > LoadResourceImpl (Guid t_ID, ARGS &&... args)
 

Private Attributes

std::map< Fling::Guid_Handle, std::shared_ptr< Resource > > m_ResourceMap
 Map of currently loaded resources. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Fling::Singleton< ResourceManager >
 Singleton ()=default
 Every singleton must have a default constructor so that explicit creation and destruction of them is maintained. More...
 

Detailed Description

The resource manager handles loading of files off disk.

Every Resource type has a Guid. This Guid functions as both the file path (relative to the ASSETS directory) as well as a hashed string for easy passing around of information. Each resource is only ever loaded into memory ONCE.

See also
Fling::Guid
Fling::Guid_Handle
Fling::Resource

Member Typedef Documentation

◆ ResourceMapConstIt

typedef std::map<Fling::Guid_Handle, std::shared_ptr<Resource> >::const_iterator Fling::ResourceManager::ResourceMapConstIt
private

◆ ResourceMapIt

typedef std::map<Fling::Guid_Handle, std::shared_ptr<Resource> >::iterator Fling::ResourceManager::ResourceMapIt
private

Member Function Documentation

◆ GetResource()

std::shared_ptr< Resource > Fling::ResourceManager::GetResource ( Guid_Handle  t_ID) const

Get the already loaded resouce with this Guid.

Returns nullptr if not loaded yet.

Parameters
t_IDGuid of the resource (a hashed string handle)
Returns
std::shared_ptr<Resource> Pointer to the resource

◆ GetResourceOfType()

template<class T >
std::shared_ptr< T > Fling::ResourceManager::GetResourceOfType ( Guid_Handle  t_ID) const
inline

◆ Init()

void Fling::ResourceManager::Init ( )
overridevirtual

◆ IsLoaded()

bool Fling::ResourceManager::IsLoaded ( Guid_Handle  t_ID) const

Check if there is a resource with this ID loaded or not.

Returns
If the resource ID is loaded or not

◆ LoadResource()

template<class T , class ... ARGS>
static std::shared_ptr<T> Fling::ResourceManager::LoadResource ( Guid  t_ID,
ARGS &&...  args 
)
inlinestatic

◆ LoadResourceImpl()

template<class T , class ... ARGS>
std::shared_ptr< T > Fling::ResourceManager::LoadResourceImpl ( Guid  t_ID,
ARGS &&...  args 
)
inlineprivate

◆ Shutdown()

void Fling::ResourceManager::Shutdown ( )
overridevirtual

Field Documentation

◆ m_ResourceMap

std::map<Fling::Guid_Handle, std::shared_ptr<Resource> > Fling::ResourceManager::m_ResourceMap
private

Map of currently loaded resources.


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