Skip to main content

ResourceRegistry Class

Unified type-indexed registry for all engine resources. More...

Declaration

class helios::engine::runtime::world::ResourceRegistry { ... }

Public Member Functions Index

template <class T, class... Args>
T &emplace (Args &&... args)

Registers and constructs a resource of type T. More...

template <class T>
boolhas () const noexcept

Checks if a resource of type T is registered. More...

template <class T>
T *tryGet () const noexcept

Retrieves a registered resource by type. More...

template <class T>
T &get () const noexcept

Retrieves a registered resource by type (checked). More...

std::span< Manager *const >managers () const noexcept

Returns a read-only span of all registered Managers. More...

std::span< Manager * >managers () noexcept

Returns a read-only span of all registered Managers. More...

std::span< CommandBuffer *const >commandBuffers () const noexcept

Returns a read-only span of all registered CommandBuffers. More...

std::span< CommandBuffer * >commandBuffers () noexcept

Returns a read-only span of all registered CommandBuffers. More...

CommandBufferRegistry &commandBufferRegistry () noexcept

Returns direct access to the underlying command-buffer registry. More...

Private Member Attributes Index

ManagerRegistrymanagerRegistry_

Registry for Manager instances. More...

CommandBufferRegistrycommandBufferRegistry_

Registry for CommandBuffer instances. More...

Description

Unified type-indexed registry for all engine resources.

ResourceRegistry acts as the central access point for Managers and CommandBuffers. It delegates to a ManagerRegistry and a CommandBufferRegistry internally, routing registration and lookup based on compile-time concept checks (IsManagerLike / IsCommandBufferLike).

See Also

ManagerRegistry

See Also

CommandBufferRegistry

See Also

GameWorld

Definition at line 49 of file ResourceRegistry.ixx.

Public Member Functions

commandBufferRegistry()

CommandBufferRegistry & helios::engine::runtime::world::ResourceRegistry::commandBufferRegistry ()
inline noexcept

Returns direct access to the underlying command-buffer registry.

Returns

Reference to the internal CommandBufferRegistry.

Definition at line 195 of file ResourceRegistry.ixx.

196 return commandBufferRegistry_;
197 }

Referenced by helios::engine::runtime::world::GameWorld::commandBufferRegistry.

commandBuffers()

std::span< CommandBuffer *const > helios::engine::runtime::world::ResourceRegistry::commandBuffers ()
inline noexcept

Returns a read-only span of all registered CommandBuffers.

Returns

Span of CommandBuffer pointers in registration order.

Definition at line 179 of file ResourceRegistry.ixx.

179 std::span<CommandBuffer* const> commandBuffers() const noexcept {
180 return commandBufferRegistry_.items();
181 }

Reference helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::items.

Referenced by helios::engine::runtime::world::GameWorld::flushCommandBuffers and helios::engine::runtime::world::GameWorld::init.

commandBuffers()

std::span< CommandBuffer * > helios::engine::runtime::world::ResourceRegistry::commandBuffers ()
inline noexcept

Returns a read-only span of all registered CommandBuffers.

Returns

Span of CommandBuffer pointers in registration order.

Definition at line 186 of file ResourceRegistry.ixx.

186 std::span<CommandBuffer*> commandBuffers() noexcept {
187 return commandBufferRegistry_.items();
188 }

Reference helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::items.

emplace()

template <class T, class... Args>
T & helios::engine::runtime::world::ResourceRegistry::emplace (Args &&... args)
inline

Registers and constructs a resource of type T.

Routes to ManagerRegistry or CommandBufferRegistry based on whether T satisfies IsManagerLike or IsCommandBufferLike. The resource is constructed in-place with forwarded arguments.

Template Parameters
T

The resource type. Must satisfy IsManagerLike or IsCommandBufferLike.

Args

Constructor argument types.

Parameters
args

Arguments forwarded to the T constructor.

Returns

Reference to the newly registered resource.

Definition at line 79 of file ResourceRegistry.ixx.

79 T& emplace(Args&&... args) {
80
81 if constexpr (IsManagerLike<T>) {
82 return managerRegistry_.template add<T>(std::forward<Args>(args)...);
83 }
84
85 if constexpr (IsCommandBufferLike<T>) {
86 return commandBufferRegistry_.template add<T>(std::forward<Args>(args)...);
87 }
88
89 assert(false);
90 }

