]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/src/BCMP/EventHandler.hpp
This commit was generated by cvs2svn to compensate for changes in r11742,
[u/mrichter/AliRoot.git] / HLT / MUON / src / BCMP / EventHandler.hpp
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Author: Artur Szostak
4 // Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 #ifndef dHLT_BCMP_EVENT_HANDLER_HPP
9 #define dHLT_BCMP_EVENT_HANDLER_HPP
10
11 #include "BCMP/EventQueue.hpp"
12
13 #include <iostream>
14 using std::endl;
15 using std::cerr;
16
17 namespace dHLT
18 {
19 namespace BCMP
20 {
21
22
23 class EventHandler
24 {
25 public:
26         
27         /* Called whenever a new sender or receiver has connected.
28          */
29         virtual void OnConnect(const System::Address& address) {};
30         
31         /* Called whenever a sender or receiver has disconnected.
32          */
33         virtual void OnDisconnect(const System::Address& address) {};
34         
35         /* Called whenever a connection timed out and was lost.
36          */
37         virtual void OnConnectionLost(const System::Address& address) {};
38         
39         /* Called when a message has been received.
40          */
41         virtual void OnMessage(
42                         const char* message, const UInt length,
43                         const System::Address& from
44                 ) {};
45         
46         /* Called when a protocol error message has been received.
47            The default behaviour is to write the message to standard output.
48          */
49         virtual void OnError(
50                         const char* message, const Int errorcode,
51                         const System::Address& from
52                 )
53         {
54                 cerr << "Error: [" << errorcode << "] from " << from << endl;
55                 cerr << "       " << message << endl;
56         };
57 };
58
59
60 } // BCMP
61 } // dHLT
62
63 #endif // dHLT_BCMP_EVENT_HANDLER_HPP