home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / CALCULAT / CPPOV13 / ICALCOP.CPP < prev    next >
Text File  |  1995-04-14  |  2KB  |  65 lines

  1. //****************************************************************************
  2. // ICalcOperator Class - C++ Code File (icalcop.cpp)                         *
  3. //                                                                           *
  4. // COPYRIGHT: Copyright (C) International Business Machines Corp., 1994,1995 *
  5. //                                                                           *
  6. // DISCLAIMER OF WARRANTIES:                                                 *
  7. //   The following [enclosed] code is sample code created by IBM             *
  8. //   Corporation.  This sample code is not part of any standard IBM product  *
  9. //   and is provided to you solely for the purpose of assisting you in the   *
  10. //   development of your applications.  The code is provided "AS IS",        *
  11. //   without warranty of any kind.  IBM shall not be liable for any damages  *
  12. //   arising out of your use of the sample code, even if they have been      *
  13. //   advised of the possibility of such damages.                             *
  14. //****************************************************************************
  15. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  16. //
  17. // VERSION 2
  18. //
  19. // Changes:
  20. //   9/23/94 - Returns a result as well as having a connectable attribute.
  21. //             This allows the result to be gotten via two different types
  22. //             of connections as well as allowing for exception handling.
  23. //****************************************************************************
  24.  
  25. #include "icalcop.hpp"                  //ICalcOperator class header
  26. #include <inotifev.hpp>
  27.  
  28. //
  29. // Events
  30. //
  31.  
  32. INotificationId ICalcOperator :: resultId = "ICalcOperator::result";
  33.  
  34. /*******************************************************************
  35.  * Constructors/Destructors
  36.  *******************************************************************/
  37.  
  38. ICalcOperator :: ICalcOperator() :
  39.         dResult(0)
  40. {
  41. }
  42.  
  43. ICalcOperator :: ~ICalcOperator()
  44. {
  45. }
  46.  
  47. /*******************************************************************
  48.  * Access Member Functions (no Event for dResult)
  49.  *******************************************************************/
  50.  
  51. double ICalcOperator :: result () const
  52. {
  53.   return dResult;
  54. }
  55.  
  56. double ICalcOperator :: setResult
  57.   (double iResult)
  58. {
  59.   dResult = iResult;
  60.   notifyObservers(INotificationEvent(resultId,*this));
  61.  
  62.   return dResult;
  63. }
  64.  
  65.