home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ivbdbl.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  10.5 KB  |  245 lines

  1. #ifndef _IVBDBL_
  2.   #define _IVBDBL_
  3. /*******************************************************************************
  4. * FILE NAME: ivbdbl.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *    IVBDoublePart - IBM VB sample Double part.                                *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM(R) VisualAge(TM) for C++                                               *
  12. *   (C) Copyright International Business Machines Corporation 1991, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *   This program will not run in DOS mode.                                     *
  18. *                                                                              *
  19. * DISCLAIMER OF WARRANTIES:                                                    *
  20. *   The following [enclosed] code is sample code created by IBM                *
  21. *   Corporation.  This sample code is not part of any standard IBM product     *
  22. *   and is provided to you solely for the purpose of assisting you in the      *
  23. *   development of your applications.  The code is provided "AS IS",           *
  24. *   without warranty of any kind.  IBM shall not be liable for any damages     *
  25. *   arising out of your use of the sample code, even if they have been         *
  26. *   advised of the possibility of such damages.                                *
  27. *******************************************************************************/
  28.  
  29. #ifndef _IVBDTYPE_
  30.   #include <ivbdtype.hpp>
  31. #endif
  32.  
  33.   #include <float.h>
  34.  
  35. #ifndef _ISTRING_
  36.   #include <istring.hpp>
  37. #endif
  38.  
  39. /*-------------------------- Pragma Library Support --------------------------*/
  40. #ifndef __NO_DEFAULT_LIBS__
  41.   #ifdef __OS2__
  42.     #ifdef __IMPORTLIB__
  43.        #pragma library("CPPOV03I.LIB")
  44.     #else
  45.        #pragma library("CPPOV03.LIB")
  46.     #endif
  47.   #endif
  48.   #ifdef __WINDOWS__
  49.     #ifdef __IMPORTLIB__
  50.        #pragma library("CPPWV03I.LIB")
  51.     #else
  52.        #pragma library("CPPWV03.LIB")
  53.     #endif
  54.   #endif
  55. #endif
  56.  
  57.  
  58. /*----------------------------------------------------------------------------*/
  59. /* Align classes on four byte boundary.                                       */
  60. /*----------------------------------------------------------------------------*/
  61. #pragma pack(4)
  62.  
  63. class IVBDoublePart : public IVBDataTypePart
  64. {
  65. public:
  66. /*--------------------------- PUBLIC -----------------------------------------*/
  67.  
  68. /*------------------------- Constructors/Destructor ----------------------------
  69. ------------------------------------------------------------------------------*/
  70.   IVBDoublePart (double value = 0.0);
  71.   IVBDoublePart (const IVBDoublePart& partCopy);
  72. virtual
  73.   ~IVBDoublePart ();
  74.  
  75. /*-------------------------------- Operators -----------------------------------
  76. |   operator ==       - Operator == (return true if equal).                    |
  77. |   operator !=       - Operator != (return true if not equal).                |
  78. ------------------------------------------------------------------------------*/
  79.   IVBDoublePart& operator= (const IVBDoublePart& aIVBDoublePart);
  80. Boolean
  81.   operator == (const IVBDoublePart& aValue) const,
  82.   operator != (const IVBDoublePart& aValue) const,
  83.   operator == (const IVBDoublePart* aValue) const,
  84.   operator != (const IVBDoublePart* aValue) const;
  85.  
  86. virtual IString
  87.   asString    ( ) const;
  88.  
  89. /*-------------------------------- Attributes ----------------------------------
  90. | List of query and set members functions for this class:                      |
  91. |                                                                              |
  92. |   value             - Query the value (double) attribute.                    |
  93. |   valueAsText       - Query the valueAsText (IString) attribute.             |
  94. |   valueAs1Based     - Query the valueAs1Based (double) attribute.             |
  95. |   defaultValue      - Query the defaultValue (double) attribute.             |
  96. |   isValueEqualDefault - Query the valueEqualDefault (Boolean) attribute.     |
  97. |   isValueNotEqualDefault - Query the valueNotEqualDefault (Boolean) attribute. |
  98. |   lowLimit          - Query the lowLimit (double) attribute.                 |
  99. |   highLimit         - Query the highLimit (double) attribute.                |
  100. |   isValueEqualLowLimit - Query the valueEqualLowLimit (Boolean) attribute.   |
  101. |   isValueEqualHighLimit - Query the valueEqualHighLimit (Boolean) attribute. |
  102. |   isValueBelowLowLimit - Query the valueBelowLowLimit (Boolean) attribute.   |
  103. |   isValueAboveHighLimit - Query the valueAboveHighLimit (Boolean) attribute. |
  104. |   isValueOutsideLimits - Query the valueOutsideLimits (Boolean) attribute.   |
  105. |   isValueWithinLimits - Query the valueWithinLimits (Boolean) attribute.     |
  106. |   isValueNotZero    - Query the valueNotZero (Boolean) attribute.            |
  107. |   isValueZero       - Query the valueZero (Boolean) attribute.               |
  108. |   isValuePositive   - Query the valuePositive (Boolean) attribute.           |
  109. |   isValueNegative   - Query the valueNegative (Boolean) attribute.           |
  110. |   setValue          - Set the value (double) attribute.                      |
  111. |   setValueAsText    - Set the valueAsText (IString) attribute.               |
  112. |   setValueAs1Based  - Set the valueAs1Based (double) attribute.              |
  113. |   setDefaultValue   - Set the defaultValue (double) attribute.               |
  114. |   setLowLimit       - Set the lowLimit (double) attribute.                   |
  115. |   setHighLimit      - Set the highLimit (double) attribute.                  |
  116. ------------------------------------------------------------------------------*/
  117.  
  118. virtual double
  119.   value () const;
  120. virtual IVBDoublePart
  121.  &setValue (double aValue),
  122.  &setValue ();
  123.  
  124. virtual IString
  125.   valueAsText () const;
  126. virtual IVBDoublePart
  127.  &setValueAsText (const IString& valueAsText),
  128.  &setValueAsText (const IString* valueAsText);
  129.  
  130. virtual double
  131.   valueAs1Based () const;
  132. virtual IVBDoublePart
  133.  &setValueAs1Based (double valueAs1Based);
  134.  
  135. virtual double
  136.   defaultValue () const;
  137. virtual IVBDoublePart
  138.  &setDefaultValue (double defaultValue = 0);
  139.  
  140. virtual Boolean
  141.   isValueEqualDefault () const;
  142.  
  143. virtual Boolean
  144.   isValueNotEqualDefault () const;
  145.  
  146. virtual double
  147.   lowLimit () const;
  148. virtual IVBDoublePart
  149.  &setLowLimit (double aLowLimit = DBL_MIN);
  150.  
  151. virtual double
  152.   highLimit () const;
  153. virtual IVBDoublePart
  154.  &setHighLimit (double highLimit = DBL_MAX);
  155.  
  156. virtual Boolean
  157.   isValueEqualLowLimit () const;
  158.  
  159. virtual Boolean
  160.   isValueEqualHighLimit () const;
  161.  
  162. virtual Boolean
  163.   isValueBelowLowLimit () const;
  164.  
  165. virtual Boolean
  166.   isValueAboveHighLimit () const;
  167.  
  168. virtual Boolean
  169.   isValueOutsideLimits () const;
  170.  
  171. virtual Boolean
  172.   isValueWithinLimits () const;
  173.  
  174. virtual Boolean
  175.   isValueNotZero () const;
  176.  
  177. virtual Boolean
  178.   isValueZero () const;
  179.  
  180. virtual Boolean
  181.   isValuePositive () const;
  182.  
  183. virtual Boolean
  184.   isValueNegative () const;
  185.  
  186. /*-------------------------------- Actions -------------------------------------
  187. | List of operations or services provided by this class:                       |
  188. |                                                                              |
  189. |   assignValueToZero               - Assign value attribute to 0 (false). |
  190. |   assignValueToOne                - Assign value attribute to 1 (true).      |
  191. |   assignValueToLowLimit           - Assign value attribute to low limit. |
  192. |   assignValueToHighLimit          - Assign value attribute to high limit |
  193. |   assignValueToDefault            - Assign the value attribute to false. |
  194. |   assignValueToRandom             - Assign value to pseudo-random number |
  195. |   copyValueToDefault              - Copy value to default value.             |
  196. |   assignValueToPI                 - Assign value attribute to PI.            |
  197. |   assignValueToE                  - Assign value attribute to e.             |
  198. |   ceilValue                       - Perform ceil function on value.          |
  199. |   floorValue                      - Perform floor function on value.         |
  200. |   squareValue                     - Square the value attribute.              |
  201. |   addValue                        - Perform add operator on value.           |
  202. |   subractValue                    - Perform subract operator on value.       |
  203. |   divideValue                     - Perform divide operator on value.        |
  204. |   multiplyValue                   - Perform multiply operator on value.      |
  205. ------------------------------------------------------------------------------*/
  206.  
  207. virtual IVBDoublePart
  208.  &assignValueToZero (),
  209.  &assignValueToOne (),
  210.  &assignValueToLowLimit (),
  211.  &assignValueToHighLimit (),
  212.  &assignValueToDefault (),
  213.  &assignValueToRandom (),
  214.  ©ValueToDefault (),
  215.  &assignValueToPI (),
  216.  &assignValueToE (),
  217.  &ceilValue (),
  218.  &floorValue (),
  219.  &squareValue (),
  220.  &addValue (double addValue = 1),
  221.  &subtractValue (double subtractValue = 1),
  222.  &multiplyValue (double multiplyValue = 2),
  223.  ÷Value (double divideValue = 2);
  224.  
  225. /*----------------------- Notification Event Descriptions ----------------------
  226. | List of attribute and event notification identifiers:                        |
  227. |                                                                              |
  228. ------------------------------------------------------------------------------*/
  229.  
  230.  
  231. private:
  232. /*--------------------------- PRIVATE ----------------------------------------*/
  233.   double iValue;                        //Data member for value attribute
  234.   double iDefaultValue;                 //Data member for defaultValue attribute
  235.   double iLowLimit;                     //Data member for lowLimit attribute
  236.   double iHighLimit;                    //Data member for highLimit attribute
  237. };
  238.  
  239. /*----------------------------------------------------------------------------*/
  240. /* Resume compiler default packing.                                           */
  241. /*----------------------------------------------------------------------------*/
  242. #pragma pack()
  243.  
  244. #endif
  245.