summaryrefslogtreecommitdiff
path: root/examples/CORBA
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
commita5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch)
treebcf0a25c3d45a209a6e3ac37b233a4812f29c732 /examples/CORBA
downloadATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz
Initial revision
Diffstat (limited to 'examples/CORBA')
-rw-r--r--examples/CORBA/Makefile65
-rw-r--r--examples/CORBA/Test.idl6
-rw-r--r--examples/CORBA/Test_i.cpp10
-rw-r--r--examples/CORBA/Test_i.h14
-rw-r--r--examples/CORBA/client.cpp26
-rw-r--r--examples/CORBA/server.cpp37
6 files changed, 158 insertions, 0 deletions
diff --git a/examples/CORBA/Makefile b/examples/CORBA/Makefile
new file mode 100644
index 00000000000..5ca20af9257
--- /dev/null
+++ b/examples/CORBA/Makefile
@@ -0,0 +1,65 @@
+#----------------------------------------------------------------------------
+# @(#)Makefile 1.1 10/18/96
+#
+# Makefile for the ACE_MT_CORBA_Handler tests
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+SRC = Test_i.cpp client.cpp server.cpp
+
+SVR_OBJS = TestS.o Test_i.o server.o
+CLT_OBJS = TestC.o client.o
+
+LDLIBS =
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU
+include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Orbix related macros and target settings.
+#----------------------------------------------------------------------------
+
+ORBIX_BINDIR = $(ORBIX_ROOT)/bin
+ORBIX_LIBDIR = $(ORBIX_ROOT)/lib
+ORBIX_INCDIR = $(ORBIX_ROOT)/include
+
+CPPFLAGS += -DEXCEPTIONS -I$(ORBIX_INCDIR) -DWANT_ORBIX_FDS
+LDFLAGS += -L$(ORBIX_LIBDIR) -R $(ORBIX_LIBDIR)
+
+IDLFLAGS = -s S.cpp -c C.cpp -B
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+all: client server
+
+client: $(addprefix $(VDIR),$(CLT_OBJS))
+ $(LINK.cc) -o client $(addprefix $(VDIR),$(CLT_OBJS)) $(LDFLAGS) -lITsrvmt $(VLDLIBS)
+
+server: $(addprefix $(VDIR),$(SVR_OBJS))
+ $(LINK.cc) -o server $(addprefix $(VDIR),$(SVR_OBJS)) $(LDFLAGS) -lITsrvmt $(VLDLIBS)
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/examples/CORBA/Test.idl b/examples/CORBA/Test.idl
new file mode 100644
index 00000000000..33e8adce847
--- /dev/null
+++ b/examples/CORBA/Test.idl
@@ -0,0 +1,6 @@
+interface Test
+// @(#)Test.idl 1.1 10/18/96
+
+{
+ void method (in long input1);
+};
diff --git a/examples/CORBA/Test_i.cpp b/examples/CORBA/Test_i.cpp
new file mode 100644
index 00000000000..2f7c4301470
--- /dev/null
+++ b/examples/CORBA/Test_i.cpp
@@ -0,0 +1,10 @@
+#include "Test_i.h"
+// @(#)Test_i.cpp 1.1 10/18/96
+
+
+void
+Test_i::method (long input,
+ ACE_CORBA_1 (Environment) &)
+{
+ ACE_DEBUG ((LM_DEBUG, "received a number %d\n", input));
+}
diff --git a/examples/CORBA/Test_i.h b/examples/CORBA/Test_i.h
new file mode 100644
index 00000000000..1e8b8c471bd
--- /dev/null
+++ b/examples/CORBA/Test_i.h
@@ -0,0 +1,14 @@
+/* -*- C++ -*- */
+// @(#)Test_i.h 1.1 10/18/96
+
+#include "ace/Log_Msg.h"
+#include "Test.hh"
+
+class Test_i
+{
+public:
+ virtual void method (long input,
+ ACE_CORBA_1 (Environment) &IT_env = ACE_CORBA_1 (default_environment));
+};
+
+DEF_TIE_Test (Test_i)
diff --git a/examples/CORBA/client.cpp b/examples/CORBA/client.cpp
new file mode 100644
index 00000000000..8538bcc2eda
--- /dev/null
+++ b/examples/CORBA/client.cpp
@@ -0,0 +1,26 @@
+#include "ace/Log_Msg.h"
+// @(#)client.cpp 1.1 10/18/96
+
+#include "Test.hh"
+
+int
+main (int argc, char *argv[])
+{
+ char *host = argc == 2 ? argv[1] : ACE_DEFAULT_SERVER_HOST;
+
+ Test_var my_test;
+
+ TRY {
+ my_test = Test::_bind ("", host, IT_X);
+ my_test->method (5);
+ } CATCHANY {
+ cerr << IT_X << endl;
+ return -1;
+ } ENDTRY;
+
+ ACE_DEBUG ((LM_DEBUG, "everything works!\n"));
+
+ // Memory for my_test is automatically released by destructor of
+ // smart pointer.
+ return 0;
+}
diff --git a/examples/CORBA/server.cpp b/examples/CORBA/server.cpp
new file mode 100644
index 00000000000..89cccefcee8
--- /dev/null
+++ b/examples/CORBA/server.cpp
@@ -0,0 +1,37 @@
+#include "ace/Service_Config.h"
+// @(#)server.cpp 1.1 10/18/96
+
+#include "ace/CORBA_Handler.h"
+#include "Test_i.h"
+
+#if defined (ACE_HAS_ORBIX)
+
+#if defined (ACE_HAS_MT_ORBIX)
+typedef ACE_MT_CORBA_Handler CORBA_HANDLER;
+#else
+typedef ACE_ST_CORBA_Handler CORBA_HANDLER;
+#endif /* ACE_HAS_MT_ORBIX */
+
+int
+main (int argc, char *argv[])
+{
+ ACE_Service_Config daemon;
+
+ char pwd[BUFSIZ];
+ char app[BUFSIZ];
+
+ ACE_OS::getcwd (pwd, sizeof pwd);
+ ACE_OS::sprintf (app, "%s/%s", pwd, argv[0]);
+
+ if (CORBA_HANDLER::instance ()->activate_service (Test_IMPL, 0, app) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "Could not activate services for supplier\n"), -1);
+
+ TIE_Test (Test_i) test (new Test_i);
+
+ for (;;)
+ if (CORBA_HANDLER::instance ()->reactor ()->handle_events () == -1)
+ break;
+
+ return 0;
+}
+#endif /* ACE_HAS_ORBIX */