MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
Mezzanine::IntHandle Class Reference

Sample implementation for a ManagedPtr. More...

#include <managedptr.h>

Public Types

typedef int * TargetPtrType
 This is type ManagedPtr will use to work with a handle.
 
typedef int TargetType
 The Type this handle is pointer at.
 

Public Member Functions

void Construct ()
 This is expected to leave Pointer in some valid state for dereferencing.
 
void Deconstruct ()
 This can perform any cleanup, but should not fail if Pointer is NULL. More...
 
TargetPtrType GetPointer ()
 This is what the ManagedPtr with use for dereferencing. More...
 
void SetPointer (TargetPtrType Value)
 This is what ManagedPtr will use in copy and assignment operations as well as invaliding handles. More...
 

Public Attributes

TargetPtrType Pointer
 The ManagedPtr never access objects directly, so this is just an implementation detail.
 

Detailed Description

Sample implementation for a ManagedPtr.

This one is pretty useless, and serves as just an example. Any class that implements at least the member function this implements can be used with the ManagedPtr to get smart pointer semantics.

Definition at line 56 of file managedptr.h.

Member Function Documentation

void Mezzanine::IntHandle::Deconstruct ( )
inline

This can perform any cleanup, but should not fail if Pointer is NULL.

Copying or assigning a ManagedPtr just changes which instance of the ManagedPtr will cleanup Ptr. This movement of ownership allows passing or returning ManagedPtr by value or putting it in a standard container. Only the most recent copy will delete the target and none of the earlier copies will. This also stops the target from being deleted multiple times.

Definition at line 77 of file managedptr.h.

TargetPtrType Mezzanine::IntHandle::GetPointer ( )
inline

This is what the ManagedPtr with use for dereferencing.

Returns
The pointer to the managed data. This is expected to return a value that resolves to false when used as a condition when invalid.

Definition at line 86 of file managedptr.h.

void Mezzanine::IntHandle::SetPointer ( TargetPtrType  Value)
inline

This is what ManagedPtr will use in copy and assignment operations as well as invaliding handles.

Parameters
ValueThe new value for the pointer. If NULL the only thing that the ManagedPtr will do to the handle is call its deconstruct method.

Definition at line 82 of file managedptr.h.


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