GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::execution::ResourceTable< ResourcesOrPointers > Class Template Reference

Container of a specific tuple of singleton resource types, available to tasks defined through a Scheduler. More...

#include <GREM/execution/ResourceTable.hpp>

Inheritance diagram for grem::execution::ResourceTable< ResourcesOrPointers >:

Public Member Functions

template<resource T>
constexpr bool hasResource () const noexcept
 Check if the table contains a specific resource.
template<resource T>
constexpr T & getResource ()
 Get a specific resource in the table.
template<resource T>
constexpr const T & getResource () const
 Get a specific resource in the table.
template<resource T>
constexpr T * findResource () noexcept
 Try to get a specific resource in the table.
template<resource T>
constexpr const T * findResource () const noexcept
 Try to get a specific resource in the table.
constexpr Tuple (const Tuple &)=default
constexpr Tuple (Tuple &&) noexcept((std::is_nothrow_move_constructible_v< Ts > &&... &&true))=default

Detailed Description

template<typename... ResourcesOrPointers>
class grem::execution::ResourceTable< ResourcesOrPointers >

Container of a specific tuple of singleton resource types, available to tasks defined through a Scheduler.

This container can be used as a simpler and more performant alternative to ResourceRegistry when the full set of resource types is known at compile time.

Template Parameters
ResourcesOrPointersresource types, or pointers to external resources, to store in the table.
See also
ResourceRegistry

Member Function Documentation

◆ hasResource()

template<typename... ResourcesOrPointers>
template<resource T>
bool grem::execution::ResourceTable< ResourcesOrPointers >::hasResource ( ) const
inlinenodiscardconstexprnoexcept

Check if the table contains a specific resource.

Template Parameters
Tresource type to check for.
Returns
true if the table contains a resource of the specified type, false otherwise.

◆ getResource() [1/2]

template<typename... ResourcesOrPointers>
template<resource T>
T & grem::execution::ResourceTable< ResourcesOrPointers >::getResource ( )
inlinenodiscardconstexpr

Get a specific resource in the table.

Template Parameters
Tresource type to get. Must be one of the resource types contained in the table.
Returns
a reference to the specified resource.

◆ getResource() [2/2]

template<typename... ResourcesOrPointers>
template<resource T>
const T & grem::execution::ResourceTable< ResourcesOrPointers >::getResource ( ) const
inlinenodiscardconstexpr

Get a specific resource in the table.

Template Parameters
Tresource type to get. Must be one of the resource types contained in the table.
Returns
a read-only reference to the specified resource.

◆ findResource() [1/2]

template<typename... ResourcesOrPointers>
template<resource T>
T * grem::execution::ResourceTable< ResourcesOrPointers >::findResource ( )
inlinenodiscardconstexprnoexcept

Try to get a specific resource in the table.

Template Parameters
Tresource type to get.
Returns
a pointer to the specified resource, or nullptr if the table does not contain a resource of the specified type.

◆ findResource() [2/2]

template<typename... ResourcesOrPointers>
template<resource T>
const T * grem::execution::ResourceTable< ResourcesOrPointers >::findResource ( ) const
inlinenodiscardconstexprnoexcept

Try to get a specific resource in the table.

Template Parameters
Tresource type to get.
Returns
a read-only pointer to the specified resource, or nullptr if the table does not contain a resource of the specified type.

◆ Tuple() [1/2]

template<typename... ResourcesOrPointers>
grem::Tuple< Ts >::Tuple ( const Tuple & )
constexprdefault

◆ Tuple() [2/2]

template<typename... ResourcesOrPointers>
grem::Tuple< Ts >::Tuple ( Tuple && )
constexprdefaultnoexcept

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