Reference helios::engine::runtime::registerComponents.

Referenced by helios::engine::runtime::world::GameWorld::registerCommandBuffer and helios::engine::runtime::world::GameWorld::registerManager.

get()

template <class T>
T & helios::engine::runtime::world::ResourceRegistry::get ()
inline noexcept

Retrieves a registered resource by type (checked).

Asserts that the resource is registered before returning.

Template Parameters
T

The resource type.

Returns

Reference to the resource.

Precondition

The resource must be registered.

Definition at line 145 of file ResourceRegistry.ixx.

146 assert(has<T>() && "Resource not found");
147 if constexpr (IsManagerLike<T>) {
148 return *managerRegistry_.item<T>();
149 }
150
151 if constexpr (IsCommandBufferLike<T>) {
152 return *commandBufferRegistry_.item<T>();
153 }
154
155 assert(false);
156 }

References helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::item and helios::engine::runtime::registerComponents.

Referenced by helios::engine::runtime::world::GameWorld::commandBuffer, helios::engine::runtime::world::GameWorld::init and helios::engine::runtime::world::GameWorld::manager.

has()

template <class T>
bool helios::engine::runtime::world::ResourceRegistry::has ()
inline noexcept

Checks if a resource of type T is registered.

Template Parameters
T

The resource type.

Returns

True if the resource is registered.

Definition at line 100 of file ResourceRegistry.ixx.

101 if constexpr (IsManagerLike<T>) {
102 return managerRegistry_.has<T>();
103 }
104
105 if constexpr (IsCommandBufferLike<T>) {
106 return commandBufferRegistry_.has<T>();
107 }
108
109 return false;
110 }

References helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::has and helios::engine::runtime::registerComponents.

Referenced by helios::engine::runtime::world::GameWorld::hasCommandBuffer, helios::engine::runtime::world::GameWorld::hasManager and helios::engine::runtime::world::GameWorld::manager.

managers()

std::span< Manager *const > helios::engine::runtime::world::ResourceRegistry::managers ()
inline noexcept

Returns a read-only span of all registered Managers.

Returns

Span of Manager pointers in registration order.

Definition at line 163 of file ResourceRegistry.ixx.

163 [[nodiscard]] std::span<Manager* const> managers() const noexcept {
164 return managerRegistry_.items();
165 }

Reference helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::items.

Referenced by helios::engine::runtime::world::GameWorld::flushManagers, helios::engine::runtime::world::GameWorld::init and helios::engine::runtime::world::GameWorld::reset.

managers()

std::span< Manager * > helios::engine::runtime::world::ResourceRegistry::managers ()
inline noexcept

Returns a read-only span of all registered Managers.

Returns

Span of Manager pointers in registration order.

Definition at line 170 of file ResourceRegistry.ixx.

170 std::span<Manager*> managers() noexcept {
171 return managerRegistry_.items();
172 }

Reference helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::items.

tryGet()

template <class T>
T * helios::engine::runtime::world::ResourceRegistry::tryGet ()
inline noexcept

Retrieves a registered resource by type.

Template Parameters
T

The resource type.

Returns

Pointer to the resource, or nullptr if not registered.

Definition at line 120 of file ResourceRegistry.ixx.

121 if constexpr (IsManagerLike<T>) {
122 return managerRegistry_.item<T>();
123 }
124
125 if constexpr (IsCommandBufferLike<T>) {
126 return commandBufferRegistry_.item<T>();
127 }
128
129 return nullptr;
130 }

References helios::engine::core::container::ConceptModelRegistry< AnyT, IdProvider >::item and helios::engine::runtime::registerComponents.

Referenced by helios::engine::runtime::world::GameWorld::init, helios::engine::runtime::world::GameWorld::tryCommandBuffer and helios::engine::runtime::world::GameWorld::tryManager.

Private Member Attributes

commandBufferRegistry_

CommandBufferRegistry helios::engine::runtime::world::ResourceRegistry::commandBufferRegistry_

Registry for CommandBuffer instances.

Definition at line 59 of file ResourceRegistry.ixx.

59 CommandBufferRegistry commandBufferRegistry_;

managerRegistry_

ManagerRegistry helios::engine::runtime::world::ResourceRegistry::managerRegistry_

Registry for Manager instances.

Definition at line 54 of file ResourceRegistry.ixx.

54 ManagerRegistry managerRegistry_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.