summaryrefslogtreecommitdiff
path: root/CIAO/examples/Philosophers/Philosophers.idl
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/examples/Philosophers/Philosophers.idl')
-rw-r--r--CIAO/examples/Philosophers/Philosophers.idl75
1 files changed, 75 insertions, 0 deletions
diff --git a/CIAO/examples/Philosophers/Philosophers.idl b/CIAO/examples/Philosophers/Philosophers.idl
new file mode 100644
index 00000000000..7a29bc03c23
--- /dev/null
+++ b/CIAO/examples/Philosophers/Philosophers.idl
@@ -0,0 +1,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
+ {
+ };
+};