Concrete Python  git-339c971
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions
Pointer Class Reference

#include <concrete/pointer.hpp>

+ Inheritance diagram for Pointer:
+ Collaboration diagram for Pointer:

List of all members.

Classes

struct  RawAccess

Public Member Functions

 Pointer () throw ()
 Pointer (const Pointer &other) throw ()
void operator= (const Pointer &other) throw ()
bool operator== (const Pointer &other) const throw ()
bool operator!= (const Pointer &other) const throw ()
 operator bool () const throw ()
bool operator! () const throw ()
template<typename PointerType >
PointerType cast () const throw ()
unsigned int address () const throw ()

Protected Member Functions

 Pointer (unsigned int address) throw ()
void reset_address (unsigned int address) throw ()
template<typename DataType >
DataType * data_cast () const
template<typename DataType >
DataType * nonthrowing_data_cast () const throw ()
template<typename DataType >
void extend_data_access (size_t extension_size) const
template<typename DataType >
bool nonthrowing_extend_data_access (size_t extension_size) const throw ()

Static Protected Member Functions

template<typename PointerType , typename... Args>
static PointerType NewPointer (Args...args)
template<typename PointerType , typename... Args>
static PointerType NewCustomSizePointer (size_t size, Args...args)
template<typename PointerType >
static void DestroyPointer (PointerType &pointer) throw ()
template<typename DataType >
static void DestroyData (unsigned int address, DataType *data) throw ()
template<typename PointerType >
static void DestroyExtendedPointer (PointerType &pointer, typename PointerType::Data *data, size_t extension_size) throw ()
template<typename DataType >
static void DestroyExtendedData (unsigned int address, DataType *data, size_t extension_size) throw ()
template<typename DataType >
static DataType * DataCast (unsigned int address)
template<typename DataType >
static DataType * NonthrowingDataCast (unsigned int address) throw ()
template<typename DataType >
static void ExtendDataAccess (unsigned int address, size_t extension_size)
template<typename DataType >
static bool NonthrowingExtendDataAccess (unsigned int address, size_t extension_size) throw ()

Detailed Description

Indirect pointer to arena memory. Non-abstract subclasses must declare a nested Data struct which represents the memory allocation. Data destructors must be non-throwing.


Constructor & Destructor Documentation

Pointer ( ) throw ()

Null pointer.

Pointer ( const Pointer other) throw ()

Another reference.

Pointer ( unsigned int  address) throw () [explicit, protected]

Reference to the memory block at an explicit arena offset.


Member Function Documentation

unsigned int address ( ) const throw ()
Returns:
offset in arena memory or 0 if null pointer
PointerType cast ( ) const throw ()

Get a typed reference.

DataType * data_cast ( ) const [protected]

Direct typed arena memory access to the fixed-size block.

Returns:
borrowed short-term reference
Exceptions:
IntegrityError
DataType * DataCast ( unsigned int  address) [static, protected]

Direct typed arena memory access to a fixed-size block.

Returns:
borrowed short-term reference
Exceptions:
IntegrityError
void DestroyData ( unsigned int  address,
DataType *  data 
) throw () [static, protected]

Delete an instance.

Parameters:
addressmust not be 0
datamust be a valid direct pointer to arena memory corresponding to address
void DestroyExtendedData ( unsigned int  address,
DataType *  data,
size_t  extension_size 
) throw () [static, protected]

Delete an instance with extended data type.

Parameters:
addressmust not be 0
datamust be a valid direct pointer to arena memory corresponding to address
extension_sizedoesn't include the DataType size
void DestroyExtendedPointer ( PointerType &  pointer,
typename PointerType::Data *  data,
size_t  extension_size 
) throw () [static, protected]

Delete a PointerType instance with extended data type. The reference will be reset to null.

Parameters:
pointermay be null
datamust be a valid direct pointer to arena memory corresponding to pointer
extension_sizedoesn't include the Data struct size
void DestroyPointer ( PointerType &  pointer) throw () [static, protected]

Delete a PointerType instance. The reference will be reset to null.

Parameters:
pointermay be null
void extend_data_access ( size_t  extension_size) const [protected]

Extend previously aquired access to the arena memory block.

Parameters:
extension_sizedoesn't include the DataType size
Exceptions:
IntegrityError
void ExtendDataAccess ( unsigned int  address,
size_t  extension_size 
) [static, protected]

Extend an already aquired access to an arena memory block.

Parameters:
extension_sizedoesn't include the DataType size
Exceptions:
IntegrityError
PointerType NewCustomSizePointer ( size_t  size,
Args...  args 
) [static, protected]

Create a PointerType instance.

Parameters:
sizeof the memory allocation for extended data types (including the Data struct size)
Returns:
ownership
Exceptions:
AllocationError
...
PointerType NewPointer ( Args...  args) [static, protected]

Create a PointerType instance.

Returns:
ownership
Exceptions:
AllocationError
...
DataType * nonthrowing_data_cast ( ) const throw () [protected]

Direct typed arena memory access to the fixed-size block.

Returns:
borrowed short-term reference or NULL
bool nonthrowing_extend_data_access ( size_t  extension_size) const throw () [protected]

Extend previously aquired access to the arena memory block.

Parameters:
extension_sizedoesn't include the DataType size
Returns:
true on success
DataType * NonthrowingDataCast ( unsigned int  address) throw () [static, protected]

Direct typed arena memory access to a fixed-size block.

Returns:
borrowed short-term reference or NULL
bool NonthrowingExtendDataAccess ( unsigned int  address,
size_t  extension_size 
) throw () [static, protected]

Extend an already aquired access to an arena memory block.

Parameters:
extension_sizedoesn't include the DataType size
Returns:
true on success
operator bool ( ) const throw ()
Returns:
true if not a null pointer

Reimplemented in Object.

bool operator! ( ) const throw ()
Returns:
true if a null pointer

Reimplemented in Object.

bool operator!= ( const Pointer other) const throw ()

Memory address comparison.

void operator= ( const Pointer other) throw ()

Replace the reference.

bool operator== ( const Pointer other) const throw ()

Memory address comparison.

void reset_address ( unsigned int  address) throw () [protected]

Replace the reference.