source: sample/pingpong/PingPong.h@ 2445

Last change on this file since 2445 was 2413, checked in by Christoph Mayer, 16 years ago

-letzte fixes von tidy umstellung

File size: 1.5 KB
Line 
1#ifndef __PINGPONG_H_
2#define __PINGPONG_H_
3
4#include "ariba/ariba.h"
5#include "PingPongMessage.h"
6
7using namespace ariba;
8
9#include "ariba/utility/system/StartupInterface.h"
10#include "ariba/utility/system/Timer.h"
11using ariba::utility::StartupInterface;
12using ariba::utility::Timer;
13
14namespace ariba {
15namespace application {
16namespace pingpong {
17
18/**
19/* The PingPong main class
20/* This class implements an example service for demonstration purposes
21/* The pingpong class sends and receives messages between two SpoVNet
22/* instances
23**/
24class PingPong :
25 public NodeListener,
26 public CommunicationListener,
27 public StartupInterface,
28 public Timer {
29
30 use_logging_h(PingPong);
31
32public:
33 PingPong();
34 virtual ~PingPong();
35
36protected:
37 // communication listener interface
38 virtual bool onLinkRequest(const NodeID& remote, Message* msg);
39 virtual void onMessage(Message* msg, const NodeID& remote, const LinkID& lnk);
40
41 // node listener interface
42 virtual void onJoinCompleted( const SpoVNetID& vid );
43 virtual void onJoinFailed( const SpoVNetID& vid );
44
45 // startup wrapper interface
46 virtual void startup();
47 virtual void shutdown();
48
49 // timer events
50 virtual void eventFunction();
51
52private:
53 // the ariba module and a node
54 AribaModule* ariba;
55 Node* node;
56
57 // flag, wheter this node is the initiator of this spovnet
58 bool isInitiator;
59
60 // the ping pong service id
61 static ServiceID PINGPONG_ID;
62
63 // the current ping id
64 unsigned long pingId;
65};
66
67//ARIBA_SIMULATION_SERVICE(PingPong);
68
69}}} // namespace ariba, application, pingpong
70
71#endif // __PINGPONG_H_
Note: See TracBrowser for help on using the repository browser.