Class ArrayPtr


class ArrayPtr : public ObjectPtr
Programmer: Ryan Davis

Description:

I provide an extension of ObjectPtr's services to include named accessors and utilities for arrays.

Public Methods:

static ObjectPtr create (const UInteger & initialSize);
I am create. I act as a "factory method" for creating new array objects.

static ArrayPtr convert (const ObjectPtr & obj);
I convert obj to a valid ArrayPtr. If obj is not an array, then I return gNil.

ArrayPtr (const ObjectPtr & pointee);
This is a constructor. It has a default value of gNil, so it can be used as the generic constructor as well. This constructor creates an Object pointer that points to the address passed in through . NOTE - should we make this protected? It allows us to make an ArrayPtr from an ObjectPtr without that being valid...

ObjectPtr & at (const UInteger & index);
I am 'at'. I access the array at the given index. If the access is out of bounds, then I return nil.

Boolean atPut (const UInteger & index, const ObjectPtr & value);
I am 'atPut'. I set the value at the given index and return true If the access is out of bounds, then I do nothing and return False. I am the method used for testing the other methods validity in ArrayPtr. TESTING

Protected Methods:

static ClassPtr & klassPtr ();


void add (const ObjectPtr & value);
I am 'add'. I increase the current size of my array and append value to the end. I am very dangerous and shouldn't be used under most contexts... I was added for compiling and other special cases. I might not exist in a future incarnation...

Protected Members:


friend class MethodBuilder;



friend class ST80Compiler;
These allow MethodBuilder and ST80Compiler direct access to add()