SOM Kernel Reference 1-83
somGetInstancePartSize Method
Purpose
Returns the total size of the instance data structure introduced by a class. Not generally
overridden.
IDL Syntax
long somGetInstancePartSize ( );
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somGetInstancePartSize method returns the amount of space needed in an object of
the specified class or any of its subclasses to contain the instance variables introduced by
the class.
Parameters
receiver A pointer to the class object whose instance data size is desired.
Return Value
The somGetInstancePartSize method returns the size, in bytes, of the instance variables
introduced by this class. This does not include the size of instance variables introduced by
this class’s ancestor or descendent classes. If a class introduces no instance variables, 0 is
returned.
C Example
#include <animal.h>
main()
{
Animal myAnimal;
SOMClass animalClass;
int instanceSize;
int instanceOffset;
int instancePartSize;
myAnimal = AnimalNew ();
animalClass = _somGetClass (myAnimal);
instanceSize = _somGetInstanceSize (animalClass);
instanceOffset = _somGetInstanceOffset (animalClass);
instancePartSize = _somGetInstancePartSize (animalClass);
somPrintf (”Instance Size: %d\n”, instanceSize);
somPrintf (”Instance Offset: %d\n”, instanceOffset);
somPrintf (”Instance Part Size: %d\n”, instancePartSize);
_somFree (myAnimal);
}
/*
Output from this program:
Instance Size: 8
Instance Offset: 0
Instance Part Size: 4
*/
Kommentare zu diesen Handbüchern