virtmem
virtual memory library for Arduino
|
This is the base class of VPtr and can be used for typeless pointers. More...
#include <base_vptr.h>
Public Types | |
typedef private_utils::Conditional<(sizeof(intptr_t) > sizeof(VPtrNum)), intptr_t, VPtrNum >::type | PtrNum |
Platform dependent numeric type to store raw (virtual/regular) pointer addresses. | |
Public Member Functions | |
BaseVPtr (NILL_t) | |
Construct from NILL/nullptr (C++11 only) | |
bool | isWrapped (void) const |
Returns whether a virtual pointer has wrapped a regular pointer (non static version). More... | |
PtrNum | getRawNum (void) const |
Returns a numeric representation of this virtual pointer. More... | |
void | setRawNum (PtrNum p) |
Sets a virtual pointer from a numeric value. More... | |
void * | unwrap (const BaseVPtr &p) |
Provide access to wrapped regular pointer. More... | |
void * | unwrap (void) |
Provide access to wrapped regular pointer (non static version). More... | |
const void * | unwrap (void) const |
Provide access to wrapped regular pointer (non static const version). More... | |
template<typename T , typename A > | |
VIRTMEM_EXPLICIT | operator VPtr< T, A > (void) const |
Conversion operator to VPtr types. | |
Pointer comparison operators. | |
The following operators are used for comparing two virtual pointers. Comparing two wrapped regulared pointers is supported. Comparing wrapped and non wrapped pointers is undefined. | |
bool | operator== (const BaseVPtr &pb) const |
bool | operator!= (const BaseVPtr &pb) const |
bool | operator< (const BaseVPtr &pb) const |
bool | operator<= (const BaseVPtr &pb) const |
bool | operator>= (const BaseVPtr &pb) const |
bool | operator> (const BaseVPtr &pb) const |
Static Public Member Functions | |
static PtrNum | getWrapped (PtrNum p) |
Returns raw address of regular pointer wrapped by a virtual pointer. More... | |
static bool | isWrapped (PtrNum p) |
Returns whether a virtual pointer has wrapped a regular pointer. More... | |
static BaseVPtr | wrap (const void *p) |
Wraps a regular pointer. More... | |
Protected Attributes | |
PtrNum | ptr |
Numeric representation of this virtual pointer. | |
Friends | |
template<typename , typename > | |
class | VPtr |
template<typename > | |
class | VPtrLock |
Pointer validity checking operators. | |
The following operators can be used to see whether a virtual pointer is valid (i.e. is not | |
bool | operator== (const NILL_t &, const BaseVPtr &pw) |
bool | operator!= (const NILL_t &, const BaseVPtr &pw) |
bool | operator== (const NILL_t &) const |
bool | operator!= (const NILL_t &) const |
operator TSafeBool (void) const | |
Allows if (myvirtptr) ... expressions. | |
This is the base class of VPtr and can be used for typeless pointers.
This base class contains all the functionality of virtual pointers which do not depend on any templated code to reduce code size. This class is designed in such a way that it can be treated mostly as 'plain old data' (POD) and can therefore be used in an union
as well.
This class can be used for 'typeless' virtual pointers, similar as void* is used for 'regular' typeless pointers.
|
inline |
Returns a numeric representation of this virtual pointer.
This function can be used to convert virtual pointers to numeric values.
Returns raw address of regular pointer wrapped by a virtual pointer.
p | Numeric value of the virtual pointer |
|
inlinestatic |
Returns whether a virtual pointer has wrapped a regular pointer.
p | Numeric value of the virtual pointer |
|
inline |
Returns whether a virtual pointer has wrapped a regular pointer (non static version).
|
inline |
Sets a virtual pointer from a numeric value.
p | The raw numeric representation of a virtual pointer. |
|
inline |
Provide access to wrapped regular pointer.
p | virtual pointer that wraps a regular pointer |
|
inline |
Provide access to wrapped regular pointer (non static version).
|
inline |
Provide access to wrapped regular pointer (non static const version).
|
inlinestatic |
Wraps a regular pointer.