home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warptlk3.zip / TOOLKIT / SOM / INCLUDE / SNGLICLS.IDL < prev    next >
Text File  |  1995-08-24  |  2KB  |  53 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. #ifndef snglicls_idl
  14. #define snglicls_idl
  15. #include <somcls.idl>
  16. interface SOMMSingleInstance  
  17.                    : SOMClass
  18. // This class is a metaclass for classes which wish to enforce a
  19. // single instance rule.  That is, classes which specify this class
  20. // as their metaclass will only be allowed to have a single instance.
  21. //
  22. // For example, if a class named dog specified this class as its
  23. // metaclass, only one dog object could be instantiated. Repeated
  24. // calls to _somNew on the dog class would simply return the same
  25. // dog repeatedly.
  26. //
  27. // There are two ways to retrieve the single intance of the using
  28. // class:
  29. //
  30. //  1) Invoke sommGetSingleInstance on the class object of the using class.
  31. //     This is the preferred way.
  32. //
  33. //  2) Invoke somNew or somNewNoInit on the class object of the using class.
  34. //
  35.     SOMObject sommGetSingleInstance();
  36.     // Returns the single instance of the using class.
  37.     // If there isn't one, then it creates one first with somNew.
  38.     void sommFreeSingleInstance();
  39.     // If there isn't one, then the method does nothing.
  40.     // Frees single instance of the class
  41.     #ifdef __SOMIDL__
  42.     implementation {
  43.         callstyle=idl;
  44.            releaseorder: sommGetSingleInstance, sommFreeSingleInstance;   
  45.            majorversion = 2;
  46.            minorversion = 1;
  47.            filestem = snglicls;
  48.     };
  49.     #endif /* __SOMIDL__ */
  50. };
  51. #endif
  52.