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. |
| 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. |
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). |
| 109 | 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). |
| 110 | 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). 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 | |
| 112 | After starting up, a service need to bind to the SpoVNet Base Overlay with its service ID (lines 44/45). |