1-102 SOMobjects Base Toolkit: Programmer’s Reference Manual
somRenew, somRenewNoInit, somRenewNoInitNoZero,
somRenewNoZero Methods
Purpose
Creates a new object instance using a passed block of storage.
IDL Syntax
SOMObject somRenew (in somToken memPtr);
SOMObject somRenewNoInit (in somToken memPtr);
SOMObject somRenewNoInitNoZero (in somToken memPtr);
SOMObject somRenewNoZero (in somToken memPtr);
Note: For backward compatibility, these methods do not take an Environment parameter.
Description
The somRenew method creates a new instance of the receiving class by setting the
appropriate location in the passed memory block to the receiving class’s instance method
table. Unlike somNew, these “Renew” methods use the space pointed to by memPtr rather
than allocating new space for the object. The somRenew method automatically re-initializes
the object by first zeroing the object’s memory, and then invoking somInit;
somRenewNoInit zeros memory, but does not invoke somInit. somRenewNoInitNoZero
only sets the method table pointer; while somRenewNoZero calls somInit, but does not
zero memory first.
No check is made to ensure that the passed pointer addresses enough space to hold an
instance of the receiving class. The caller can determine the amount of space necessary by
using the somGetInstanceSize method.
The C bindings produced by the SOM Compiler contain a macro that is a convenient
shorthand for _somRenew(_className).
Parameters
receiver A pointer to the class object that is to create the new instance.
memPtr A pointer to the space to be used to construct a new object.
Return Value
The value of newObject is returned, which is now a pointer to a valid, initialized object.
Commenti su questo manuale