Jump to content

SomUnregisterClass: Difference between revisions

From EDM2
Created page with "{{DISPLAYTITLE:somUnregisterClass}} This method removes a class object from the SOM run-time class registry. '''Note:''' For backward compatibility, this method does not take..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 4: Line 4:
'''Note:''' For backward compatibility, this method does not take an Environment parameter.
'''Note:''' For backward compatibility, this method does not take an Environment parameter.


; Original Class : [[SOMClassMgr]]
;Original Class : [[SOMClassMgr]]


==Syntax==
==Syntax==
Line 10: Line 10:


==Parameters==
==Parameters==
; receiver (SOMClassMgr) : Usually SOMClassMgrObject (or a pointer to an instance of a user-supplied subclass of SOMClassMgr).  
;receiver (SOMClassMgr) : Usually SOMClassMgrObject (or a pointer to an instance of a user-supplied subclass of SOMClassMgr).
 
;class (SOMClass) : A pointer to the class to be unregistered.
; class (SOMClass) : A pointer to the class to be unregistered.


==Return Code==
==Return Code==
; rc (long) : The somUnregisterClass method returns 0 for a successful completion, or non-zero to denote failure.
;rc (long) : The somUnregisterClass method returns 0 for a successful completion, or non-zero to denote failure.


==Remarks==
==Remarks==
Line 51: Line 50:


==Related==
==Related==
===Methods===
;Methods
* [[somLoadClassFile]]
* [[somLoadClassFile]]
* [[somRegisterClass]]
* [[somRegisterClass]]

Latest revision as of 18:22, 12 October 2022

This method removes a class object from the SOM run-time class registry.

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

Original Class
SOMClassMgr

Syntax

long somUnregisterClass (SOMClassMgr receiver, SOMClass class)

Parameters

receiver (SOMClassMgr)
Usually SOMClassMgrObject (or a pointer to an instance of a user-supplied subclass of SOMClassMgr).
class (SOMClass)
A pointer to the class to be unregistered.

Return Code

rc (long)
The somUnregisterClass method returns 0 for a successful completion, or non-zero to denote failure.

Remarks

The somUnregisterClass method unregisters a SOM class and frees the class object. If the class was dynamically loaded, it is also unloaded using somUnloadClassFile (which causes its entire affinity group to be unloaded as well).

Example Code

#include <som.h>

void main ()
{
    long rc;  /* Return code */
    SOMClass animalClass;

    /* The next 2 lines declare a static form of somId */
    string animalClassName = "Animal";
    somId animalId = &animalClassName;

    somEnvironmentNew ();
    animalClass = SOMClassMgr_somFindClass (SOMClassMgrObject,
                                                animalId, 0, 0);
    if (!animalClass) {
       somPrintf ("Could not load class.\n");
       return;
    }
    rc = SOMClassMgr_somUnregisterClass (SOMClassMgrObject,
                                                   animalClass);
    if (rc)
        somPrintf ("Could not unregister class, error code: %ld.\n",
                                                                rc);
    else
        somPrintf ("Class successfully unloaded.\n");
}

Related

Methods