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