#include <pointer.h>
Public Methods | |
| Pointer () | |
| Pointer (const Pointer &that) | |
| Pointer (void *that, int size=0) | |
| Pointer (int size) | |
| ~Pointer () | |
| Pointer & | operator= (const Pointer &that) |
| Pointer & | operator= (void *that) |
| void | attach (void *that, int size=0) |
| void | copyFrom (const Pointer &that) |
| void | copyFrom (const void *that, int size) |
| void | grow (int size) |
| void | clear () |
| int | refcount () const |
| int | size () const |
| template<class T> | operator T * () const |
| void | detach () |
Public Attributes | |
| void * | memory |
| Pointer to block in heap. Must cast as needed. | |
| int | metaData |
Protected Methods | |
| void | attach (const Pointer &that) |
| void | allocate (int size) |
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
This method is protected because it assumes that we aren't responsible for our memory. We must guarantee that we don't own memory when this method is called. This is true just after a call to detach, as well as a few other situations. |
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pointer to block in heap. Must cast as needed.
|
|
|
metaData < 0 indicates memory is a special pointer we constructed. There is meta data associated with the pointer, and all "smart" pointer functions are available. This is the only time that we can (and must) delete memory. metaData == 0 indicates either memory == 0 or we don't know how big the block is. metaData > 0 indicates the actual size of the block, and that we don't own it. |
1.2.18