SIDL-specified objects are managed through explicit creation and
reference counting. An additional implicit method, called
_create, must be invoked to create new instances of a concrete class.
The _create method returns a new reference
that must be managed by the client.
The following is an example of its signature
/** * Constructor function for the class. */ sidl_BaseClass sidl_BaseClass__create(/* out */sidl_BaseInterface *_ex);
References are then managed through methods inherited from
sidl.BaseInterface. The methods are addRef and
deleteRef, where addRef is used to increment the
reference counter while
deleteRef decrements it and, if
the count reaches zero, frees any associated memory -- assuming
the developer properly implemented the destructor.
Their C APIs for sidl.BaseInterface are
void sidl_BaseInterface_addRef(/* in */ sidl_BaseInterface self, /* out */ sidl_BaseInterface *_ex); void sidl_BaseInterface_deleteRef(/* in */ sidl_BaseInterface self, /* out */ sidl_BaseInterface *_ex);
These same methods can be called from the sidl.BaseClass
bindings. In fact, since all SIDL-specified interfaces inherit from
sidl.BaseInterface and all classes from sidl.BaseClass,
every C binding for an interface or class will inherit addRef
and deleteRef methods. Their C APIs for sidl.BaseClass
are
void sidl_BaseClass_addRef(/* in */ sidl_BaseClass self, /* out */ sidl_BaseInterface *_ex); void sidl_BaseClass_deleteRef(/* in */ sidl_BaseClass self, /* out */ sidl_BaseInterface *_ex);