diff options
author | bustico | 2011-01-25 16:27:07 +0000 |
---|---|---|
committer | bustico | 2011-01-25 16:27:07 +0000 |
commit | 018db51fa49c2761516f4377a4958a2ce5b91fe3 (patch) | |
tree | 5c6624c3f88148bc1c9941c7aa5d0eedd7bef320 /testIvyXt.cxx | |
parent | c55fdd5c11903b4a7f8d706f7065997410c154c7 (diff) | |
download | ivy-cplusplus-018db51fa49c2761516f4377a4958a2ce5b91fe3.zip ivy-cplusplus-018db51fa49c2761516f4377a4958a2ce5b91fe3.tar.gz ivy-cplusplus-018db51fa49c2761516f4377a4958a2ce5b91fe3.tar.bz2 ivy-cplusplus-018db51fa49c2761516f4377a4958a2ce5b91fe3.tar.xz |
-add a Qt flavor of ivy c++ library
-add testIvyQt to show how to use ivy-c++ with Qt
-fix testIvyXt
--Cette ligne, et les suivantes ci-dessous, seront ignorees--
D ivyprobe.c
A + testIvyXt.cxx
AM ivyqtloop.h
M Ivycpp.h
A ivyqtloop.cxx
D testIvy.cxx
M Ivy.cxx
A ivy-c++.readme
A testIvyQt.cxx
M Makefile
Diffstat (limited to 'testIvyXt.cxx')
-rw-r--r-- | testIvyXt.cxx | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/testIvyXt.cxx b/testIvyXt.cxx new file mode 100644 index 0000000..4b51847 --- /dev/null +++ b/testIvyXt.cxx @@ -0,0 +1,116 @@ +/* + * 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 <iostream> +#include <fstream> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <sys/time.h> +#include <unistd.h> +#include <X11/Intrinsic.h> + +#define USE_XT + +#include "Ivycpp.h" +#include "IvyApplication.h" + + +class IvyTest : public IvyApplicationCallback, public IvyMessageCallback { +public: + Ivy *bus; + void Start(); + void OnApplicationConnected(IvyApplication *app); + void OnApplicationDisconnected(IvyApplication *app); + void OnApplicationCongestion(IvyApplication *app); + void OnApplicationDecongestion(IvyApplication *app); + void OnApplicationFifoFull(IvyApplication *app); + void OnMessage(IvyApplication *app, int argc, const char **argv); + IvyTest(); + +private: + + static void ivyAppConnCb( IvyApplication *app ) {}; + static void ivyAppDiscConnCb( IvyApplication *app ) {}; +}; + +IvyTest :: IvyTest() +{ +} +void IvyTest :: Start() +{ + bus = new Ivy( "TestIvy", "TestIvy READY", + BUS_APPLICATION_CALLBACK( ivyAppConnCb, ivyAppDiscConnCb ),false); + 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); +} + +void IvyTest::OnApplicationCongestion(IvyApplication *app) +{ + std::cerr << "Ivy Congestion notififation\n"; +} +void IvyTest::OnApplicationDecongestion(IvyApplication *app) +{ + std::cerr << "Ivy Decongestion notififation\n"; +} +void IvyTest::OnApplicationFifoFull(IvyApplication *app) +{ + std::cerr << "Ivy FIFO Full notififation : MESSAGE WILL BE LOST\n"; +} + +int main(int argc, char *argv[]) +{ + XtAppContext cntx = XtCreateApplicationContext(); + IvyTest test; + test.bus->setXtAppContext(cntx); + + test.Start(); + + XtAppMainLoop (cntx); + + return 0; +} + + |