somGetSize

From EDM2
Jump to: navigation, search

This method returns the size of an object. Not generally overridden.

For backward compatibility, this method does not take an Environment parameter.

Original Class
SOMObject

Syntax

long somGetSize (SOMObject receiver)

Parameters

receiver (SOMObject)
A pointer to the object whose size is desired.

Return Code

rc (long)
Returns the size, in bytes, of the receiver.

Remarks

The somGetSize method returns the total amount of contiguous space used by the receiving object.

The value returned reflects only the amount of storage needed to hold the SOM representation of the object. The object might actually be using or managing additional space outside of this area.

The somGetSize method is not generally overridden.

Example Code

#include <animal.h>
void main()
{
   Animal myAnimal;
   long animalSize;
   myAnimal = AnimalNew();
   animalSize = _somGetSize(myAnimal);
   somPrintf("Size of animal (in bytes): %d\n", animalSize);
   _somFree(myAnimal);
}
/*
Output from this program:
Size of animal (in bytes): 8
*/

Related

Methods