
CHAPTER 7: Integrating External Libraries Defining entry points for indirect access 211
All SoObjectInterface members must be valid function pointers, or NULL. You must implement
initialize() and finalize(). The functions must conform to the following type definitions.
initialize()
ESerror_t initialize (SoHObject hObject, int argc, TaggedData* argv);
hObject
The SoHObject reference for this instance.
argc, argv
The number of and pointer to arguments passed to the constructor, in the form of
TaggedData
.
Required. Called when JavaScript code instantiates this class with the
new operator:
var xx = New MyClass(arg1, ...)
The initialization function typically adds properties and methods to the object. Objects of the same
class can offer different properties and methods, which you can add with the addMethod()
and
addProperty()
functions in the stored SoServerInterface.
Returns an error code,
kESErrOK on success.
put()
ESerror_t put (SoHObject hObject, SoCClientName* name, TaggedData* pValue);
hObject
The SoHObject reference for this instance.
name
The name of the property, a pointer to an SoCClientName.
pValue
The new value, a pointer to a TaggedData.
Called when JavaScript code sets a property of this class:
xx.myproperty = "abc" ;
If you provide NULL for this function, the JavaScript object is read-only.
Returns an error code, kESErrOK on success.
get()
ESerror_t get (SoHObject hObject, SoCClientName* name, TaggedData* pValue);
hObject
The SoHObject reference for this instance.
name
The name of the property, a pointer to an SoCClientName.
pValue
A buffer in which to return the property value, a TaggedData.
Called when JavaScript code accesses a property of this class:
alert(xx.myproperty);
Returns an error code, kESErrOK on success.
Comentarios a estos manuales