Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

I'm goin' back to my plough.

- Elton John and Bernie Taupin

 

aztec.system.Base

 

The Base class is the fundamental base class of all Aztec classes, including primitive data types. It is abstract. When a class is defined, one or more existing Aztec classes can be defined as base classes (using the 'from<>' keyword). If no base classes are specified, the Base class becomes the base class.

 

As such, all Aztec objects have access to the methods in the Base class. If an object is dynamically allocated, the ObjectId() will return an integer unique among all other Aztec objects in the script. Primitive data objects which are not dynamically allocated (global, local or class) will return a value of zero for ObjectId().

 

SInce the methods in this class will be visible to all other Aztec classes, most of the methods provided here are prefaced with "Object" to minimize naming conflicts with method names in derived classes.

 

Note that each class in the Aztec Class Framework also has a destructor, which the VM automatically executes when the object goes out of scope (foreground or background depending on how the class and corresponding object is defined). The documentation does not list the destructors, since they can not be directly invoked.

Base Methods

Base() Constructor for the Base class
ObjectId() Returns unique object Id for dynamically allocated objects
ObjectClass() Returns reference to 'Class' metadata object associated with this object's data type
ObjectSpace() Returns the space in which the data type of this object was defined
ObjectIsLocal() Returns true if this object is local to a method (primitive)
ObjectIsGlobal Returns true if this object is global (primitive)
ObjectIsDynamic() Returns true if this object was allocated dynamically
ObjectIsShared() Returns true if this object is 'shared' (primitive - class or local)
ObjectIsConst() Returns true if this object is a constant ('const' keyword)
ObjectCleanup() Initiate advanced object cleanup procedure. Typically not needed.
AddEventHandler() Add generic event handler method for user defined events
ProcessEvent() Generic method to process user defined events within VM event handling system

Derived Classes

See Also

 


Base()

public method Base()

Parameters

None

Return Value

None

Description

Constructor for the abstract Base class.

 

Base Class


ObjectId()

public method<int> ObjectId()

Parameters

None

Return Value

Returns the object Id for the object.

Description

The object Id is created and assigned by the Aztec Virtual Machine when the object is dynamically allocated.When the VM starts up, the starting point for object Ids is randomly selected within a specific range, and then the object Ids are incremented from there with each successive dynamic allocation.

 

If the object is primitive (int, float, string, etc.) and it was not dynamically allocated, the value returned by this method will be zero.

 

When comparing two Aztec objects with object Ids which are not zero, it will always be true that the object with the smaller object Id is "older".

 

Base Class


ObjectClass()

public method<Class> ObjectClass()

Parameters

None

Return Value

Returns a reference to the Class object associated with this object's data type.

Description

Every Aztec data type has an associated 'aztec.system.Class' object associated with it. This method returns a reference to the Class object for the object's data type. It is part of the Aztec Metadata framework which provides run-time information about the code and data within the Aztec script currently running.

 

Note that the Class reference is associated with the actual object, not with the type of reference variable holding the object's reference.

 

This is always guaranted to be a valid reference, and will never be null.

 

Base Class


ObjectSpace()

public method<string> ObjectSpace()

Parameters

None

Return Value

Returns the Aztec space for this object.

Description

This method returns the Aztec space that is associated with the data type of this object.

 

Base Class


ObjectIsLocal()

public method<bool> ObjectIsLocal()

Parameters

None

Return Value

Returns true if the object is defined within a method.

Description

This will only be true for primitive objects, as all other objects require dynamic allocation. The value of this flag is independent of the "IsShared" flag. A local variable which is shared will have a single instance of the object regardless of how many instances of the method are currently running. If no shared flag is used for a local variable, every instance of the method which is currently running will each have its own instance of the object.

 

Base Class


ObjectIsGlobal()

public method<bool> ObjectIsGlobal()

Parameters

None

Return Value

Returns true if the object is defined outside of a class or a method.

Description

This will only be true for primitive objects, as all other objects require dynamic allocation.

 

Base Class


ObjectIsDynamic()

public method<bool> ObjectIsDynamic()

Parameters

None

Return Value

Returns true if the object is dynamically allocated.

Description

This will be true for all objects which are not primitive, and can also be true for primitive objects (e.g. Value = new<int>). If this is true, the "IsLocal", "IsShared" and "IsGlobal" flags will always be false.

 

Base Class


ObjectIsShared()

public method<bool> ObjectIsShared()

Parameters

None

Return Value

Returns true if the object is defined as shared.

Description

This will only be true for primitive objects, as all other objects require dynamic allocation. The value of this flag is independent of the "IsLocal" and "IsGlobal" flags. A local or global variable may or not be marked as shared as well.

 

This flag refers to how the object iself is defined, not how the reference to the object is defined.

 

Base Class


ObjectIsConst()

public method<bool> ObjectIsConst()

Parameters

None

Return Value

Returns true if the object is defined as a constant

Description

This will only be true for primitive objects, as all other objects require dynamic allocation, and they cannot be marked as constant.

 

This flag refers to how the object iself is defined, not how the reference to the object is defined.

 

Base Class


ObjectCleanup()

public method ObjectCleanup(bool CascadeCleanup = false)

Parameters

CascadeCleanup

Cascade the same cleanup proecdure through all nested objects of the same data type

Return Value

None

Description

This method sets every object reference in the class to null, which can initiate object cleanup handling to be performed if any object references go to zero. This can be useful for objects with embedded circular references if the program's logic depends on the object's destructors being executed.

 

If the cascade cleanup flag is set, this same type of processing will recursively be applied to all embedded objects of the same data type as this object.

 

Base Class


AddEventHandler()

public method AddEventHandler(Class EventClass, EventHandler MethodRef, Base ExtraObject, bool UseThreadLevelCallbacks)

Parameters

EventClass

Indicates the type of events which will be processed using this handler

MethodRef

Method reference of method to be executed when the event occurs

ExtraObject

An optional object reference which can be specified by the caller, can be null. It will be sent to each of the event handlers.

UseThreadLevelCallbacks

Add the handler to thread level callback list if true, and the object level list if false.

Return Value

None

Description

Adds an event handler to the object for the specified type of event. There are a lot of advantages using the internal VM event handling mechanism, as it automatically can distribute event objects to all handlers across multiple threads.

 

Base Class


ProcessEvent()

public method ProcessEvent(Event EventToProcess, bool UseThreadLevelCallbacks)

Parameters

EventToProcess

Event to be sent to all registered handlers

UseThreadLevelCallbacks

Proocess the event using the thread level callback list if true, and the object level list if false.

Return Value

None

Description

Processes the user defined defined event within the generic Virtual Machine event handling system. If event handlers have been registered with this particular object, they will be executed acccording to standard Aztec event handling rules, including launching event handlers within other threads if they've been set up that way.

 

Base Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec