home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v5.zip / TOOLKT21 / CPLUS / SAMPLES / WPCAR / RPM.CPP < prev    next >
C/C++ Source or Header  |  1993-04-30  |  3KB  |  112 lines

  1. /******************************************************************************
  2. *
  3. *  Module Name: RPM.CPP
  4. *
  5. *  OS/2 Work Place Shell Sample Program
  6. *
  7. *  Copyright (C) 1992 IBM Corporation
  8. *
  9. *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  10. *      sample code created by IBM Corporation. This sample code is not
  11. *      part of any standard or IBM product and is provided to you solely
  12. *      for  the purpose of assisting you in the development of your
  13. *      applications.  The code is provided "AS IS", without
  14. *      warranty of any kind.  IBM shall not be liable for any damages
  15. *      arising out of your use of the sample code, even if they have been
  16. *      advised of the possibility of such damages.                                                    *
  17. *
  18. *  Entry Points:
  19. *
  20. *     Class Methods:
  21. *
  22. *        Query
  23. *        Set
  24. *        SetToDefault
  25. *        SaveState
  26. *        RestoreState
  27. *
  28. *  Description:
  29. *
  30. *      This file contains the member functions of class RPM.
  31. ******************************************************************************/
  32. #include "carpp.xih"
  33. /* 
  34.  * Method: RPM::RPM
  35.  *
  36.  * Description:
  37.  *
  38.  *    This is the constructor for class RPM which initializes
  39.  *     the state data for an object of type RPM.
  40.  */
  41. RPM::RPM(VOID)
  42. {
  43.   magnitude = DEFAULT_RPM;
  44. }
  45.  
  46. /*
  47.  * Method: RPM::Query
  48.  *
  49.  * Description:
  50.  *
  51.  *    Returns a ULONG value indicating the speed of the car in RPM's.
  52.  */
  53. ULONG RPM::Query(VOID)
  54. {
  55.   return magnitude;
  56. }
  57.  
  58. /*
  59.  * Method: RPM::Set
  60.  *
  61.  * Description:
  62.  *
  63.  *    Sets the speed of the car.  An argument of type ULONG is passed to
  64.  *     the function indicating the new speed of the car in RPM's.
  65.  */
  66. VOID RPM::Set(ULONG ulRPM)
  67. {
  68.   magnitude = ulRPM;
  69. }
  70.  
  71. /*
  72.  * Method: RPM::SetToDefault
  73.  *
  74.  * Description:
  75.  *
  76.  *    Sets the default state of the object.
  77.  */
  78. VOID RPM::SetToDefault(VOID)
  79. {
  80.   magnitude = DEFAULT_RPM;
  81. }
  82.  
  83. /*
  84.  * Method: RPM::SaveState
  85.  *
  86.  * Description:
  87.  *
  88.  *    Saves the state of the current object in the OS2.INI file.  The input
  89.  *     arguments consist of a pointer to a Carpp object as well as a pointer 
  90.  *     to a string.  These two items are required so that the data associated 
  91.  *     with the object being saved can be stored in the OS2.INI file.
  92.  */
  93. VOID RPM::SaveState(Carpp *clientObject, PSZ szCarClassTitle)
  94. {
  95.   clientObject->wpSaveLong( szCarClassTitle, IDKEY_RPM, magnitude);
  96. }
  97.  
  98. /*
  99.  * Method: RPM::RestoreState
  100.  *
  101.  * Description:
  102.  *
  103.  *    Restores the object's saved state from the OS2.INI file.  The input
  104.  *     arguments consist of a pointer to a Carpp object as well as a pointer 
  105.  *     to a string.  These two items are required so that the data associated
  106.  *     with the object being restored can be retrieved from the OS2.INI file.
  107.  */
  108. VOID RPM::RestoreState(Carpp *clientObject, PSZ szCarClassTitle)
  109. {
  110.   clientObject->wpRestoreLong( szCarClassTitle, IDKEY_RPM,  &magnitude); 
  111. }
  112.