Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_TaskControl.hpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #ifndef _C_TASK_CONTROL
00021 #define _C_TASK_CONTROL
00022 
00023 #include "iostream_t.hpp"
00024 #include <pthread.h>
00025 
00026 #include "GeneratorError.h"
00027 
00028 class C_TaskControl {
00029 
00030 public:
00031 
00032   typedef enum _enum_state {
00033     E_STATE_UNKNOWN = 0 ,
00034     E_STATE_INIT,
00035     E_STATE_RUNNING,
00036     E_STATE_STOPPING,
00037     E_STATE_STOPPED 
00038   } T_State ;
00039 
00040            C_TaskControl() ;
00041   virtual ~C_TaskControl() ;
00042 
00043   T_GeneratorError init () ;
00044   T_GeneratorError run  () ;
00045   T_GeneratorError run_task_once () ;
00046   T_GeneratorError run_all_once () ;
00047 
00048   void    stop () ;
00049   T_State get_state() ;
00050 
00051 protected:
00052   
00053   virtual T_GeneratorError TaskProcedure () = 0 ;
00054   virtual T_GeneratorError InitProcedure () = 0 ;
00055   virtual T_GeneratorError EndProcedure () = 0 ;
00056   virtual T_GeneratorError StoppingProcedure () = 0 ;
00057   virtual T_GeneratorError ForcedStoppingProcedure () = 0 ;
00058 
00059   virtual T_GeneratorError InitTaskProcedure () { return (E_GEN_NO_ERROR); } ;
00060 
00061   T_State     M_state ;
00062   bool        m_end_executed ;
00063 
00064 } ; // class C_TaskControl
00065 
00066 iostream_output& operator<<(iostream_output&, C_TaskControl::T_State&);
00067 
00068 // function to start a TaskControl within a thread
00069 pthread_t* start_thread_control (C_TaskControl *P_taskControl) ;
00070 void       wait_thread_control_end (pthread_t *P_thread);
00071 
00072 #endif // _C_TASK_CONTROL

Generated on Wed Mar 7 14:44:58 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002