Changes between Version 22 and Version 23 of Documentation/Tutorial/PingPong


Ignore:
Timestamp:
Jan 22, 2009, 10:11:55 PM (16 years ago)
Author:
huebsch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Tutorial/PingPong

    v22 v23  
    178178}}}
    179179
    180 Everytime the timer 'fires', ''eventFunction'' is called on a node (lines 110-125). In this example, the initiator sends a message to every node that has joined up to this point in time. To accomplish this, it iterates through all established links (line 119), builts a message for every link and finally sends the message using the Base Overlay in ''Ariba''.
    181 
     180Everytime the timer 'fires', ''eventFunction'' is called on a node (lines 110-125). In this example, the initiator sends a message to every node that has joined up to this point in time. To accomplish this, it iterates through all established links (line 119), builts a message for every link and finally sends the message using the Base Overlay in ''Ariba''. We will now take a short look at how such a message is composed in the ping pong example.
     181
     182{{{
     18301 #include "PingPongMessage.h"
     18402
     18503 namespace ariba {
     18604 namespace application {
     18705 namespace pingpong {
     18806
     18907 vsznDefault(PingPongMessage);
     19008
     19109 PingPongMessage::PingPongMessage() : id(0) {
     19210 }
     19311
     19412 PingPongMessage::PingPongMessage(uint8_t _id) : id(_id) {
     19513 }
     19614
     19715 PingPongMessage::~PingPongMessage(){
     19816 }
     19917
     20018 string PingPongMessage::info(){
     20119      return "ping pong message id " + ariba::utility::Helper::ultos(id);
     20220 }
     20321
     20422 uint8_t PingPongMessage::getid(){
     20523      return id;
     20624 }
     20725
     20826 }}} // namespace ariba, appplication, pingpong
     209}}}
     210
     211Lines 01-26 show the whole !PingPongMessage.cpp. One can see here that defining message types in Ariba is pretty simple. As the message in our case is empty and not of higher importantance, we refer the reader to the documentation for details.
     212