Bull DPX/20 Betriebsanweisung Seite 152

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 424
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 151
1-140 SOMobjects Base Toolkit: Programmers Reference Manual
somDumpSelfInt Method
Purpose
Outputs the internal state of an object. Intended to be overridden by class implementors.
Not intended to be directly invoked by object clients.
IDL Syntax
void somDumpSelfInt (in long level);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somDumpSelfInt method should be overridden by a class implementor, to write out the
instance data stored in an object. This method is invoked by the somDumpSelf method,
which is used by object clients to output the state of an object.
The procedure used to override this method for a new class should begin by calling the
parent class form of this method on each of the class parents, and should then write a
description of the instance variables introduced by new class. This will result in a description
of all the class’s instance variables. The C and C++ implementation bindings provide a
convenient macro for performing parent method calls on all parents, as illustrated in the
following examples.
The character output routine pointed to by SOMOutCharRoutine should be used for output.
The somLPrintf function is especially convenient for this, since level is handled
appropriately.
Parameters
receiver A pointer to the object to be dumped.
level The nesting level for describing compound objects. It must be greater than
or equal to 0. All lines in the description should be preceded by “2 * level”
spaces.
C Example
Following is a method overriding somDumpSelfInt for class “List”, which has two attributes,
val (which is a long) and next (which is a pointer to a “List” object).
SOM_Scope void SOMLINK somDumpSelfInt(List somSelf, int level)
{
ListData *somThis = ListGetData(somSelf);
Environment *ev = somGetGlobalEnvironment();
List_parents_somDumpSelfInt(somSelf, level);
somLPrintf(level, ”This item: %i\n”, __get_val(somSelf, ev);
somLPrintf(level, ”Next item: \n”);
if (__get_next(somSelf, ev) != (List) NULL)
_somDumpSelfInt(__get_next(somSelf, ev), level+1);
else
somLPrintf(level+1, ”NULL\n”);
}
Seitenansicht 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 423 424

Kommentare zu diesen Handbüchern

Keine Kommentare