home *** CD-ROM | disk | FTP | other *** search
/ C/C++ User's Journal & Wi…eveloper's Journal Tools / C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso / smxdemo / smxpp / dprocess.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-21  |  3.1 KB  |  132 lines

  1. /*************************************************************************
  2. *  Copyright (c) 1989-1993 Micro Digital Associates, Inc.
  3. *                  All Rights Reserved.
  4. *
  5. *  MODULE: dprocess.cpp
  6. *
  7. *  DESRIPTION:    This module contains all the class methods for the
  8. *                 dprocess class.
  9. *
  10. *
  11. *  AUTHOR: Rick Evans 
  12. *
  13. *
  14. *  UPDATE LOG
  15. *
  16. *************************************************************************/
  17.  
  18. //--- Header Files --------
  19.  
  20. #include <core.h>
  21. #include <dprocess.hpp>
  22.  
  23. //---- Global Varibles -----
  24.  
  25. //----- Local Varibles -----
  26.  
  27. //------- Functions --------
  28. /*************************************************************************
  29. *
  30. *  NAME: DPROCESS
  31. *
  32. *  DESRIPTION:
  33. *              This is the dprocess constructor. It not only constructs
  34. *              the dprocess but also calls the constructors for the
  35. *              other objects in dprocess.
  36. *              
  37. *
  38. *  INPUTS:
  39. *              none
  40. *  OUTPUTS:
  41.                none
  42. *
  43. *  RETURN:     none
  44. *
  45. *************************************************************************/
  46. DProcess::DProcess(const void(*Task1)(), const void(*Task2)(), 
  47.                   const void(*Task3)(), const void(*Task4)(), 
  48.                   const void(*Task5)() ) : DiskDemo ( Task1, MIN ),
  49.                   ErrGen   ( Task2, HI ), OpCon    ( Task3, MAX ),
  50.                   Preempter( Task4, HI ), Sleeper  ( Task5, NORM )
  51. {
  52.    // This is were you can do any initialization for your process.
  53.    ;
  54. }
  55.  
  56.  
  57. /*************************************************************************
  58. *
  59. *  NAME: START
  60. *
  61. *  DESRIPTION:
  62. *              This method is used to start the process. All the tasks
  63. *              are started.
  64. *              
  65. *
  66. *  INPUTS:
  67. *              none
  68. *  OUTPUTS:
  69.                none
  70. *
  71. *  RETURN:
  72. *              A FALSE value is returned is one of the classes is not
  73. *              created else a TRUE is returned.
  74. *
  75. *************************************************************************/
  76. BOOLEAN  DProcess::Start()
  77. {
  78.    BOOLEAN b;
  79.  
  80.    b = OpCon.Start();
  81.    if (b)
  82.       b = DiskDemo.Start();
  83.    if (b)
  84.       b = Sleeper.Start();
  85.    if (b)
  86.       b = Preempter.Start();
  87.    //if (b)
  88.    //b = ErrGen.Start();
  89.    if(!b)
  90.       (void)ShutDown();
  91.  
  92.    return b;
  93. }
  94.  
  95. /*************************************************************************
  96. *
  97. *  NAME: SHUTDOWN
  98. *
  99. *  DESRIPTION:
  100. *              This method is used to shut down the process. All the task
  101. *              are stopped. The destructor for the class is called from
  102. *              the process destructor.
  103. *
  104. *  INPUTS:
  105. *              none
  106. *  OUTPUTS:
  107.                none
  108. *
  109. *  RETURN:
  110. *              A FALSE value is returned is one of the classes is not
  111. *              created else a TRUE is returned.
  112. *
  113. *************************************************************************/
  114. BOOLEAN  DProcess::ShutDown()
  115. {
  116.    BOOLEAN b;
  117.  
  118.    b= TRUE;
  119.    if(!OpCon.Stop())
  120.       b = FALSE;
  121.    if(!DiskDemo.Stop())
  122.       b = FALSE;
  123.    if(!Sleeper.Stop())
  124.       b = FALSE;
  125.    if(!Preempter.Stop())
  126.    //if(!ErrGen.Stop())
  127.    //   b = FALSE;
  128.  
  129.    return b;
  130. }
  131.  
  132.