RegisterAxit

 (Available in 00 TS Tools(Base) - TS_Tools_Root0)

Purpose

Tell the GC to call the 'Axit' method

Syntax

SELF:RegisterAxit( )

Description

This method will make sure that the function 'RegisterAxit()' is called only one's. Also it will make sure that the 'UnRegisterAxit()' method is called to revoke 'Axit()' calling from the GC.

It is prefered to call the 'Axit()' method instead of the 'Destroy()' method when the application wants to do a explicit destroy of the object in that case the 'Axit()' method will make sure that the 'Destroy()' method of the object is called only one time. This can be a real time saver when the object has a long and/or complex destroy method.

Note: It is not adviced to do any 'real' work while in the 'Axit' method use the 'Destroy()' method for this purpose.

Note: Please try to refrain from allocating and/or de-allocating dynamic memory while in the 'Axit()' or 'Destroy()' method.

Note: The 'TS_Root0' class does not support a owner. Use the 'TS_Root1' class is a owner needs to be registered.

Note: The 'TS_Root0' class does not supports owned's, If you want to automaticly build an owner/owneds-tree then use the 'TS_Root2' class.

Example

oObject:=SomeObject{ }
IF oObject:IsValidObject
// Use the object
   oObject:Axit( )
   oObject:=NULL_OBJECT
ELSE
   oObject:Axit( )
   oObject:=NULL_OBJECT
   TSTrace Warning "Can not instantiate 'SomeObject'"
END

Source

METHOD RegisterAxit( ) AS TS_Root0 PASCAL CLASS TS_Root0
   TSTrace Enter
   IF IsDynPtr( PTR( _CAST, SELF ) )
      IF !LOGIC( _CAST, _AND( SELF:_ObjectStat1, TS_OBJSTAT1_AXITREGISTERED  ; ...
     ... ) )
         SELF:_ObjectStat1:=_OR( SELF:_ObjectStat1 ; ...
        ... , TS_OBJSTAT1_AXITREGISTERED )
         RegisterAxit( SELF )
      END
   ELSE
      TSTrace Warning "!IsDynPtr(PTR(_CAST,SELF))"
   END
   TSTrace Leave
RETURN SELF