My Project
Loading...
Searching...
No Matches
vspace::VRef< void > Struct Reference

#include <vspace.h>

Public Member Functions

 VRef ()
 
size_t offset () const
 
 operator bool () const
 
bool operator== (VRef< void > other)
 
bool operator!= (VRef< void > other)
 
bool is_null ()
 
 VRef (void *ptr)
 
void * to_ptr () const
 
void * as_ptr () const
 
VRef< void > & operator= (VRef< void > other)
 
template<typename U>
VRef< U > cast ()
 
void free ()
 
 VRef ()
 
 VRef (void *ptr)
 
size_t offset () const
 
bool operator== (VRef< void > other)
 
bool operator!= (VRef< void > other)
 
 operator bool () const
 
bool is_null ()
 
void * to_ptr () const
 
void * as_ptr () const
 
void & as_ref () const
 
void & operator* () const
 
void * operator-> ()
 
VRef< void > & operator= (VRef< void > other)
 
void & operator[] (size_t index)
 
VRef< U > cast ()
 
void free ()
 

Static Public Member Functions

static VRef< void > from_vaddr (internals::vaddr_t vaddr)
 
static VRef< void > alloc (size_t n=1)
 
static VRef< void > from_vaddr (internals::vaddr_t vaddr)
 
static VRef< void > alloc (size_t n=1)
 

Private Member Functions

 VRef (internals::vaddr_t vaddr)
 
 VRef (internals::vaddr_t vaddr)
 

Private Attributes

internals::vaddr_t vaddr
 
internals::vaddr_t vaddr
 

Detailed Description

Definition at line 1813 of file vspace.h.

Constructor & Destructor Documentation

◆ VRef() [1/6]

vspace::VRef< void >::VRef ( internals::vaddr_t vaddr)
inlineprivate

Definition at line 1816 of file vspace.h.

1816 : vaddr(vaddr) {
1817 }
internals::vaddr_t vaddr
Definition vspace.h:1815

◆ VRef() [2/6]

vspace::VRef< void >::VRef ( )
inline

Definition at line 1820 of file vspace.h.

◆ VRef() [3/6]

vspace::VRef< void >::VRef ( void * ptr)
inline

Definition at line 1840 of file vspace.h.

1840 {
1842 }
static vaddr_t allocated_ptr_to_vaddr(void *ptr)
Definition vspace.h:1697

◆ VRef() [4/6]

vspace::VRef< void >::VRef ( internals::vaddr_t vaddr)
inlineprivate

Definition at line 1750 of file vspace.h.

1750 : vaddr(vaddr) {
1751 }

◆ VRef() [5/6]

vspace::VRef< void >::VRef ( )
inline

Definition at line 1753 of file vspace.h.

1754 }

◆ VRef() [6/6]

vspace::VRef< void >::VRef ( void * ptr)
inline

Definition at line 1773 of file vspace.h.

Member Function Documentation

◆ alloc() [1/2]

static VRef< void > vspace::VRef< void >::alloc ( size_t n = 1)
inlinestatic

Definition at line 1802 of file vspace.h.

1802 {
1803 return VRef<T>(internals::vmem_alloc(n * sizeof(T)));
1804 }

◆ alloc() [2/2]

static VRef< void > vspace::VRef< void >::alloc ( size_t n = 1)
inlinestatic

Definition at line 1857 of file vspace.h.

1857 {
1859 }

◆ as_ptr() [1/2]

void * vspace::VRef< void >::as_ptr ( ) const
inline

Definition at line 1779 of file vspace.h.

1779 {
1780 return (T *) to_ptr();
1781 }
void * to_ptr() const
Definition vspace.h:1843

◆ as_ptr() [2/2]

void * vspace::VRef< void >::as_ptr ( ) const
inline

Definition at line 1846 of file vspace.h.

1846 {
1847 return (void *) to_ptr();
1848 }

◆ as_ref()

void & vspace::VRef< void >::as_ref ( ) const
inline

Definition at line 1782 of file vspace.h.

1782 {
1783 return *(T *) to_ptr();
1784 }

◆ cast() [1/2]

VRef< U > vspace::VRef< void >::cast ( )
inline

Definition at line 1799 of file vspace.h.

1799 {
1800 return VRef<U>::from_vaddr(vaddr);
1801 }
static VRef< T > from_vaddr(internals::vaddr_t vaddr)
Definition vspace.h:1755

◆ cast() [2/2]

template<typename U>
VRef< U > vspace::VRef< void >::cast ( )
inline

Definition at line 1854 of file vspace.h.

1854 {
1855 return VRef<U>::from_vaddr(vaddr);
1856 }

◆ free() [1/2]

void vspace::VRef< void >::free ( )
inline

Definition at line 1805 of file vspace.h.

