somClassFromId
Appearance
This method finds a class object, given its somId, if it already exists. Does not load the class.
For backward compatibility, this method does not take an Environment parameter.
- Original Class
- SOMClassMgr
Syntax
SOMClass somClassFromId (SOMClassMgr receiver, somId classId)
Parameters
- receiver (SOMClassMgr)
- Usually SOMClassMgrObject (or a pointer to an instance of a user-supplied subclass of SOMClassMgr).
- classId (somId)
- The somId of the class. This can be obtained from the name of the class using the somIdFromString function.
Return Code
- rc (SOMClass)
- Returns a pointer to the class, or NULL if the class object does not yet exist.
Remarks
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.
Example Code
#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.