Class Handle

Class Documentation

class Handle

Declaration: final

Move-only native-object registration; destruction queues retirement without OpenGL calls.

Public Functions

Handle() = default

Create an empty logical registration; id() rejects it, resource_domain() returns null.

Handle(std::shared_ptr<::CE::Rendering::OpenGL::ResourceLifetime> lifetime, ::CE::Rendering::OpenGL::ResourceKind kind, NativeHandle id)

Adopt a native object through a retained live lifetime.

Parameters:
  • lifetime – Required domain whose owner/current context is active.

  • kind – Matching native object family.

  • id – Nonzero untracked native name. Null lifetime throws invalid_args; track() validation/allocation errors propagate. If construction fails before adoption, the creator still owns untracked cleanup.

inline ~Handle()

Queue this registration for retirement and release the lifetime reference; performs no native calls and may run off the context owner.

Handle(const Handle&) = delete
Handle &operator=(const Handle&) = delete
Handle(Handle &&other) noexcept

Transfer the registration without native calls; other becomes empty and no longer retires the transferred object.

Handle &operator=(Handle &&other) noexcept

Retire the destination’s previous registration and take the source registration.

Returns:

This handle; self-move preserves it. No OpenGL calls occur, and a moved source becomes empty.

NativeHandle id() const

Declaration: [[nodiscard]]

Throws:

CE::Exceptions::failed_operation – For empty, stopped, foreign-thread or noncurrent use. A logical retained handle alone does not authorize native access.

Returns:

Native name after requiring this registration’s live owner/current context.

inline ::CE::Rendering::OpenGL::ResourceKind kind() const noexcept

Declaration: [[nodiscard]]

Returns:

Stored deletion family without native validation; for an empty/moved-from handle this is metadata only.

inline const ::CE::Rendering::OpenGL::ResourceLifetime *resource_domain() const noexcept

Declaration: [[nodiscard]]

Returns:

Borrowed domain identity, or null for an empty/moved-from handle. This does not check activity, thread or current context; keep the handle/lifetime retained while comparing it.