home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / som30tk.zip / som30os2.zip / include / somcm.idl < prev    next >
Text File  |  1996-12-24  |  11KB  |  235 lines

  1. //#  @(#) 1.21 src/somk/somcm.idl, somk.cm, som3.0 2/15/96 15:04:42 [12/24/96 07:40:20]
  2.  
  3. // 96F8647, 96F8648, 96F8850 (C) Copyright IBM Corp. 1992, 1994
  4. // All Rights Reserved
  5. // Licensed Materials - Property of IBM
  6.  
  7. //  SOMClassMgr: System Object Model class manager
  8.  
  9. #ifndef somcm_idl
  10. #define somcm_idl
  11.  
  12. #include <somobj.idl>
  13.  
  14. interface Repository;
  15.  
  16. interface SOMClassMgr : SOMObject
  17. {
  18.   // [Basic Functions Group]
  19.  
  20.   typedef SOMClass *SOMClassArray;
  21.   // Used for SOM 1.0 binary compatibility
  22.  
  23.  
  24.   SOMClass somLoadClassFile(in somId classId,
  25.                             in long majorVersion,
  26.                             in long minorVersion,
  27.                             in string file);
  28.   // Loads the class' code and initializes the class object.
  29.  
  30.   string somLocateClassFile(in somId classId,
  31.                             in long majorVersion,
  32.                             in long minorVersion);
  33.   // Real implementation supplied by subclasses.  Default implementation
  34.   // will lookup the class name in the Interface Repository (if one is
  35.   // available) to determine the implementation file name (ie, DLL name).
  36.   // If this information is not available, the class name itself is
  37.   // returned as the file name.   Subclasses may use version number
  38.   // info to assist in deriving the file name.
  39.  
  40.   void somRegisterClass(in SOMClass classObj);
  41.   // Lets the class manager know that the specified class is installed
  42.   // and tells it where the class object is.
  43.  
  44.   void somRegisterClassLibrary (in string libraryName,
  45.                                 in somMethodPtr libraryInitRtn);
  46.   // Informs the class manager that a class library has been loaded.
  47.   // "libraryName" is the name associated with the file containing the
  48.   // implementation(s) of the class(es) in the class library.
  49.   // "libraryInitRtn" is the entry point of a SOMInitModule function
  50.   // that can be used to initialize the class library.  For platforms
  51.   // that have the capability to automatically invoke a library
  52.   // initialization function whenever a library is loaded, a call
  53.   // to this method should occur within the library's automatic init
  54.   // function.
  55.  
  56.   void somUnregisterClassLibrary (in string libraryName);
  57.   // Informs the class manager that a class library has been unloaded.
  58.   // "libraryName" is the name associated with the file containing the
  59.   // implementation(s) of the class(es) in the class library.
  60.   // For platforms that have the capability to automatically invoke a
  61.   // library termination function whenever a library is unloaded, a call
  62.   // to this method should occur within the library's automatic
  63.   // termination function.
  64.  
  65.   long somUnloadClassFile(in SOMClass classObj);
  66.   // Releases the class' code and unregisters all classes in the
  67.   // same affinity group (see somGetRelatedClasses below).
  68.  
  69.   long somUnregisterClass(in SOMClass classObj);
  70.   // Free the class object and removes the class from the SOM registry.
  71.   // If the class caused dynamic loading to occur, it is also unloaded
  72.   // (causing its entire affinity group to be unregistered as well).
  73.  
  74.   void somBeginPersistentClasses();
  75.   // Starts a bracket for the current thread wherein all classes
  76.   // that are registered are marked as permanant and cannot be
  77.   // unregistered or unloaded.  Persistent classes brackets may be
  78.   // nested.
  79.  
  80.   void somEndPersistentClasses();
  81.   // Ends a persistent classes bracket for the current thread.
  82.  
  83.   boolean somJoinAffinityGroup(in SOMClass newClass, in SOMClass affClass);
  84.   // If <affClass> is a member of an affinity group, and <newClass> is not a
  85.   // member of any affinity group, this method adds <newClass> to the
  86.   // same affinity group as <affClass>.  If the method succeeds it returns
  87.   // TRUE, otherwise it returns FALSE.  Adding a class to an affinity group
  88.   // effectively equates its lifetime with that of the other members of
  89.   // the affinity group.
  90.  
  91.  
  92.   // [Access Group]
  93.  
  94.   string somGetInitFunction();
  95.   // The name of the initialization function in the class' code file.
  96.   // Default implementation returns (*SOMClassInitFuncName)().
  97.  
  98.   attribute Repository somInterfaceRepository;
  99.   // The Repository object that provides access to the Interface Repository,
  100.   // If no Interface Repository has yet been assigned to this attribute,
  101.   // and the SOMClassMgr is unable to load and instantiate it, the attribute
  102.   // will have the value NULL.  When finished using the Repository object
  103.   // you should release your reference using the somDestruct method with
  104.   // a non-zero <doFree> parameter.
  105.  
  106.   readonly attribute sequence<SOMClass> somRegisteredClasses;
  107.   // A list of all classes currently registered in this process.
  108.  
  109.   SOMClassArray somGetRelatedClasses(in SOMClass classObj);
  110.   // Returns an array of class objects that were all registered during
  111.   // the dynamic loading of a class.    These classes are considered to
  112.   // define an affinity group.  Any class is a member of at most one
  113.   // affinity group.    The affinity group returned by this call is the
  114.   // one containing the class identified by classObj.  The first element
  115.   // in the array is the class that caused the group to be loaded, or the
  116.   // special value -1 which means that the SOMClassMgr is currently in the
  117.   // process of unregistering and deleting the affinity group (only
  118.   // SOMClassMgr subclasses would ever see this value).
  119.   // The remainder of the array (elements one thru n) consists of
  120.   // pointers to class objects ordered in reverse chronological sequence
  121.   // to that in which they were originally registered.  This list includes
  122.   // the given argument, classObj, as one of its elements, as well as the
  123.   // class, if any, returned as element[0] above.  The array is terminated
  124.   // by a NULL pointer as the last element.  Use SOMFree to release the
  125.   // array when it is no longer needed.  If the supplied class was not
  126.   // dynamically loaded, it is not a member of any affinity
  127.   // group and NULL is returned.
  128.  
  129.   // [Dynamic Group]
  130.  
  131.   SOMClass somClassFromId(in somId classId);
  132.   // Finds the class object, given its Id, if it already exists.
  133.   // Does not load the class.  Returns NULL if the class object does
  134.   // not yet exist.
  135.  
  136.   SOMClass somFindClass(in somId classId,
  137.                         in long majorVersion,
  138.                         in long minorVersion);
  139.   // Returns the class object for the specified class.  This may result
  140.   // in dynamic loading.  Uses somLocateClassFile to obtain the name of
  141.   // the file where the class' code resides, then uses somFindClsInFile.
  142.  
  143.   SOMClass somFindClsInFile(in somId classId,
  144.                             in long majorVersion,
  145.                             in long minorVersion,
  146.                             in string file);
  147.   // Returns the class object for the specified class.  This may result
  148.   // in dynamic loading.  If the class already exists <file> is ignored,
  149.   // otherwise it is used to locate and dynamically load the class.
  150.   // Values of 0 for major and minor version numbers bypass version checking.
  151.  
  152.   void somMergeInto(in SOMObject targetObj);
  153.   // Merges the SOMClassMgr registry information from the receiver to
  154.   // <targetObj>.  <targetObj> is required to be an instance of SOMClassMgr
  155.   // or one of its subclasses.  At the completion of this operation,
  156.   // the <targetObj> should be able to function as a replacement for the
  157.   // receiver.  At the end of the operation the receiver object (which is
  158.   // then in a newly uninitialized state) is freed.  Subclasses that
  159.   // override this method should similarly transfer their sections of
  160.   // the object and pass this method to their parent as the final step.
  161.   // If the receiving object is the distinguished instance pointed to
  162.   // from the global variable SOMClassMgrObject, SOMCLassMgrObject is
  163.   // then reassigned to point to <targetObj>.
  164.  
  165.   long somSubstituteClass(in string origClassName,
  166.                           in string newClassName);
  167.   // This method causes the somFindClass, somFindClsInFile, and
  168.   // somClassFromId methods to return the class named newClassName
  169.   // whenever they would have normally returned the class named
  170.   // origClassName.  This effectively results in class <newClassName>
  171.   // replacing or substituting itself for class <origClassName>.
  172.   // Some restrictions are enforced to insure that this works well.
  173.   // Both class <origClassName> and class <newClassName> must
  174.   // have been already registered before issuing this method, and newClass
  175.   // must be an immediate child of origClass.  In addition (although not
  176.   // enforceable), no instances should exist of either class at the time
  177.   // this method is invoked.    A return value of zero indicates success;
  178.   // a non-zero value indicates an error was detected.
  179.  
  180.   boolean somImportObject( in SOMObject objToBeShared );
  181.   // This method causes the local class manager to load the
  182.   // dlls that are required for sharing the object <objToBeShared>.
  183.   // The returned boolean indicates whether or not the operation succeeded.
  184.   // A return of FALSE (the operation failed) means that it is not safe
  185.   // to use the object, i.e., invoking a method on the object may lead to
  186.   // an exception.
  187.  
  188.  
  189. #ifdef __SOMIDL__
  190.   implementation {
  191.     releaseorder: somFindClsInFile,somFindClass,
  192.                   somClassFromId,somRegisterClass,
  193.                   somUnregisterClass,somLocateClassFile,somLoadClassFile,
  194.                   somUnloadClassFile,somGetInitFunction,somMergeInto,
  195.                   somGetRelatedClasses,somSubstituteClass,
  196.                   _get_somInterfaceRepository, _set_somInterfaceRepository,
  197.                   _get_somRegisteredClasses,
  198.                   somBeginPersistentClasses, somEndPersistentClasses,
  199.                   somcmPrivate1,
  200.                   somcmPrivate2,
  201.                   somRegisterClassLibrary,
  202.                   somJoinAffinityGroup,
  203.                   somUnregisterClassLibrary,
  204.                   somImportObject,
  205.                   somcmPrivate3,
  206.                   somcmPrivate4
  207.                   ;
  208.  
  209.     // Class Modifiers
  210.     callstyle = oidl;
  211.     externalstem = somcm;
  212.     majorversion = 1;
  213.     minorversion = 6; // for som3.0 kernelsomo
  214.     filestem = somcm;
  215.     dllname = "som.dll";
  216.     somallocate = somm_CallSOMMalloc;
  217.     somdeallocate = somm_CallSOMFree;
  218.  
  219.     // Attribute Modifiers
  220.     somInterfaceRepository: nodata;
  221.     somRegisteredClasses: nodata;
  222.  
  223.  
  224.     // Method Modifiers
  225.     somDefaultInit: override;
  226.     somDestruct: override;
  227.     somDumpSelfInt: override;
  228.     somLocateClassFile: dual_owned_result;
  229.     somGetInitFunction: dual_owned_result;
  230.   };
  231. #endif /* __SOMIDL__ */
  232. };
  233.  
  234. #endif  /* somcm_idl */
  235.