SOM Kernel Reference 1-85
somGetInstanceSize Method
Purpose
Returns the size of an instance of a class. Not generally overridden.
IDL Syntax
long somGetInstanceSize ( );
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somGetInstanceSize method returns the total amount of space needed in an instance
of the specified class.
Parameters
receiver A pointer to the class object whose instance size is desired.
Return Value
The somGetInstanceSize method returns the size, in bytes, of each instance of this class.
This includes the space required for instance variables introduced by this class and all of its
ancestor classes.
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
*/
Original Class
SOMClass
Related Information
Methods: somGetInstancePartSize
Commenti su questo manuale