home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / som / include / snglicls.idl < prev    next >
Text File  |  1999-02-22  |  2KB  |  63 lines

  1. //
  2. //   COMPONENT_NAME: somu
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  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. //#  @(#) somu/snglicls.idl 2.19 7/10/96 09:56:05 [7/30/96 14:49:52]
  14.  
  15.  
  16. #ifndef snglicls_idl
  17. #define snglicls_idl
  18.  
  19. #include <somcls.idl>
  20.  
  21.  
  22. interface SOMMSingleInstance  
  23.                    : SOMClass
  24. // This class is a metaclass for classes which wish to enforce a
  25. // single instance rule.  That is, classes which specify this class
  26. // as their metaclass will only be allowed to have a single instance.
  27. //
  28. // For example, if a class named dog specified this class as its
  29. // metaclass, only one dog object could be instantiated. Repeated
  30. // calls to _somNew on the dog class would simply return the same
  31. // dog repeatedly.
  32. //
  33. // There are two ways to retrieve the single intance of the using
  34. // class:
  35. //
  36. //  1) Invoke sommGetSingleInstance on the class object of the using class.
  37. //     This is the preferred way.
  38. //
  39. //  2) Invoke somNew or somNewNoInit on the class object of the using class.
  40. //
  41.  
  42.     SOMObject sommGetSingleInstance();
  43.     // Returns the single instance of the using class.
  44.     // If there isn't one, then it creates one first with somNew.
  45.  
  46.     void sommFreeSingleInstance();
  47.     // If there isn't one, then the method does nothing.
  48.     // Frees single instance of the class
  49.  
  50.     #ifdef __SOMIDL__
  51.  
  52.     implementation {
  53.         callstyle=idl;
  54.            releaseorder: sommGetSingleInstance, sommFreeSingleInstance;   
  55.            majorversion = 2;
  56.            minorversion = 1;
  57.            filestem = snglicls;
  58.     };
  59.     #endif /* __SOMIDL__ */
  60. };
  61. #endif
  62.