Skip to content

ludus::platform::HostedImageHandle

Ludus Wiki · API overview · Browse API

Class

Owning operating-system handle of one hosted image.
Move-only. Destruction or Reset() releases what it owns: a Mach send right is deallocated with mach_port_deallocate, a file descriptor is closed. The Release calls give ownership back to the caller without releasing anything. Not synchronized; one owner at a time.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

#include <ludus/platform/hosted_surface.h>
class ludus::platform::HostedImageHandle final

Methods

HostedImageHandle

ludus::platform::HostedImageHandle::HostedImageHandle() noexcept=default
Construct an empty handle.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

~HostedImageHandle

ludus::platform::HostedImageHandle::~HostedImageHandle() noexcept
Release the owned handle, if any.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

HostedImageHandle

ludus::platform::HostedImageHandle::HostedImageHandle(const HostedImageHandle &)=delete
Not copyable: a handle has exactly one owner.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

operator=

HostedImageHandle & ludus::platform::HostedImageHandle::operator=(const HostedImageHandle &)=delete
Not copyable: a handle has exactly one owner.

Related types: HostedImageHandle

Declared in modules/platform/include/ludus/platform/hosted_surface.h

HostedImageHandle

ludus::platform::HostedImageHandle::HostedImageHandle(HostedImageHandle &&other) noexcept
Take the handle of other, leaving it empty.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

operator=

HostedImageHandle & ludus::platform::HostedImageHandle::operator=(HostedImageHandle &&other) noexcept
Release this handle and take the handle of other, leaving it empty.

Related types: HostedImageHandle

Declared in modules/platform/include/ludus/platform/hosted_surface.h

GetKind

LUDUS_INLINE HostedHandleKind ludus::platform::HostedImageHandle::GetKind() const noexcept
Kind of the owned handle; None when empty.

Related types: HostedHandleKind

Declared in modules/platform/include/ludus/platform/hosted_surface.h

IsValid

LUDUS_INLINE bool ludus::platform::HostedImageHandle::IsValid() const noexcept
True when a handle is owned.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

GetMachPort

LUDUS_INLINE foundation::uint32 ludus::platform::HostedImageHandle::GetMachPort() const noexcept
The owned Mach send right (borrowed), or zero.

Related types: foundation::uint32

Declared in modules/platform/include/ludus/platform/hosted_surface.h

GetFileDescriptor

LUDUS_INLINE foundation::int32 ludus::platform::HostedImageHandle::GetFileDescriptor() const noexcept
The owned file descriptor (borrowed), or -1.

Related types: foundation::int32

Declared in modules/platform/include/ludus/platform/hosted_surface.h

ReleaseMachPort

foundation::uint32 ludus::platform::HostedImageHandle::ReleaseMachPort() noexcept
Give the Mach send right to the caller and leave this handle empty.

Returns

The send right, or zero when this handle holds no Mach port.

Related types: foundation::uint32

Declared in modules/platform/include/ludus/platform/hosted_surface.h

ReleaseFileDescriptor

foundation::int32 ludus::platform::HostedImageHandle::ReleaseFileDescriptor() noexcept
Give the file descriptor to the caller and leave this handle empty.

Returns

The descriptor, or -1 when this handle holds no file descriptor.

Related types: foundation::int32

Declared in modules/platform/include/ludus/platform/hosted_surface.h

Reset

void ludus::platform::HostedImageHandle::Reset() noexcept
Release the owned handle, if any, and become empty.

Declared in modules/platform/include/ludus/platform/hosted_surface.h

Static methods

FromMachPort

static HostedImageHandle ludus::platform::HostedImageHandle::FromMachPort(foundation::uint32 sendRight) noexcept
Take ownership of one Mach send right.
ParameterDescription
sendRight
A mach_port_t send right owned by the caller; zero yields an empty handle.

Related types: HostedImageHandle · foundation::uint32

Declared in modules/platform/include/ludus/platform/hosted_surface.h

FromFileDescriptor

static HostedImageHandle ludus::platform::HostedImageHandle::FromFileDescriptor(foundation::int32 descriptor) noexcept
Take ownership of one open file descriptor.
ParameterDescription
descriptor
A descriptor owned by the caller; a negative value yields an empty handle.

Related types: HostedImageHandle · foundation::int32

Declared in modules/platform/include/ludus/platform/hosted_surface.h