home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dtswps.zip / DTSFILES.ZIP / SOMCM.IDL < prev    next >
Text File  |  1996-06-24  |  11KB  |  238 lines

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