ReXGlue SDK
Loading...
Searching...
No Matches
rex::kernel::GuestVector< T > Struct Template Reference

#include <rex/kernel/types/memory.h>

Public Member Functions

size_t size () const
bool empty () const
const T * begin () const
const T * end () const
const T * begin (const rex::kernel::MemoryView &view) const
const T * end (const rex::kernel::MemoryView &view) const
const T & operator[] (size_t index) const
u32 GetAddress (size_t index) const
const T * TryAt (size_t index, const rex::kernel::MemoryView &view) const
std::optional< T > TryGet (size_t index, const rex::kernel::MemoryView &view) const
const T * TryAt (size_t index) const

Public Attributes

be_ptr< T > first
be_ptr< T > last
be_ptr< T > limit

Detailed Description

template<typename T>
struct rex::kernel::GuestVector< T >

Read only view of a guest std::vector, three guest pointers in the release build layout. The title owns the storage. A vector with an allocator or a debug member is not supported.

Template Parameters
TThe element type, laid out as the title stores it.

Member Function Documentation

◆ begin() [1/2]

template<typename T>
const T * rex::kernel::GuestVector< T >::begin ( ) const
inline

Resolves the first element through the guest memory of the calling thread.

Returns
The host pointer to the first element, null when the vector has no storage.

◆ begin() [2/2]

template<typename T>
const T * rex::kernel::GuestVector< T >::begin ( const rex::kernel::MemoryView & view) const
inline

Resolves the first element through a memory view, for a host thread with no bound runtime.

Returns
The host pointer to the first element, null when the vector has no storage.

◆ end() [1/2]

template<typename T>
const T * rex::kernel::GuestVector< T >::end ( ) const
inline

Resolves one past the last element through the guest memory of the calling thread.

Returns
The host pointer past the last element, null when the vector has no storage.

◆ end() [2/2]

template<typename T>
const T * rex::kernel::GuestVector< T >::end ( const rex::kernel::MemoryView & view) const
inline

Resolves one past the last element through a memory view, for a host thread with no bound runtime.

Returns
The host pointer past the last element, null when the vector has no storage.

◆ GetAddress()

template<typename T>
u32 rex::kernel::GuestVector< T >::GetAddress ( size_t index) const
inline

Returns the guest address of an element, 0 when the index is not below size().

◆ operator[]()

template<typename T>
const T & rex::kernel::GuestVector< T >::operator[] ( size_t index) const
inline

Returns an element through the guest memory of the calling thread without checking the index.

Parameters
indexThe element index, below size().

◆ size()

template<typename T>
size_t rex::kernel::GuestVector< T >::size ( ) const
inline
Returns
The number of elements, 0 when the pointers are null or out of order.

◆ TryAt() [1/2]

template<typename T>
const T * rex::kernel::GuestVector< T >::TryAt ( size_t index) const
inline

Resolves an element through the guest memory of the calling thread only when the title could read all of it.

Returns
The host pointer to the element, null when the index is not below size(), the element is misaligned, wraps the address space, is in no heap, has an unreadable page, or the calling thread has no runtime.

◆ TryAt() [2/2]

template<typename T>
const T * rex::kernel::GuestVector< T >::TryAt ( size_t index,
const rex::kernel::MemoryView & view ) const
inline

Resolves an element through a memory view only when the title could read all of it, for a host thread with no bound runtime.

Returns
The host pointer to the element, null when the index is not below size(), the element is misaligned, wraps the address space, is in no heap, or has an unreadable page.

◆ TryGet()

template<typename T>
std::optional< T > rex::kernel::GuestVector< T >::TryGet ( size_t index,
const rex::kernel::MemoryView & view ) const
inline

Reads a numeric element through a memory view only when the title could read all of it.

Parameters
indexThe element index.
viewThe memory view to read through.
Returns
The element in native byte order, nothing when the index is not below size(), the element wraps the address space, is in no heap, or has an unreadable page.

Member Data Documentation

◆ first

template<typename T>
be_ptr<T> rex::kernel::GuestVector< T >::first

Guest address of the first element.

◆ last

template<typename T>
be_ptr<T> rex::kernel::GuestVector< T >::last

Guest address one past the last element.

◆ limit

template<typename T>
be_ptr<T> rex::kernel::GuestVector< T >::limit

Guest address one past the allocated storage.


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