Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / RTCORBA / Activity / Periodic_Task.h
blob1c2e9785e814dc8381f99808dd00e7ad466870f8
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Periodic_Task.h
6 * Base class for Periodic Tasks
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
9 */
10 //=============================================================================
11 #ifndef PERIODIC_TASK_H
12 #define PERIODIC_TASK_H
14 #include "tao/RTCORBA/RTCORBA.h"
15 #include "tao/RTCORBA/Priority_Mapping_Manager.h"
16 #include "ace/Task.h"
17 #include "ace/SString.h"
18 #include "ace/Arg_Shifter.h"
19 #include "JobC.h"
21 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
22 class ACE_Barrier;
23 ACE_END_VERSIONED_NAMESPACE_DECL
25 class Task_Stats;
27 /**
28 * @class Periodic_Task
30 * @brief Periodic_Task executes jobs.
32 class Periodic_Task : public ACE_Task <ACE_SYNCH>
34 public:
35 Periodic_Task (void);
36 ~Periodic_Task ();
38 /// Init the state of this object.
39 int init_task (ACE_Arg_Shifter& arg_shifter);
41 /// Activate this task, synch on the given barrier.
42 virtual int activate_task (ACE_Barrier* barrier, RTCORBA::PriorityMapping *priority_mapping) = 0;
44 /// Dump the stats collected.
45 void dump_stats (ACE_TCHAR* msg);
47 /// = Job get/set
48 /// Returns the name of the Job exec'ed by this Task.
49 const char* job (void);
51 /// Sets the Job to exec.
52 void job (Job_ptr job);
54 protected:
55 /// All tasks synch at this barrier.
56 ACE_Barrier* barrier_;
58 /// The Job to execute.
59 Job_var job_;
61 /// Name of the Job.
62 ACE_CString name_;
64 /// = Task parameters
65 /// see http://www.cis.ksu.edu/~neilsen/classes/cis721/lectures/lecture2/sld009.htm
67 /// The priority of this task.
68 RTCORBA::Priority task_priority_;
70 /// Period
71 unsigned long period_;
73 /// Worst case exec. time.
74 unsigned long exec_time_;
76 /// Phase
77 long phase_;
79 /// Number of times to exec. Job
80 int iter_;
82 /// A load factor supplied to each Job.
83 int load_;
85 /// = Stats house keeping
86 Task_Stats* task_stats_;
89 #endif /* PERIODIC_TASK_H */