From 0541139e04ea8e64dc088793463b64566f932080 Mon Sep 17 00:00:00 2001
From: fcolin
Date: Thu, 1 Feb 2007 13:12:46 +0000
Subject: Utilisateur : Fcolin Date : 10/06/02 Heure : 13:14 Créé
Commentaire: (vss 1)
---
IvyTest/IvyTest.vcproj | 138 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
create mode 100644 IvyTest/IvyTest.vcproj
(limited to 'IvyTest')
diff --git a/IvyTest/IvyTest.vcproj b/IvyTest/IvyTest.vcproj
new file mode 100644
index 0000000..2a95bb0
--- /dev/null
+++ b/IvyTest/IvyTest.vcproj
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1
From 06cb0b424e1da4ab03292dd0e01d5b63f5448f0c Mon Sep 17 00:00:00 2001
From: fcolin
Date: Thu, 1 Feb 2007 13:12:47 +0000
Subject: Utilisateur : Fcolin Date : 2/07/02 Heure : 15:21 Archivé
dans $/Bus/IvyTest Commentaire: (vss 2)
---
IvyTest/IvyTest.vcproj | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'IvyTest')
diff --git a/IvyTest/IvyTest.vcproj b/IvyTest/IvyTest.vcproj
index 2a95bb0..59becba 100644
--- a/IvyTest/IvyTest.vcproj
+++ b/IvyTest/IvyTest.vcproj
@@ -74,9 +74,10 @@
+
+#include
+
+#include "ivy.h"
+#include "IvyApplication.h"
+
+static bool TheGrassIsGreenAndTheWindBlows = true;
+
+class cIvyTranslater : public IvyApplicationCallback
+{
+public:
+ cIvyTranslater(void);
+ ~cIvyTranslater();
+protected:
+ void OnApplicationConnected ( IvyApplication *app );
+ void OnApplicationDisconnected( IvyApplication *app );
+ void HelloCallback ( IvyApplication *app, int argc, const char **argv );
+ void ByeCallback ( IvyApplication *app, int argc, const char **argv );
+ Ivy *bus;
+};
+
+
+
+cIvyTranslater::cIvyTranslater(void)
+{
+ // initialization
+ bus = new Ivy( "cIvyTranslater","cIvyTranslater READY",this,FALSE);
+
+ int count;
+ count = bus->BindMsg( "^Hello(.*)", BUS_CALLBACK_OF(cIvyTranslater, HelloCallback ));
+ count = bus->BindMsg( "^Bye$", BUS_CALLBACK_OF(cIvyTranslater, ByeCallback ));
+
+ bus->start(NULL);
+}
+cIvyTranslater::~cIvyTranslater(void)
+{
+ bus->stop();
+ delete bus;
+}
+
+void cIvyTranslater::HelloCallback(IvyApplication *app, int argc, const char **argv)
+{
+ const char* arg = (argc < 1) ? "" : argv[0];
+ cout << "cIvyTranslater received msg: Hello'" << arg << "'" << endl;
+ bus->SendMsg( "Bonjour%s!", arg );
+}
+
+void cIvyTranslater::ByeCallback(IvyApplication *app, int argc, const char **argv)
+{
+ cout << "cIvyTranslater stops bus" << endl;
+ if (bus) {
+ TheGrassIsGreenAndTheWindBlows = false;
+ // This is causing the fatal bug
+// bus->stop();
+// delete bus; // This statement is never reached! Don't know why!
+ }
+
+}
+
+void cIvyTranslater::OnApplicationConnected(IvyApplication *app)
+{
+ cout << "cIvyTranslater is ready to accept messages from " << app->GetName() << endl;
+}
+
+void cIvyTranslater::OnApplicationDisconnected(IvyApplication *app)
+{
+ cout << "cIvyTranslater good buy '" << app->GetName() << "'" << endl;
+}
+
+
+void main(int argc, char* argv[])
+{
+ cIvyTranslater aIvyTL;
+
+ while (TheGrassIsGreenAndTheWindBlows) {
+ Sleep(2000);
+ cout << "new cycle..." << endl;
+ }
+ cout << "Good buy, world\n";
+}
\ No newline at end of file
--
cgit v1.1
From b47607d2c5d06f78c1aac2d541da8e9a88484a4f Mon Sep 17 00:00:00 2001
From: fcolin
Date: Thu, 1 Feb 2007 13:12:55 +0000
Subject: Utilisateur : Fcolin Date : 2/07/02 Heure : 15:21 Archivé
dans $/Bus/IvyTest Commentaire: (vss 2)
---
IvyTest/ivytest.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'IvyTest')
diff --git a/IvyTest/ivytest.cpp b/IvyTest/ivytest.cpp
index b9121ac..370901e 100644
--- a/IvyTest/ivytest.cpp
+++ b/IvyTest/ivytest.cpp
@@ -1,10 +1,11 @@
// ivytest.cpp : Defines the entry point for the console application.
//
-#include
+#include
#include
+using namespace std;
-#include "ivy.h"
+#include "Ivy.h"
#include "IvyApplication.h"
static bool TheGrassIsGreenAndTheWindBlows = true;
--
cgit v1.1