Changes between Version 16 and Version 17 of Documentation/Tutorial/PingPong


Ignore:
Timestamp:
Jan 22, 2009, 9:14:47 PM (16 years ago)
Author:
huebsch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Tutorial/PingPong

    v16 v17  
    454526 }
    4646}}}
    47 The ''main.cpp'' serves us as an entry point to the application. In the first lines we include class definitions we need here (e.g. strings because we want to handle some). Also, we include the StartupWrapper class that comes with ''Ariba''. It provides some handy helpers for initialization. Finally, we need to include the ''PingPong.h'', because this is the actual thing we want to execute.
    48 Then, we declare the used namespaces (lines 05-07) to be able to use the functionalities. Now we get to the main method, being our starting point. After determining the location of our config file, we initialize the system by passing the config file's location to the StartupWrapper and telling the same to start the architecture up (lines 11-15). Now we are ready to start the ping-pong service, which we first create (line 18). Then we declare the role of the node (initiator or joiner), which is written down in the config file as a bool value. Finally, we start the service up by calling the specific method in the StartupWrapper. Now the service will run until we press the enter button.
     47The ''main.cpp'' serves us as an entry point to the application. In the first lines we include class definitions we need here (e.g. strings because we want to handle some). Also, we include the !StartupWrapper class that comes with ''Ariba''. It provides some handy helpers for initialization. Finally, we need to include the ''!PingPong.h'', because this is the actual thing we want to execute.
     48Then, we declare the used namespaces (lines 05-07) to be able to use the functionalities. Now we get to the main method, being our starting point. After determining the location of our config file, we initialize the system by passing the config file's location to the !StartupWrapper and telling the same to start the architecture up (lines 11-15). Now we are ready to start the ping-pong service, which we first create (line 18). Then we declare the role of the node (initiator or joiner), which is written down in the config file as a bool value. Finally, we start the service up by calling the specific method in the !StartupWrapper. Now the service will run until we press the enter button.
    4949
    5050
    51 Now we look into the ''PingPong.cpp'', containing the actual ping pong code. We leave out .h files here because they only do definitions. Everyone intending to use ''Ariba'' should be familiar with the subject matter. The first parts look like this:
     51Now we look into the ''!PingPong.cpp'', containing the actual ping pong code. We leave out .h files here because they only do definitions. Everyone intending to use ''Ariba'' should be familiar with the subject matter. The first parts look like this:
    5252
    5353{{{
     
    737320 void PingPong::startup(UnderlayAbstraction* _abstraction){
    747421      abstraction = _abstraction;
    75 
    76 
    777522
    787623      logging_info( "starting up PingPong service ... " );
     
    109107First we include the .h file, define the namespace, turn logging functionality on (line 07) and set the ID of the Service. Every service using ''Ariba'' is connected to a specific ID that may be chosen initially and arbitrarily. This ID serves ''Ariba'' to distinguish between several services that may use it concurrently. Via ''setMode'' (lines 16-18) one can indicate which node in the example should start the packet sending process. This method is called in main.cpp after getting the specific information from the config file.
    110108
    111 The ''startup'' method (lines 20-51) is called from the StartupWrapper, jolting the operation of the ping pong service. With its call, the StartupWrapper passes an ''UnderlayAbstraction'' object to the service, being the main object for communication between the service and ''Ariba'' (lines 20/21).
    112 When starting up, the service chooses a servcie ID (line 25). Then, it creates a node ID for the SpoVNet node it represents in the instance, under usage of potential base information deposited in the config file (lines 27-29). Same applies to its locator (lines 31-33) and the port (lines 35-37).
     109The ''startup'' method (lines 20-51) is called from the !StartupWrapper, jolting the operation of the ping pong service. With its call, the !StartupWrapper passes an ''!UnderlayAbstraction'' object to the service, being the main object for communication between the service and ''Ariba'' (lines 20/21).
     110When starting up, the service chooses a servcie ID (line 25). Then, it creates a node ID for the SpoVNet node it represents in the instance, under usage of potential base information deposited in the config file (lines 27-29). Same applies to its locator (lines 31-33) and the port (lines 35-37). Then we get to the point where we decide the role of the specific ping pong instance (initiator versus joiner) (lines 39-42). Remember that we got this information in line 17. If the starting node is the initiator of the SpoVNet instance, it creates the SpoVNet, specifying its SpoVNetID, NodeID, Locator and Port (line 40). In contrast, other nodes join the instance, providing the same parameters (line 42).
     111
     112After starting up, a service need to bind to the SpoVNet Base Overlay with its service ID (lines 44/45).
    113113 
    114114