SOM Kernel Reference 1-107
somClassFromId Method
Purpose
Finds a class object, given its somId, if it already exists. Does not load the class.
IDL Syntax
SOMClass somClassFromId (in somId classId);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
Finds a class object, given its somId, if it already exists. Does not load the class.
Use the somClassFromId method instead of somFindClass when you do not want the
class to be automatically loaded if it does not already exist in the current process.
Parameters
receiver Usually SOMClassMgrObject (or a pointer to an instance of a
user-supplied subclass of SOMClassMgr).
classId The somId of the class. This can be obtained from the name of the class
using the somIdFromString function.
Return Value
Returns a pointer to the class, or NULL if the class object does not yet exist.
C Example
#include <som.h>
main () {
SOMClass myClass;
char *myClassName = ”Animal”;
somId animalId;
somEnvironmentNew ();
animalId = somIdFromString (myClassName);
myClass = SOMClassMgr_somClassFromId (SOMClassMgrObject,
animalId);
if (!myClass)
somPrintf (”Class %s has not been loaded.\n”, myClassName);
SOMFree (animalId);
}
This program produces the following output:
Class Animal has not yet been loaded.
Original Class
SOMClassMgr
Related Information
Methods: somFindClass, somFindClsInFile
Comentários a estes Manuais