3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Content.ContentManager Class Reference

Manages the lifetimes of all loaded assets. More...

#include <ContentManager.hpp>

Inheritance diagram for Engine3DRadSpace.Content.ContentManager:
Collaboration diagram for Engine3DRadSpace.Content.ContentManager:

Public Member Functions

uint Load (ref UUID uuid, string path)
void Remove (uint id)
void Clear ()
ulong Count ()
 ContentManager (IGame *owner)
 Constructs an instance of ContentManager.
 ContentManager (const ContentManager &)=delete
 ContentManager (ContentManager &&) noexcept=default
ContentManager & operator= (const ContentManager &)=delete
ContentManager & operator= (ContentManager &&) noexcept=default
template<AssetType T>
void RegisterType (Tag< T > dummy)
 Registers an type T into this ContentManager.
template<AssetType T>
T * Load (const std::filesystem::path &path, AssetID< T > *refID=nullptr)
 Loads an asset of type T from the specified path.
template<AssetType T, typename ... Args>
T * Load (const std::filesystem::path &path, AssetID< T > *refID, Args &&...params)
 Loads an asset of type T with additional constructor parameters.
IAsset * Load (const Reflection::UUID &uuid, const std::filesystem::path &path, unsigned *refID=nullptr)
 Type erased asset loading function.
void Reload (unsigned ref)
 Reloads an asset by its reference ID.
template<AssetType T>
T * operator[] (AssetID< T > ref) const
 Returns an pointer to the asset of type T associated with the given reference ID.
IAsset * At (unsigned ref) const
 Returns an pointer to the asset associated with the given reference ID.
std::filesystem::path GetAssetPath (unsigned id) const noexcept
 Returns the path an asset with the specified ID was loaded from.
Reflection::UUID GetAssetType (unsigned id) const noexcept
 Returns the type UUID of the specified asset ID.
std::string GetAssetName (unsigned id) const noexcept
 Returns the name of the specified asset ID.
std::vector< AssetEntry >::iterator begin ()
std::vector< AssetEntry >::iterator end ()
void RemoveAsset (unsigned id)
 Frees an asset from the ContentManager by its ID.
void Clear ()
 Removes all assets from the ContentManager.
Graphics::IGraphicsDevice * GetDevice () const noexcept
 Returns the graphics device associated with this ContentManager.
size_t Count () const noexcept
 Returns the number of loaded assets in the ContentManager.
 ~ContentManager () override=default
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()
Public Member Functions inherited from Engine3DRadSpace.IService
IGame * GetOwner () const noexcept
 Gets the owner of this instance.
virtual ~IService ()=default

Public Attributes

 IAsset

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.InstIService
 InstIService (IntPtr handle)
 InstIService (IntPtr handle, bool ownsHandle)
Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Protected Member Functions inherited from Engine3DRadSpace.IService
 IService ()
 IService (IGame *owner)
 IService (const IService &)=delete
IService & operator= (const IService &)=delete
 IService (IService &&) noexcept=default
IService & operator= (IService &&) noexcept=default
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed
Protected Attributes inherited from Engine3DRadSpace.IService
IGame * _owner = nullptr
Properties inherited from Engine3DRadSpace.InstIService
IGame Owner [get]
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]
Properties inherited from Engine3DRadSpace.IService
IGame Owner [get]

Detailed Description

Manages the lifetimes of all loaded assets.

Constructor & Destructor Documentation

◆ ContentManager() [1/3]

ContentManager::ContentManager ( IGame * owner)

Constructs an instance of ContentManager.

Parameters
ownerOwner of this ContentManager.

◆ ContentManager() [2/3]

Engine3DRadSpace.Content.ContentManager.ContentManager ( const ContentManager & )
delete

◆ ContentManager() [3/3]

Engine3DRadSpace.Content.ContentManager.ContentManager ( ContentManager && )
defaultnoexcept

◆ ~ContentManager()

Engine3DRadSpace.Content.ContentManager.~ContentManager ( )
overridedefault

Member Function Documentation

◆ At()

IAsset * ContentManager::At ( unsigned ref) const

Returns an pointer to the asset associated with the given reference ID.

Parameters
refAsset reference ID
Returns
Pointer to the asset

◆ begin()

std::vector< ContentManager::AssetEntry >::iterator ContentManager::begin ( )

◆ Clear() [1/2]

