My Project
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
vspace::VRef< T > Struct Template Reference

#include <vspace.h>

Public Member Functions

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

Static Public Member Functions

static VRef< Tfrom_vaddr (internals::vaddr_t vaddr)
 
static VRef< Talloc (size_t n=1)
 

Private Member Functions

 VRef (internals::vaddr_t vaddr)
 

Private Attributes

internals::vaddr_t vaddr
 

Detailed Description

template<typename T>
struct vspace::VRef< T >

Definition at line 1747 of file vspace.h.

Constructor & Destructor Documentation

◆ VRef() [1/3]

template<typename T >
vspace::VRef< T >::VRef ( internals::vaddr_t  vaddr)
inlineprivate

Definition at line 1750 of file vspace.h.

1750 : vaddr(vaddr) {
1751 }
internals::vaddr_t vaddr
Definition: vspace.h:1749

◆ VRef() [2/3]

template<typename T >
vspace::VRef< T >::VRef ( )
inline

Definition at line 1753 of file vspace.h.

1754 }
const vaddr_t VADDR_NULL
Definition: vspace.h:1417

◆ VRef() [3/3]

template<typename T >
vspace::VRef< T >::VRef ( void *  ptr)
inline

Definition at line 1773 of file vspace.h.

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

Member Function Documentation

◆ alloc()

template<typename T >
static VRef< T > vspace::VRef< T >::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 }
STATIC_VAR jList * T
Definition: janet.cc:30
vaddr_t vmem_alloc(size_t size)
Definition: vspace.cc:808

◆ as_ptr()

template<typename T >
T * vspace::VRef< T >::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:1776

◆ as_ref()

template<typename T >
T & vspace::VRef< T >::as_ref ( ) const
inline

Definition at line 1782 of file vspace.h.

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

◆ cast()

template<typename T >
template<typename U >
VRef< U > vspace::VRef< T >::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

◆ free()

template<typename T >
void vspace::VRef< T >::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:756
T * as_ptr() const
Definition: vspace.h:1779

◆ from_vaddr()

template<typename T >
static VRef< T > vspace::VRef< T >::from_vaddr ( internals::vaddr_t  vaddr)
inlinestatic

Definition at line 1755 of file vspace.h.

1755 {
1756 return VRef(vaddr);
1757 }

◆ is_null()

template<typename T >
bool vspace::VRef< T >::is_null ( )
inline

Definition at line 1770 of file vspace.h.

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

◆ offset()

template<typename T >
size_t vspace::VRef< T >::offset ( ) const
inline

Definition at line 1758 of file vspace.h.

1758 {
1759 return vaddr;
1760 }

◆ operator bool()

template<typename T >
vspace::VRef< T >::operator bool ( ) const
inline

Definition at line 1767 of file vspace.h.

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

◆ operator!=()

template<typename T >
bool vspace::VRef< T >::operator!= ( VRef< T other)
inline

Definition at line 1764 of file vspace.h.

1764 {
1765 return vaddr != other.vaddr;
1766 }

◆ operator*()

template<typename T >
T & vspace::VRef< T >::operator* ( ) const
inline

Definition at line 1785 of file vspace.h.

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

◆ operator->()

template<typename T >
T * vspace::VRef< T >::operator-> ( )
inline

Definition at line 1788 of file vspace.h.

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

◆ operator=()

template<typename T >
VRef< T > & vspace::VRef< T >::operator= ( VRef< T other)
inline

Definition at line 1791 of file vspace.h.

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

◆ operator==()

template<typename T >
bool vspace::VRef< T >::operator== ( VRef< T other)
inline

Definition at line 1761 of file vspace.h.

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

◆ operator[]()

template<typename T >
T & vspace::VRef< T >::operator[] ( size_t  index)
inline

Definition at line 1795 of file vspace.h.

1795 {
1796 return as_ptr()[index];
1797 }
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592

◆ to_ptr()

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

Definition at line 1776 of file vspace.h.

1776 {
1778 }
static VMem & vmem
Definition: vspace.h:1635
void * to_ptr(vaddr_t vaddr)
Definition: vspace.h:1620

Field Documentation

◆ vaddr

template<typename T >
internals::vaddr_t vspace::VRef< T >::vaddr
private

Definition at line 1749 of file vspace.h.


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