next up previous contents
Next: Invoking BABEL to generate Up: C Bindings Previous: Calling SIDL methods from   Contents

Implicitly defined methods

The C binding for interfaces and classes includes two methods for perform type casts. The methods are named _cast and _cast2. The leading underscore prevents these builtin methods from conflicting with a user method because user methods cannot begin with an underscore. Neither of these methods increases the reference count of the underlying object -- this is contrary to standard methods that always return new reference counts. Here are the signatures for _cast and _cast2 from SIDL.BaseClass.

users_guide/c/code/cast.h

The _cast method attempts to cast a SIDL interface or object pointer to a pointer to SIDL.BaseClass. The _cast2 method attempts to cast a SIDL interface or object pointer to a pointer to an interface or object pointer of the type named type. In the case of _cast2, the client is responsible for casting the return value into the proper pointer type. Both methods are NULL safe. A NULL return value indicates that the cast failed or that obj was NULL.

Non-abstract classes have an additional implicit method called _create to create new instances of the class. Interfaces and abstract classes do not have this method because you cannot instantiate them. The _create method returns a new reference that the client must manage. Here is an example of its signature.

users_guide/c/code/create.h


next up previous contents
Next: Invoking BABEL to generate Up: C Bindings Previous: Calling SIDL methods from   Contents


babel-0.8.0
users_guide Last Modified 2003-01-14

http://www.llnl.gov/CASC/components
components@llnl.gov