1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
// IvyCallback.h : Interface for the IvyMessageCallback Class
// : Interface for the IvyDirectMessageCallback Class
// : Interface for the IvyApplicationCallback Class
//
/////////////////////////////////////////////////////////////////////////////
// Description :
//
/////////////////////////////////////////////////////////////////////////////
//
// $Header: /libIvy/IvyCallback.h 5 16/03/99 10:59 Fcolin $
// $Modtime: 16/03/99 10:26 $
/* --------------------------------------------------------
* $History: IvyCallback.h $
*
* ***************** Version 5 *****************
* User: Fcolin Date: 16/03/99 Time: 10:59
* Updated in $/libIvy
*
* ***************** Version 4 *****************
* User: Fcolin Date: 12/03/99 Time: 18:53
* Updated in $/libIvy
*
* ***************** Version 3 *****************
* User: Fcolin Date: 12/03/99 Time: 18:16
* Updated in $/libIvy
* Modif Api Callback
* --------------------------------------------------------
*/
#ifndef IvyCallback_H_
#define IvyCallback_H_
class IvyApplication;
/* Callback for the normal bus Message */
/* Callback for the normal bus Message */
class IvyMessageCallback {
public:
virtual void OnMessage (IvyApplication *app, int argc, const char **argv )=0;
virtual ~IvyMessageCallback()
{
}
};
class IvyMessageCallbackFunction: public IvyMessageCallback {
public:
typedef void ( *IvyMessageCallback_fun )( IvyApplication *app, int argc, const char **argv );
IvyMessageCallback_fun MessageCb;
public:
IvyMessageCallbackFunction ( IvyMessageCallback_fun m_cb ) : MessageCb( m_cb )
{
}
~IvyMessageCallbackFunction ()
{
}
void OnMessage (IvyApplication *app, int argc, const char **argv)
{
(*MessageCb) (app, argc, argv);
}
/* raccourci d'ecriture */
#define BUS_CALLBACK( m ) new IvyMessageCallbackFunction( m )
};
/* template Class Callback for the normal bus Message */
template <class T> class IvyMessageCallbackOf : public IvyMessageCallback {
protected:
T* Object;
typedef void ( T::*IvyMessageCallback_fun )( IvyApplication *app, int argc, const char **argv );
IvyMessageCallback_fun MessageCb;
public:
IvyMessageCallbackOf ( T* o, IvyMessageCallback_fun m_cb ) : Object (o), MessageCb( m_cb )
{
}
~IvyMessageCallbackOf ()
{
}
void OnMessage (IvyApplication *app, int argc, const char **argv)
{
(Object->*MessageCb) (app, argc, argv);
}
/* raccourci d'ecriture */
#define BUS_CALLBACK_OF( cl, m ) new IvyMessageCallbackOf<cl>( this, m )
};
/* Callback for the direct Message */
class IvyDirectMessageCallback {
public:
virtual void OnDirectMessage (IvyApplication *app, int id, const char *arg ) = 0;
};
/* Application Callback */
class IvyApplicationCallback {
public:
virtual void OnApplicationConnected (IvyApplication *app) = 0;
virtual void OnApplicationDisconnected (IvyApplication *app) = 0;
virtual ~IvyApplicationCallback()
{
}
};
/* Callback for the die Message */
class IvyDieCallback {
public:
virtual BOOL OnDie (IvyApplication *app, int id, const char *arg ) = 0;
virtual ~IvyDieCallback()
{
}
};
#endif /* IvyCallback_H_ */
|