home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somd / cpp / event / cell.cpp next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  2.3 KB  |  83 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.  *
  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.  
  36. #define Cell_Class_Source
  37. #define M_Cell_Class_Source
  38.  
  39. #include <stdio.h>
  40.  
  41. #include <somd.xh>
  42. #include "cell.xih"
  43.  
  44. /*
  45.  *Method from the IDL attribute statement:
  46.  *"attribute long val"
  47.  */
  48.  
  49. SOM_Scope void  SOMLINK _set_val(Cell *somSelf,  Environment *ev, long value)
  50. {
  51.     CellData *somThis = CellGetData(somSelf);
  52.     CellMethodDebug("Cell","_set_val");
  53.  
  54.     somThis->val = value;
  55.     somSelf->notifyEventCh(ev);
  56. }
  57.  
  58. SOM_Scope void  SOMLINK notifyEventCh(Cell *somSelf,  Environment *ev)
  59. {
  60.     CellData *somThis = CellGetData(somSelf);
  61.     any event_msg;
  62.     static long current_value;
  63.  
  64.     CellMethodDebug("Cell","notifyServers");
  65.  
  66.     current_value = somSelf->_get_val(ev);
  67.     event_msg._type = TC_long;
  68.     event_msg._value = (void *)¤t_value;
  69.  
  70.     somThis->cons_if->push(ev, &event_msg);
  71. }
  72.  
  73. SOM_Scope void  SOMLINK setConsumerIf(Cell *somSelf,  Environment *ev, EventComm_Consumer *consumer_if)
  74. {
  75.     CellData *somThis = CellGetData(somSelf);
  76.     CellMethodDebug("Cell","setConsumerIf");
  77.  
  78.     somThis->cons_if = consumer_if;
  79.  
  80. }
  81.  
  82.  
  83.