summaryrefslogtreecommitdiff
path: root/ACE/Kokyu/DSRT_Dispatch_Item_T.h
blob: 7a74b8d8437218b93d00d1601f6ef36936389f6c (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* -*- C++ -*- */
/**
 *  @file  DSRT_Dispatch_Item_T.h
 *
 *  @author Venkita Subramonian (venkita@cs.wustl.edu)
 */

#ifndef DSRT_DISPATCH_ITEM_H
#define DSRT_DISPATCH_ITEM_H
#include /**/ "ace/pre.h"
#include "ace/Bound_Ptr.h"
#include "ace/Copy_Disabled.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "Kokyu_dsrt.h"

namespace Kokyu
{
  /**
   * @class DSRT_Dispatch_Item
   *
   * @brief This stores information about a schedulable thread.
   */

  template <class DSRT_Scheduler_Traits>
  class DSRT_Dispatch_Item : private ACE_Copy_Disabled
  {
    typedef typename
    DSRT_Scheduler_Traits::Guid_t Guid_t;

    typedef typename
    DSRT_Scheduler_Traits::QoSDescriptor_t DSRT_QoSDescriptor;

  protected:
    ACE_hthread_t thr_handle_;
    Guid_t guid_;
    DSRT_QoSDescriptor qos_;
    ACE_Time_Value insertion_time_;

  public:
    DSRT_Dispatch_Item (Guid_t guid, const DSRT_QoSDescriptor&);

    /// Get the guid.
    Guid_t guid ();

    /// Get the associated qos value.
    DSRT_QoSDescriptor qos ();

    /// Get the thread handle.
    ACE_hthread_t thread_handle ();

    /// Set the thread handle.
    void thread_handle (ACE_hthread_t &handle);

    /// Get the insertion time.
    ACE_Time_Value insertion_time ();

    /// Set the insertion time.
    void insertion_time (const ACE_Time_Value&);
  };

  /**
   * @class DSRT_Dispatch_Item_var
   *
   * @brief Smart pointer to dynamically allocated <code>
   * DSRT_Dispatch_Item </code> objects.
   */
  template <class DSRT_Scheduler_Traits>
  class DSRT_Dispatch_Item_var :
    public ACE_Strong_Bound_Ptr<
                              DSRT_Dispatch_Item<DSRT_Scheduler_Traits>,
                              ACE_SYNCH_MUTEX>
  {
  public:
    explicit
    DSRT_Dispatch_Item_var (DSRT_Dispatch_Item<DSRT_Scheduler_Traits>
                            *p = 0);

    DSRT_Dispatch_Item_var (
         const DSRT_Dispatch_Item_var<DSRT_Scheduler_Traits> &r);
  };
}

#if defined (__ACE_INLINE__)
#include "DSRT_Dispatch_Item_T.inl"
#endif /* __ACE_INLINE__ */

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "DSRT_Dispatch_Item_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("DSRT_Dispatch_Item_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include /**/ "ace/post.h"
#endif /* DSRT_DISPATCH_ITEM_H */