IPDL/Getting started: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 22: Line 22:


   '''protocol''' Plugin {
   '''protocol''' Plugin {
    '''out''' Init();
  '''child''':
     '''out''' Deinit();
    Init();
     Deinit();
   };
   };


This code defines a <code>Plugin</code> protocol.  On the next two lines, the code declares two messages, <code>Init()</code> and <code>Deinit()</code>.  We will describe the messages in more detail in the next section.  To finish the introduction of protocols and actors, note the <code>'''out'''</code> keywords used on the 2nd and 3rd lines.  This keyword defines the ''direction'' of the message --- that is, whether the message is sent from the parent actor to the child, from the child to the parent, or both ways.
This code defines a <code>Plugin</code> protocol.  On the next three lines, the code declares two messages, <code>Init()</code> and <code>Deinit()</code>.  We will describe the messages in more detail in the next section.  To finish the introduction of protocols and actors, note the <code>'''child'''</code> keywords used on the 2nd and 3rd lines.  This keyword says that ''child'' "accepts" the messages declared under that "child" label.  That is, the parent actor can send those messages to the child, but the child cannot send those messages to the parent.
 
'''Important''': protocols are written from the perspective of the parent actor.  An <code>'''out'''</code> specifier means that the message is only sent ''out'' from the parent, ''to'' the child.  This choice was completely arbitrary.


== Messages ==
== Messages ==
Confirmed users
699

edits

Navigation menu