Jump to content

SomGetInstancePartSize: Difference between revisions

From EDM2
Created page with "{{DISPLAYTITLE:somGetInstancePartSize }} This method returns the total size of the instance data structure introduced by a class. Not generally overridden. For backward compa..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 4: Line 4:
For backward compatibility, this method does not take an Environment parameter.
For backward compatibility, this method does not take an Environment parameter.


; Original Class : [[SOMClass]]
;Original Class: [[SOMClass]]
 
==Syntax==
==Syntax==
  long somGetInstancePartSize (SOMClass receiver)
  long somGetInstancePartSize (SOMClass receiver)


==Parameters==
==Parameters==
; receiver (SOMClass) : A pointer to the class object whose instance data size is desired.
;receiver (SOMClass): A pointer to the class object whose instance data size is desired.


==Return Code==
==Return Code==
; rc (long) :  
;rc (long):
* bytes 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.  
* bytes 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.
* 0   Returns 0 if a class introduces no instance variables.
* 0 Returns 0 if a class introduces no instance variables.


==Remarks==
==Remarks==
Line 49: Line 50:


==Related==
==Related==
===Methods===
;Methods
* [[somGetInstanceSize]]
* [[somGetInstanceSize]]


[[Category:SOMClass]]
[[Category:SOM method]]

Latest revision as of 04:39, 6 May 2020

This method returns the total size of the instance data structure introduced by a class. Not generally overridden.

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

Original Class
SOMClass

Syntax

long somGetInstancePartSize (SOMClass receiver)

Parameters

receiver (SOMClass)
A pointer to the class object whose instance data size is desired.

Return Code

rc (long)
  • bytes 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.
  • 0 Returns 0 if a class introduces no instance variables.

Remarks

This 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.

Example Code

#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
*/

Related

Methods