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