Class GCable


			
class GCable
Programmer: Ryan Davis

Description:

Provides a "mixin" class service so that all subs are automatically garbage collected. Very little effort is required on the user's side, with the exception of writing a small method or two.

Public Methods:

GCable ();
I am the contructor. I define the default values for any GCable object.

virtual ~GCable ();
I am the destructor. I set the object to a stable state...

void * operator new ( size_t size );
I am operator new. All GCable objects will use me to correctly create themselves on the GC heap...

void operator delete ( void* obj );
I am operator delete... I don't do much, since you don't need to destroy objects that are automatically garbage collected...

Protected Methods:

virtual GCable * collect ();
I am called by Memory (and myself as well). I use memory to collect myself.

virtual Boolean collectSubs ();
I am a placeholder for any object that has subpointers that need to be collected...

virtual Boolean isCollected ();
I look to see if I have been collected already (and have a valid // forwarding pointer).

virtual GCable * forward ();
I retrieve the forwarding pointer.

virtual void forward (GCable * forward);
I set the forwarding pointer.

virtual UInteger size ();
I am the only pure virtual object in GCable... This is because sizeof(this*) seems to only report this* as being the type of whatever class the method is defined in (even when virtual).

Protected Members:


friend class Memory;



GCable * myForwardingPtr;