diff options
author | fcolin | 2007-02-01 13:01:29 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 13:01:29 +0000 |
commit | c015cda281027bf04d8bfa2ec4e44b7f594c4379 (patch) | |
tree | 466799308eee83feadb5ed918af0b9a64fa0e934 /Bus/Ivy/IvyCallback.h | |
parent | e1866e558a98ec7916566d1eaee933b83bbc8ae6 (diff) | |
download | ivy-cplusplus-c015cda281027bf04d8bfa2ec4e44b7f594c4379.zip ivy-cplusplus-c015cda281027bf04d8bfa2ec4e44b7f594c4379.tar.gz ivy-cplusplus-c015cda281027bf04d8bfa2ec4e44b7f594c4379.tar.bz2 ivy-cplusplus-c015cda281027bf04d8bfa2ec4e44b7f594c4379.tar.xz |
Utilisateur : Fcolin Date : 1/06/06 Heure : 10:14 Archivé dans $/Bus/Ivy Commentaire: ajout Binding Callback et SetFilter (vss 10)
Diffstat (limited to 'Bus/Ivy/IvyCallback.h')
-rw-r--r-- | Bus/Ivy/IvyCallback.h | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/Bus/Ivy/IvyCallback.h b/Bus/Ivy/IvyCallback.h index 78aff80..ede0ef4 100644 --- a/Bus/Ivy/IvyCallback.h +++ b/Bus/Ivy/IvyCallback.h @@ -103,16 +103,73 @@ public: }
virtual void OnApplicationConnected (IvyApplication *app)
{
- (*ApplicationConnectedCb) (app);
+ if ( ApplicationConnectedCb ) (*ApplicationConnectedCb) (app);
};
virtual void OnApplicationDisconnected (IvyApplication *app)
{
- (*ApplicationDisconnectedCb) (app);
+ if ( ApplicationDisconnectedCb ) (*ApplicationDisconnectedCb) (app);
};
/* raccourci d'ecriture */
#define BUS_APPLICATION_CALLBACK( conn, disconn ) new IvyApplicationCallbackFunction( conn, disconn )
};
+
+/* Binding Callback */
+
+class IvyBindingCallback {
+public:
+ virtual void OnAddBind (IvyApplication *app, int id, const char * regexp) = 0;
+ virtual void OnRemoveBind (IvyApplication *app, int id, const char * regexp) = 0;
+ virtual void OnFilterBind (IvyApplication *app, int id, const char * regexp) = 0;
+ virtual ~IvyBindingCallback()
+ {
+ }
+};
+class IvyBindingNullCallback : public IvyBindingCallback {
+public:
+ virtual void OnAddBind (IvyApplication *app, int id, const char * regexp)
+ {};
+ virtual void OnRemoveBind (IvyApplication *app, int id, const char * regexp)
+ {};
+ virtual void OnFilterBind (IvyApplication *app, int id, const char * regexp)
+ {};
+ virtual ~IvyBindingNullCallback()
+ {
+ }
+};
+// Static function CB
+class IvyBindingCallbackFunction: public IvyBindingCallback {
+public:
+ typedef void ( *IvyBindingCallback_fun )( IvyApplication *app, int id, const char * regexp );
+ IvyBindingCallback_fun BindingAddCb;
+ IvyBindingCallback_fun BindingRemoveCb;
+ IvyBindingCallback_fun BindingFilterCb;
+
+public:
+ IvyBindingCallbackFunction ( IvyBindingCallback_fun add_cb, IvyBindingCallback_fun remove_cb, IvyBindingCallback_fun filter_cb )
+ : BindingAddCb( add_cb ), BindingRemoveCb( remove_cb ), BindingFilterCb( filter_cb )
+ {
+ }
+ ~IvyBindingCallbackFunction ()
+ {
+ }
+ virtual void OnAddBind (IvyApplication *app, int id, const char * regexp)
+ {
+ if(BindingAddCb) (*BindingAddCb) (app, id, regexp);
+ };
+ virtual void OnRemoveBind (IvyApplication *app, int id, const char * regexp)
+ {
+ if (BindingRemoveCb) (*BindingRemoveCb) (app, id, regexp);
+ };
+ virtual void OnFilterBind (IvyApplication *app, int id, const char * regexp)
+ {
+ if(BindingFilterCb ) (*BindingFilterCb) (app, id, regexp);
+ };
+
+/* raccourci d'ecriture */
+#define BUS_BINDING_CALLBACK( add, remove, filter ) new IvyBindingCallbackFunction( add, remove, filter )
+};
+
/* Callback for the die Message */
class IvyDieCallback {
public:
|