summaryrefslogtreecommitdiff
path: root/TAO/examples/RTScheduling/Job_i.h
blob: 6b290a7e7a6804d62a7527184a9f5b4217eed21e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* -*- C++ -*- */
//=============================================================================
/**
 *  @file Job_i.h
 *
 *  $Id$
 *
 *  This file defines the servant for the Job.idl interface
 *
 *  @author Pradeep Gore <pradeep@cs.wustl.edu>
 */
//=============================================================================
#ifndef JOB_I_H
#define JOB_I_H

#include "JobS.h"
#include "Task_Stats.h"
#include "ace/SString.h"

#include "ace/Arg_Shifter.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//class ACE_TArg_Shifter<char>;
ACE_END_VERSIONED_NAMESPACE_DECL

class DT_Creator;

/**
 * @class Job_i
 *
 * @brief Implements a Job that performs some cpu bound work.
 *
 */
class Job_i : public POA_Job
{
 public:
  /// Constructor
  Job_i (DT_Creator* dt_creator);

  ~Job_i (void);

  /// Init the state of this object.
  int init (ACE_TArg_Shifter<char>& arg_shifter);

  /// = Accessors
  const ACE_CString& name (void);
  const ACE_CString& poa (void);

  /// = inteface Job method implementation.
  virtual void work (CORBA::ULong work,
		     CORBA::Short importance
		     ACE_ENV_ARG_DECL)
    ACE_THROW_SPEC ((
                     CORBA::SystemException
                     ));

  virtual void post_work (int guid,
			  int importance);

  void dump_stats (void);

  virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((
                     CORBA::SystemException
                     ));

  int guid (void);

 protected:
  /// The name of this Job
  ACE_CString job_name_;

  /// The name of the POA that we live in.
  ACE_CString POA_name_;

  DT_Creator* dt_creator_;

  Task_Stats *task_stats_;

  size_t guid_;
};

#endif /* JOB_I_H */