home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somk / cpp / derived / hello.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  3.1 KB  |  108 lines

  1. //
  2. //   COMPONENT_NAME: somx
  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. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  14.  
  15. /*
  16.  *
  17.  * DISCLAIMER OF WARRANTIES.
  18.  * The following [enclosed] code is sample code created by IBM
  19.  * Corporation. This sample code is not part of any standard or IBM
  20.  * product and is provided to you solely for the purpose of assisting
  21.  * you in the development of your applications.  The code is provided
  22.  * "AS IS". IBM MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
  23.  * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24.  * FOR A PARTICULAR PURPOSE, REGARDING THE FUNCTION OR PERFORMANCE OF
  25.  * THIS CODE.  IBM shall not be liable for any damages arising out of
  26.  * your use of the sample code, even if they have been advised of the
  27.  * possibility of such damages.
  28.  *
  29.  * DISTRIBUTION.
  30.  * This sample code can be freely distributed, copied, altered, and
  31.  * incorporated into other software, provided that it bears the above
  32.  * Copyright notice and DISCLAIMER intact.
  33.  */
  34.  
  35. #define Hello_Class_Source
  36. #include "hello.xih"
  37. #include <stdio.h>
  38.  
  39. /*
  40.  * -- Method Procedures for Hello
  41.  */
  42.  
  43. /*
  44.  *  This operation outputs the string "Hello World".
  45.  */
  46.  
  47. SOM_Scope string SOMLINK hello_(Hello *somSelf)
  48. {
  49.     HelloData *somThis = HelloGetData(somSelf); 
  50.     HelloMethodDebug("Hello","hello");
  51.  
  52.     return somSelf->_get_hellomsg();
  53. }
  54.  
  55.  
  56. /*
  57.  * Override the inherited implementation of somInit.
  58.  */
  59.  
  60. SOM_Scope void  SOMLINK somInit(Hello *somSelf)
  61. {
  62.     HelloData *somThis = HelloGetData(somSelf);
  63.     HelloMethodDebug("Hello","somInit");
  64.  
  65.     somSelf->_set_hellomsg("Hello World");
  66.     parent_SOMObject_somInit(somSelf);
  67. }
  68.  
  69. SOM_Scope void  SOMLINK M_somInit(M_Hello *somSelf)
  70. {
  71. /*     HelloData *somThis = M_HelloGetData(somSelf); */
  72.     HelloMethodDebug("M_Hello","somInit");
  73.  
  74.     parent_SOMClass_somInit(somSelf);
  75. }
  76.  
  77. /*
  78.  *  This method creates an instance of the Hello class and
  79.  *  uses the value of "msg" to initialise it.
  80.  */
  81.  
  82. SOM_Scope Hello*  SOMLINK M_HelloCreate(M_Hello *somSelf,
  83.         char* msg)
  84. {
  85.     /* M_HelloData *somThis = M_HelloGetData(somSelf); */
  86.     M_HelloMethodDebug("M_Hello","HelloCreate");
  87.  
  88.     Hello *hello = somSelf->somNew();
  89.     hello->_set_hellomsg(msg);
  90.     return (hello);
  91. }
  92.  
  93. SOM_Scope void  SOMLINK M_somInitMIClass(M_Hello *somSelf,
  94.                        long inherit_vars,
  95.                        char* className,
  96.                        SOMClassSequence *parentClasses,
  97.                        long instanceSize,
  98.                        long dataAlignment,
  99.                        long maxStaticMethods,
  100.                        long majorVersion,
  101.                        long minorVersion)
  102. {
  103.     /* M_HelloData *somThis = M_HelloGetData(somSelf); */
  104.     M_HelloMethodDebug("M_Hello","somInitMIClass");
  105.  
  106.     parent_SOMClass_somInitMIClass(somSelf,inherit_vars,className,parentClasses,instanceSize,0,maxStaticMethods,majorVersion,minorVersion);
  107. }
  108.