8.1.1 The class Oz_Extension

The class OZ_Extension implements the methods defined below. The methods getIdV and gcV which are marked as required are pure virtual and have to be implemented in every subclass.

virtual int getIdV() // required

Allows to discriminate the different kinds of extensions. It should return a unique number. Unique numbers can be obtained using int OZ_getUniqueId().

Ids can be statically assigned by extending the enumeration OZ_Registered_Extension_Id.

virtual Extension* gcV() // required

Invoked when copying is request. Needed for garbage collection and in the case of OZ_SituatedExtension also for copying.

virtual void gcRecurseV() // default: do nothing

Invoked on the copy obtained from gcV. The VM has marked the data such that recursive updates of fields, e.g. running OZ_gcHeapNode, do not run into cycles.

virtual OZ_Term printV(int depth = 10) // default: return extension

printV should return a virtual string and is used for printing, e.g. System.show.

virtual OZ_Term printLongV(int depth = 10, int offset = 0) // default: call printV

This may help debugging, but is currently not used.

virtual OZ_Term typeV() // default: return extension

typeV should return an atom describing the type of the extension. This value is also return in Value.status and Value.type. It should not conflict with the built-in types.

virtual OZ_Term inspectV() // default: call typeV

Not used. Idea: hook for debugging tools to get information.

virtual Bool isChunkV() // default: return true

Define this to return false is the extension in not a subtype of chunk.

virtual OZ_Term getFeatureV(OZ_Term fea) // default: return 0

If the operator . (dot) is applied to an extension this function is called. If getFeatureV returns 0 an exception is raised that the feature is not available.

virtual OZ_Return eqV(OZ_Term t) // default: return false

This function is called during unification and equality test (==), if both values are extensions. Implement it if you need structural equality. Note that in this case isChunkV should return false.

virtual Bool marshalV(MsgBuffer * bs) // default: return false

This is the hook to serialization. It returns true if the extension is serializable and writes it external representation into the message buffer (see oz_registerExtension below).

OZ_Boolean isLocal()

Returns true if a situated extensions is local to the current space.


Michael Mehl, Tobias Müller, Christian Schulte and Ralf Scheidhauer
Version 1.0.1 (19990218)