void ContentManager.Clear ( )
inline

◆ Clear() [2/2]

Removes all assets from the ContentManager.

◆ Count() [1/2]

ulong Engine3DRadSpace.Content.ContentManager.Count ( )
inline

◆ Count() [2/2]

size_t ContentManager::Count ( ) const
noexcept

Returns the number of loaded assets in the ContentManager.

Returns
Number of loaded assets

◆ end()

std::vector< ContentManager::AssetEntry >::iterator ContentManager::end ( )

◆ GetAssetName()

std::string ContentManager::GetAssetName ( unsigned id) const
noexcept

Returns the name of the specified asset ID.

Parameters
idAsset ID
Returns
Name of the asset

◆ GetAssetPath()

std::filesystem::path ContentManager::GetAssetPath ( unsigned id) const
noexcept

Returns the path an asset with the specified ID was loaded from.

Parameters
idAsset ID
Returns
Path to the asset

◆ GetAssetType()

Reflection::UUID ContentManager::GetAssetType ( unsigned id) const
noexcept

Returns the type UUID of the specified asset ID.

Parameters
idAsset ID
Returns
Type UUID of the asset

◆ GetDevice()

IGraphicsDevice * ContentManager::GetDevice ( ) const
noexcept

Returns the graphics device associated with this ContentManager.

Returns
Pointer to the graphics device

◆ Load() [1/4]

uint Engine3DRadSpace.Content.ContentManager.Load ( ref UUID uuid,
string path )
inline

◆ Load() [2/4]

IAsset * ContentManager::Load ( const Reflection::UUID & uuid,
const std::filesystem::path & path,
unsigned * refID = nullptr )

Type erased asset loading function.

Parameters
uuidUUID of the asset type.
pathPath on disk to the asset.
refIDOptional reference ID to store the asset's ID.
Returns
Pointer to the loaded asset.

◆ Load() [3/4]

template<AssetType T, typename ... Args>
T * Engine3DRadSpace.Content.ContentManager::Load ( const std::filesystem::path & path,
AssetID< T > * refID,
Args &&... params )
inline

Loads an asset of type T with additional constructor parameters.

Template Parameters
...ArgsExtra type arguments
TAsset type
Parameters
pathPath on disk to the asset.
refIDOptional reference ID to store the asset's ID.
...paramsAdditional constructor parameters.
Returns
Pointer to the loaded asset.

◆ Load() [4/4]

template<AssetType T>
T * Engine3DRadSpace.Content.ContentManager::Load ( const std::filesystem::path & path,
AssetID< T > * refID = nullptr )
inline

Loads an asset of type T from the specified path.

Template Parameters
TAsset type.
Parameters
pathPath on disk to the asset.
refIDOptional reference ID to store the asset's ID.
Returns
Pointer to the loaded asset.
                                IMPLEMENTATION FOR ContentManager TEMPLATE METHODS

◆ operator=() [1/2]

ContentManager & Engine3DRadSpace.Content.ContentManager.operator= ( const ContentManager & )
delete

◆ operator=() [2/2]

ContentManager & Engine3DRadSpace.Content.ContentManager.operator= ( ContentManager && )
defaultnoexcept

◆ operator[]()

template<AssetType T>
T * Engine3DRadSpace.Content.ContentManager::operator[] ( AssetID< T > ref) const
inline

Returns an pointer to the asset of type T associated with the given reference ID.

Template Parameters
TAsset type
Parameters
refAsset reference ID
Returns
Pointer to the asset of type T

◆ RegisterType()

template<AssetType T>
void Engine3DRadSpace.Content.ContentManager::RegisterType ( Tag< T > dummy)
inline

Registers an type T into this ContentManager.

Template Parameters
TType that must satisfy the AssetType concept
Parameters
dummyType dummy used for operator overloading

◆ Reload()

void ContentManager::Reload ( unsigned ref)

Reloads an asset by its reference ID.

Parameters
refAsset reference ID

◆ Remove()

void Engine3DRadSpace.Content.ContentManager.Remove ( uint id)
inline

◆ RemoveAsset()

void ContentManager::RemoveAsset ( unsigned id)

Frees an asset from the ContentManager by its ID.

Parameters
idAsset ID

Member Data Documentation

◆ IAsset

Engine3DRadSpace.Content.ContentManager.IAsset

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