blob: 7a29bc03c23bf0621d312dcf5a5696017f04b4bb (
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
|
// $Id$
// The famous Dining Philosopher example in CCM tutorial slides
module Example
{
exception InUse {};
interface Fork
/**
* Provided facet interface definition.
* It should be defined by the IDL file.
*/
{
void get () raises (InUse);
void release ();
};
component ForkManager
{
provides Fork the_fork;
};
home ForkHome manages ForkManager
{
};
enum PhilosopherState
{
EATING,
THINKING,
HUNGRY,
STARVING,
DEAD
};
eventtype StatusInfo
{
public string name;
public PhilosopherState state;
public unsigned long ticks_since_last_meal;
public boolean has_left_fork;
public boolean has_right_fork;
};
component Philosopher
{
attribute string name;
// The left fork receptacle.
uses Fork left;
// The right fork receptacle.
uses Fork right;
// The status info event source.
publishes StatusInfo info;
};
home PhilosopherHome manages Philosopher
{
factory new (in string name);
};
component Observer
{
// The status info sink port.
consumes StatusInfo info;
};
home ObserverHome manages Observer
{
};
};
|