SIDL-specified objects are managed through explicit creation and reference counting. Babel automatically generates an _create method for concrete classes. The method is used to instantiate the class and return the associated reference. The owner of the instance is responsible for its proper disposal. In other words, when processing with the object is done, the owner must invoke deleteRef on it. Similarly, any object references returned by a subroutine call must be deleted or given to another part of the code that will take ownership of and, therefore, responsibility for deleteRef'ing it.
For example, the following calls deleteRef() using the
sidl.BaseInterface version of the method
integer*8 interface1, except C code to initialize interface1 here call sidl_BaseInterface_deleteRef_f(interface1, except)
When it is necessary to determine if two references point to the same object,
the built-in isSame method can be used. For example, the following
attempts to determine if interface1 and interface2 point to
the same object
integer*8 interface1, interface2, except logical areSame C code to initialize interface1 and interface2 here call sidl_BaseInterface_isSame_f(interface1, $ interface2, areSame, except) C now areSame holds the return value
Similarly, it is sometimes necessary to find out if a given method is of a
specific type. One case in point is when trying to determine if an exception
is of a given type. The built-in isType method is provided for that
purpose. For example, the following tries to determin if interface1
is of type x.y.z
integer*8 interface1, except logical typeMatch C code to initialize interface1 here call sidl_BaseInterface_isType_f(interface1, 'x.y.z', $ typeMatch, except)
Along those same lines, it is possible to find the name of a SIDL class that
implements a particular interface. Using a sequence of calls with
sidl.BaseInterface interface, this can be accomplished as follows
integer*8 interface1, classinfo, except character*256 className C code to initialize interface1 here call sidl_BaseInterface_getClassInfo_f(interface1, $ classinfo, except) call sidl_ClassInfo_getName_f(classinfo, className, except) call sidl_BaseInterface_deleteRef_f(classinfo, except)