home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / compiler / dts / xhmain / xhmain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-20  |  1.5 KB  |  60 lines

  1. #include <stdio.h>
  2. #include "info.xh"
  3.  
  4. //
  5. // Notice that suffix's for file "info.xh" end in 'xh'. 
  6. // This naming confention implies that the non-DTS C++ usage bindings are 
  7. // being used for the class definition.
  8. //
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12.  
  13. //
  14. // Allocate a SOM environment structure.
  15. //
  16.  
  17.     Environment *__SOMEnv;
  18.     __SOMEnv = SOM_CreateLocalEnvironment();
  19.  
  20. //
  21. // Now Create an object of class info.
  22. //
  23. // Notice that the SOM mapped name is used rather than the C++ class name
  24. // declared in info.hh. Have a look at info.xh if your are curious on the
  25. // information the SOM toolkit provides in order to support a SOM enabled
  26. // class without DTS support.
  27. //
  28.  
  29.     info *anInfo = new info;
  30.  
  31. //
  32. // As we are using the .xh usage bindings, accesses to attributes
  33. // are done through the get and set methods only.
  34. //
  35.     printf("Local anInfo->_get_x() = %d\n", anInfo->_get_x(__SOMEnv));
  36.  
  37.     printf("Local anInfo->_get_y() = %c\n", anInfo->_get_y(__SOMEnv));
  38.  
  39.     anInfo->_set_y(__SOMEnv, 'B');
  40.  
  41.     printf("Local anInfo->_get_y() = %c\n", anInfo->_get_y(__SOMEnv));
  42.  
  43. //
  44. // Since anInfo is a SOM object, it inherits methods from it's parent
  45. // class SOMObject. One of these methods is somDumpSelf.
  46. // Method somDumpSelf outputs the internal state of an object.
  47. //
  48.     anInfo->somDumpSelf(0);
  49.  
  50. //
  51. // Free all resources used by the __SOMEnv environment variable.
  52. //
  53.  
  54.     SOM_DestroyLocalEnvironment(__SOMEnv);
  55.  
  56.  
  57.     return(0);
  58. }
  59.  
  60.