blob: 06c9aad2ee39f63ba17c25a1a7bb38cd3f7f4107 (
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
101
|
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = LIBRARY
// ORBSVCS Real-time Event Channel
//
// = FILENAME
// EC_Timeout_Generator
//
// = AUTHOR
// Carlos O'Ryan (coryan@cs.wustl.edu)
//
// = DESCRIPTION
// A new implementation of the Real Time Event Services.
// Based on previous work by Tim Harrison (harrison@cs.wustl.edu)
// and other members of the DOC group.
// More details can be found in:
// http://www.cs.wustl.edu/~schmidt/oopsla.ps.gz
// http://www.cs.wustl.edu/~schmidt/JSAC-98.ps.gz
//
//
// ============================================================================
#ifndef TAO_EC_TIMEOUT_GENERATOR_H
#define TAO_EC_TIMEOUT_GENERATOR_H
#include "orbsvcs/orbsvcs_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Event_Handler.h"
class TAO_EC_QOS_Info;
class TAO_EC_Timeout_Filter;
class TAO_ORBSVCS_Export TAO_EC_Timeout_Generator
{
// = TITLE
// Define the interface for the generators of timeout events.
//
// = DESCRIPTION
// The Event Channel can use several strategies to dispatch
// timers, for instance, it can use the ORB reactor or a pool of
// reactors running at different priorities or a pool of
// Thread_Timer_Queue_Adapters running at different priorities
// also.
// This class is the abstract base class to abstract this
// strategies.
//
public:
virtual ~TAO_EC_Timeout_Generator (void);
// destructor
virtual void activate (void) = 0;
// Activate any internal threads.
virtual void shutdown (void) = 0;
// Deactivate any internal threads, clients can destroy the object
// after calling this method.
virtual int schedule_timer (TAO_EC_Timeout_Filter* filter,
const ACE_Time_Value& delta,
const ACE_Time_Value& interval) = 0;
// Add a timer at the given priority, returns the timer ID.
virtual int cancel_timer (const TAO_EC_QOS_Info& info,
int id) = 0;
// Cancel a timer at the given priority.
};
// ****************************************************************
class TAO_ORBSVCS_Export TAO_EC_Timeout_Adapter : public ACE_Event_Handler
{
// = TITLE
// Adapt the EC_Filter interface as an Event_Handler.
//
// = DESCRIPTION
// ACE timer queues (including the reactor) use Event_Handlers to
// dispatch events, but we want to receive them in EC_Filters,
// this class is and adaptor for that purpose.
//
public:
TAO_EC_Timeout_Adapter (void);
// Default construction.
private:
virtual int handle_timeout (const ACE_Time_Value &tv,
const void *act);
// Casts <act> to EC_Filter and dispatches an event to it.
};
#if defined (__ACE_INLINE__)
#include "EC_Timeout_Generator.i"
#endif /* __ACE_INLINE__ */
#endif /* TAO_EC_TIMEOUT_GENERATOR_H */
|