home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somd / cpp / animal / dloc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  2.4 KB  |  85 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.  
  14. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  15. /*
  16.  *  This file was generated by the SOM Compiler and Emitter Framework.
  17.  *  Generated using: 
  18.  *      SOM Emitter emitxtm: 2.37
  19.  */
  20.  
  21.  
  22.  
  23. #ifndef SOM_Module_dloc_Source
  24. #define SOM_Module_dloc_Source
  25. #endif
  26. #define dLocation_Class_Source
  27.  
  28. #include <string.h>
  29. #include "dloc.xih"
  30.  
  31. /*
  32.  * City where animal was born.
  33.  */
  34.  
  35. SOM_Scope void  SOMLINK _set_city(dLocation *somSelf,  Environment *ev, string city)
  36. {
  37.     dLocationData *somThis = dLocationGetData(somSelf);
  38.     dLocationMethodDebug("dLocation","_set_city");
  39.  
  40.     if (somThis->city) SOMFree(somThis->city);
  41.     somThis->city = (string) SOMMalloc(strlen(city) + 1);
  42.     strcpy(somThis->city, city);
  43. }
  44.  
  45. /*
  46.  * State where animal was born.
  47.  */
  48.  
  49. SOM_Scope void  SOMLINK _set_state(dLocation *somSelf,  Environment *ev, string state)
  50. {
  51.     dLocationData *somThis = dLocationGetData(somSelf);
  52.     dLocationMethodDebug("dLocation","_set_state");
  53.  
  54.     if (somThis->state) SOMFree(somThis->state);
  55.     somThis->state = (string) SOMMalloc(strlen(state) + 1);
  56.     strcpy(somThis->state, state);
  57. }
  58.  
  59. SOM_Scope void SOMLINK somDefaultInit(dLocation *somSelf, somInitCtrl* ctrl)
  60. {
  61.    dLocationData *somThis; /* set in BeginInitializer */
  62.    Environment *ev;
  63.    somInitCtrl globalCtrl;
  64.    somBooleanVector myMask;
  65.    dLocationMethodDebug("dLocation","somDefaultInit");
  66.    dLocation_BeginInitializer_somDefaultInit;
  67.  
  68.    dLocation_Init_SOMObject_somDefaultInit(somSelf, ctrl);
  69.  
  70.    ev = somGetGlobalEnvironment();
  71.     somSelf->_set_city(ev, "unknown city");
  72.     somSelf->_set_state(ev, "unknown state");
  73. }
  74. SOM_Scope void SOMLINK somDestruct(dLocation *somSelf, octet doFree, somDestructCtrl* ctrl)
  75. {
  76.    dLocationData *somThis; /* set in BeginDestructor */
  77.    somDestructCtrl globalCtrl;
  78.    somBooleanVector myMask;
  79.    dLocationMethodDebug("dLocation","somDestruct");
  80.    dLocation_BeginDestructor;
  81.     if (somThis->city) SOMFree(somThis->city);
  82.     if (somThis->state) SOMFree(somThis->state);
  83.     dLocation_EndDestructor;
  84. }
  85.