diff options
author | fourdan | 2006-05-24 13:02:58 +0000 |
---|---|---|
committer | fourdan | 2006-05-24 13:02:58 +0000 |
commit | e5596cb2311ae3b8ac7d3b9f9f7dbd0e842fde80 (patch) | |
tree | eb5eb30932b0f2dc58fbf8292e82ff88258591e5 /testIvy.cxx | |
parent | 23abb4b87c7e40ed259dd02f653516f60e55ade4 (diff) | |
download | ivy-cplusplus-e5596cb2311ae3b8ac7d3b9f9f7dbd0e842fde80.zip ivy-cplusplus-e5596cb2311ae3b8ac7d3b9f9f7dbd0e842fde80.tar.gz ivy-cplusplus-e5596cb2311ae3b8ac7d3b9f9f7dbd0e842fde80.tar.bz2 ivy-cplusplus-e5596cb2311ae3b8ac7d3b9f9f7dbd0e842fde80.tar.xz |
Initial revision
Diffstat (limited to 'testIvy.cxx')
-rw-r--r-- | testIvy.cxx | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/testIvy.cxx b/testIvy.cxx new file mode 100644 index 0000000..53d83d8 --- /dev/null +++ b/testIvy.cxx @@ -0,0 +1,87 @@ +/* + * Ivy probe + * + * Copyright (C) 1997-1999 + * Centre d'Études de la Navigation Aérienne + * + * Main and only file + * + * Authors: François-Régis Colin <colin@cenatoulouse.dgac.fr> + * + * $Id$ + * + * Please refer to file version.h for the + * copyright notice regarding this software + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <sys/time.h> +#include <unistd.h> +#include <X11/Intrinsic.h> +#include "Ivy.h" +#include "IvyApplication.h" + + +class IvyTest : public IvyApplicationCallback, public IvyMessageCallback { +public: + Ivy *bus; + void Start(); + void OnApplicationConnected(IvyApplication *app); + void OnApplicationDisconnected(IvyApplication *app); + void OnMessage(IvyApplication *app, int argc, const char **argv); + IvyTest(); +}; +IvyTest :: IvyTest() +{ +} +void IvyTest :: Start() +{ + bus = new Ivy( "TestIvy", "TestIvy READY", this ); + bus->BindMsg( "(.*)", this ); + bus->start(NULL); +} +void IvyTest :: OnMessage(IvyApplication *app, int argc, const char **argv) +{ + int i; + printf ("%s sent ",app->GetName()); + for (i = 0; i < argc; i++) + printf(" '%s'",argv[i]); + printf("\n"); +} +void IvyTest :: OnApplicationConnected (IvyApplication *app) +{ + const char *appname; + const char *host; + appname = app->GetName(); + host = app->GetHost(); + + printf("%s connected from %s\n", appname, host); + +} +void IvyTest :: OnApplicationDisconnected (IvyApplication *app) +{ + const char *appname; + const char *host; + appname = app->GetName (); + host = app->GetHost(); + + printf("%s disconnected from %s\n", appname, host); +} + +int main(int argc, char *argv[]) +{ + XtAppContext cntx = XtCreateApplicationContext(); + IvyTest test; + test.bus->setXtAppContext(cntx); + + test.Start(); + + XtAppMainLoop (cntx); + + return 0; +} + + |