1805 {
1806 as_ptr()->~T(); // explicitly call destructor
1809 }
void vmem_free(vaddr_t vaddr)
Definition vspace.cc:802
void * as_ptr() const
Definition vspace.h:1846

◆ free() [2/2]

void vspace::VRef< void >::free ( )
inline

Definition at line 1860 of file vspace.h.

1860 {
1863 }

◆ from_vaddr() [1/2]

static VRef< void > vspace::VRef< void >::from_vaddr ( internals::vaddr_t vaddr)
inlinestatic

Definition at line 1755 of file vspace.h.

1755 {
1756 return VRef(vaddr);
1757 }

◆ from_vaddr() [2/2]

static VRef< void > vspace::VRef< void >::from_vaddr ( internals::vaddr_t vaddr)
inlinestatic

Definition at line 1822 of file vspace.h.

1822 {
1823 return VRef(vaddr);
1824 }

◆ is_null() [1/2]

bool vspace::VRef< void >::is_null ( )
inline

Definition at line 1770 of file vspace.h.

1770 {
1771 return vaddr == internals::VADDR_NULL;
1772 }

◆ is_null() [2/2]

bool vspace::VRef< void >::is_null ( )
inline

Definition at line 1837 of file vspace.h.

1837 {
1838 return vaddr == internals::VADDR_NULL;
1839 }

◆ offset() [1/2]

size_t vspace::VRef< void >::offset ( ) const
inline

Definition at line 1758 of file vspace.h.

1758 {
1759 return vaddr;
1760 }

◆ offset() [2/2]

size_t vspace::VRef< void >::offset ( ) const
inline

Definition at line 1825 of file vspace.h.

1825 {
1826 return vaddr;
1827 }

◆ operator bool() [1/2]

vspace::VRef< void >::operator bool ( ) const
inline

Definition at line 1767 of file vspace.h.

1767 {
1768 return vaddr != internals::VADDR_NULL;
1769 }

◆ operator bool() [2/2]

vspace::VRef< void >::operator bool ( ) const
inline

Definition at line 1828 of file vspace.h.

1828 {
1829 return vaddr != internals::VADDR_NULL;
1830 }

◆ operator!=() [1/2]

bool vspace::VRef< void >::operator!= ( VRef< void > other)
inline

Definition at line 1764 of file vspace.h.

1764 {
1765 return vaddr != other.vaddr;
1766 }
internals::vaddr_t vaddr
Definition vspace.h:1749

◆ operator!=() [2/2]

bool vspace::VRef< void >::operator!= ( VRef< void > other)
inline

Definition at line 1834 of file vspace.h.

1834 {
1835 return vaddr != other.vaddr;
1836 }

◆ operator*()

void & vspace::VRef< void >::operator* ( ) const
inline

Definition at line 1785 of file vspace.h.

1785 {
1786 return *(T *) to_ptr();
1787 }

◆ operator->()

void * vspace::VRef< void >::operator-> ( )
inline

Definition at line 1788 of file vspace.h.

1788 {
1789 return (T *) to_ptr();
1790 }

◆ operator=() [1/2]

VRef< void > & vspace::VRef< void >::operator= ( VRef< void > other)
inline

Definition at line 1791 of file vspace.h.

1791 {
1792 vaddr = other.vaddr;
1793 return *this;
1794 }

◆ operator=() [2/2]

VRef< void > & vspace::VRef< void >::operator= ( VRef< void > other)
inline

Definition at line 1849 of file vspace.h.

1849 {
1850 vaddr = other.vaddr;
1851 return *this;
1852 }

◆ operator==() [1/2]

bool vspace::VRef< void >::operator== ( VRef< void > other)
inline

Definition at line 1761 of file vspace.h.

1761 {
1762 return vaddr == other.vaddr;
1763 }

◆ operator==() [2/2]

bool vspace::VRef< void >::operator== ( VRef< void > other)
inline

Definition at line 1831 of file vspace.h.

1831 {
1832 return vaddr == other.vaddr;
1833 }

◆ operator[]()

void & vspace::VRef< void >::operator[] ( size_t index)
inline

Definition at line 1795 of file vspace.h.

1795 {
1796 return as_ptr()[index];
1797 }

◆ to_ptr() [1/2]

void * vspace::VRef< void >::to_ptr ( ) const
inline

Definition at line 1776 of file vspace.h.

1776 {
1778 }
void * to_ptr() const
Definition vspace.h:1776

◆ to_ptr() [2/2]

void * vspace::VRef< void >::to_ptr ( ) const
inline

Definition at line 1843 of file vspace.h.

1843 {
1845 }

Field Documentation

◆ vaddr [1/2]

internals::vaddr_t vspace::VRef< void >::vaddr
private

Definition at line 1749 of file vspace.h.

◆ vaddr [2/2]

internals::vaddr_t vspace::VRef< void >::vaddr
private

Definition at line 1815 of file vspace.h.


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