home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * This file was generated by the SOM Compiler.
- * FileName: somcm.xh.
- * Generated using:
- * SOM Precompiler spc: 1.22
- * SOM Emitter emitxh: 1.11
- */
-
- /*
- * SOMClassMgr: System Object Model class manager
- * Copyright (c) International Business Machines Corporation
- * 1991, 1992
- */
-
- #ifndef somcm_xh
- #define somcm_xh
- class SOMClassMgr;
-
- #define SOMClassMgr_MajorVersion 1
- #define SOMClassMgr_MinorVersion 1
-
- /* C++ som defs */
- #include <somcls.xh>
-
- /* C++ parent def */
- #ifndef somobj_xh
- #include <somobj.xh>
- #endif
-
- #ifndef SOMClassMgr_API
- #define SOMClassMgr_API
- /*
- * The Class API
- */
-
- /* A procedure to create the SOMClassMgr Class */
- SOMEXTERN SOMClass * SOMLINK SOMClassMgrNewClass(
- integer4 majorVersion,
- integer4 minorVersion);
-
- /* A macro to return the SOMClassMgr class object */
- #define _SOMClassMgr ((SOMClass*)SOMClassMgrClassData.classObject)
-
- /* The static interface to SOMClassMgr and its instances */
- SOMEXTERN struct SOMClassMgrClassDataStructure {
- SOMClass *classObject;
- somMToken somFindClsInFile;
- somMToken somFindClass;
- somMToken somClassFromId;
- somMToken somRegisterClass;
- somMToken somUnregisterClass;
- somMToken somLocateClassFile;
- somMToken somLoadClassFile;
- somMToken somUnloadClassFile;
- somMToken somGetInitFunction;
- somMToken somMergeInto;
- somMToken somGetRelatedClasses;
- } SOMClassMgrClassData;
-
- /*
- * -- Typedefs for Procedures that support SOMClassMgr Methods
- */
- extern "C" {
- typedef SOMClass * (SOMLINK *somTD_SOMClassMgr_somLoadClassFile)(SOMClassMgr *somSelf,INOUT somId classId,IN integer4 majorVersion,IN integer4 minorVersion,IN zString file);
- typedef zString (SOMLINK *somTD_SOMClassMgr_somLocateClassFile)(SOMClassMgr *somSelf,INOUT somId classId,IN integer4 majorVersion,IN integer4 minorVersion);
- typedef void (SOMLINK *somTD_SOMClassMgr_somRegisterClass)(SOMClassMgr *somSelf,IN SOMClass *classObj);
- typedef int (SOMLINK *somTD_SOMClassMgr_somUnloadClassFile)(SOMClassMgr *somSelf,IN SOMClass *classObj);
- typedef int (SOMLINK *somTD_SOMClassMgr_somUnregisterClass)(SOMClassMgr *somSelf,IN SOMClass *classObj);
- typedef zString (SOMLINK *somTD_SOMClassMgr_somGetInitFunction)(SOMClassMgr *somSelf);
- typedef SOMClass ** (SOMLINK *somTD_SOMClassMgr_somGetRelatedClasses)(SOMClassMgr *somSelf,IN SOMClass *classObj);
- typedef SOMClass * (SOMLINK *somTD_SOMClassMgr_somClassFromId)(SOMClassMgr *somSelf,IN somId classId);
- typedef SOMClass * (SOMLINK *somTD_SOMClassMgr_somFindClass)(SOMClassMgr *somSelf,INOUT somId classId,IN integer4 majorVersion,IN integer4 minorVersion);
- typedef SOMClass * (SOMLINK *somTD_SOMClassMgr_somFindClsInFile)(SOMClassMgr *somSelf,INOUT somId classId,IN integer4 majorVersion,IN integer4 minorVersion,IN zString file);
- typedef void (SOMLINK *somTD_SOMClassMgr_somMergeInto)(SOMClassMgr *somSelf,IN SOMObject *targetObj);
- }
-
-
- #endif /* SOMClassMgr_API */
-
-
- /*
- * -- The C++ Wrapper Class for SOMClassMgr
- */
- class SOMClassMgr : public SOMObject
- {
- public:
-
- void *operator new(size_t size)
- {
- (void) size;
- if (!SOMClassMgrClassData.classObject)
- SOMClassMgrNewClass(SOMClassMgr_MajorVersion,SOMClassMgr_MinorVersion);
- return (void *)
- ((somTD_SOMClass_somNew)
- somResolve(SOM_TestCls((SOMAny *)(SOMClassMgrClassData.classObject),
- SOMClassClassData.classObject),
- SOMClassClassData.somNew))
- ((SOMClass*)(SOMClassMgrClassData.classObject));
- }
-
- void operator delete(void * obj)
- {
- ((SOMObject *)obj)->somFree();
- }
-
- /* public method: somLoadClassFile */
-
- /*
- * Loads the class' code and initializes the class object.
- */
- SOMClass * somLoadClassFile(INOUT somId classId,
- IN integer4 majorVersion,
- IN integer4 minorVersion,
- IN zString file)
- {
- return (SOMClass*) SOM_Resolve((SOMAny *)this,SOMClassMgr,somLoadClassFile)
- (this,classId,majorVersion,minorVersion,file);
- }
-
-
- /* public method: somLocateClassFile */
-
- /*
- * Real implementation supplied by subclasses. Default implementation
- * returns the class name as the file name. Subclasses may use
- * version number info to assist in deriving the file name.
- */
- zString somLocateClassFile(INOUT somId classId,
- IN integer4 majorVersion,
- IN integer4 minorVersion)
- {
- return (zString) SOM_Resolve((SOMAny *)this,SOMClassMgr,somLocateClassFile)
- (this,classId,majorVersion,minorVersion);
- }
-
-
- /* public method: somRegisterClass */
-
- /*
- * Lets the class manager know that the specified class is installed
- * and tells it where the class object is.
- */
- void somRegisterClass(IN SOMClass *classObj)
- {
- SOM_Resolve((SOMAny *)this,SOMClassMgr,somRegisterClass)
- (this,classObj);
- }
-
-
- /* public method: somUnloadClassFile */
-
- /*
- * Releases the class' code and unregisters all classes in the
- * same affinity group (see somGetRelatedClasses below).
- */
- int somUnloadClassFile(IN SOMClass *classObj)
- {
- return (int) SOM_Resolve((SOMAny *)this,SOMClassMgr,somUnloadClassFile)
- (this,classObj);
- }
-
-
- /* public method: somUnregisterClass */
-
- /*
- * Free the class object and removes the class from the SOM registry.
- * If the class caused dynamic loading to occur, it is also unloaded
- * (causing its entire affinity group to be unregistered as well).
- */
- int somUnregisterClass(IN SOMClass *classObj)
- {
- return (int) SOM_Resolve((SOMAny *)this,SOMClassMgr,somUnregisterClass)
- (this,classObj);
- }
-
-
- /* public method: somGetInitFunction */
-
- /*
- * Supplies the name of the initialization function in the class' code
- * file. Default implementation returns (*SOMClassInitFuncName)().
- */
- zString somGetInitFunction()
- {
- return (zString) SOM_Resolve((SOMAny *)this,SOMClassMgr,somGetInitFunction)
- (this);
- }
-
-
- /* public method: somGetRelatedClasses */
-
- /*
- * Returns an array of class objects that were all registered during
- * the dynamic loading of a class. These classes are considered to
- * define an affinity group. Any class is a member of at most one
- * affinity group. The affinity group returned by this call is the
- * one containing the class identified by classObj. The first element
- * in the array is the class that caused the group to be loaded, or the
- * special value -1 which means that the SOMClassMgr is currently in the
- * process of unregistering and deleting the affinity group (only
- * SOMClassMgr subclasses would ever see this value).
- * The remainder of the array (elements one thru n) consists of
- * pointers to class objects ordered in reverse chronological sequence
- * to that in which they were originally registered. This list includes
- * the given argument, classObj, as one of its elements, as well as the
- * class, if any, returned as element[0] above. The array is terminated
- * by a NULL pointer as the last element. Use SOMFree to release the
- * array when it is no longer needed. If the supplied class was not
- * dynamically loaded, it is not a member of any affinity
- * group and NULL is returned.
- */
- SOMClass ** somGetRelatedClasses(IN SOMClass *classObj)
- {
- return (SOMClass**) SOM_Resolve((SOMAny *)this,SOMClassMgr,somGetRelatedClasses)
- (this,classObj);
- }
-
-
- /* public method: somClassFromId */
-
- /*
- * Finds the class object, given its Id, if it already exists.
- * Does not load the class. Returns NULL if the class object does
- * not yet exist.
- */
- SOMClass * somClassFromId(IN somId classId)
- {
- return (SOMClass*) SOM_Resolve((SOMAny *)this,SOMClassMgr,somClassFromId)
- (this,classId);
- }
-
-
- /* public method: somFindClass */
-
- /*
- * Returns the class object for the specified class. This may result
- * in dynamic loading. Uses somLocateClassFile to obtain the name of
- * the file where the class' code resides, then uses somFindClsInFile.
- */
- SOMClass * somFindClass(INOUT somId classId,
- IN integer4 majorVersion,
- IN integer4 minorVersion)
- {
- return (SOMClass*) SOM_Resolve((SOMAny *)this,SOMClassMgr,somFindClass)
- (this,classId,majorVersion,minorVersion);
- }
-
-
- /* public method: somFindClsInFile */
-
- /*
- * Returns the class object for the specified class. This may result
- * in dynamic loading. If the class already exists <file> is ignored,
- * otherwise it is used to locate and dynamically load the class.
- * Values of 0 for major and minor version numbers bypass version checking.
- */
- SOMClass * somFindClsInFile(INOUT somId classId,
- IN integer4 majorVersion,
- IN integer4 minorVersion,
- IN zString file)
- {
- return (SOMClass*) SOM_Resolve((SOMAny *)this,SOMClassMgr,somFindClsInFile)
- (this,classId,majorVersion,minorVersion,file);
- }
-
-
- /* public method: somMergeInto */
-
- /*
- * Merges the SOMClassMgr registry information from the receiver to
- * <targetObj>. <targetObj> is required to be an instance of SOMClassMgr
- * or one of its subclasses. At the completion of this operation,
- * the <targetObj> should be able to function as a replacement for the
- * receiver. At the end of the operation the receiver object (which is
- * then in a newly uninitialized state) is freed. Subclasses that
- * override this method should similarly transfer their sections of
- * the object and pass this method to their parent as the final step.
- * If the receiving object is the distinguished instance pointed to
- * from the global variable SOMClassMgrObject, SOMCLassMgrObject is
- * then reassigned to point to <targetObj>.
- */
- void somMergeInto(IN SOMObject *targetObj)
- {
- SOM_Resolve((SOMAny *)this,SOMClassMgr,somMergeInto)
- (this,targetObj);
- }
-
-
-
- }; /* SOMClassMgr */
-
-
-
- #endif /* somcm_xh */
-