summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-30 14:48:47 +0000
committersergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-30 14:48:47 +0000
commit8b948c33b8cc5eb953b2e27579c2ad3244778f79 (patch)
tree08c69ea1654481102698cf57d7416642c60dbc89
parenta6d11e142792c0f9c12a2bf23a7c3dc9a0bfbf54 (diff)
downloadATCD-8b948c33b8cc5eb953b2e27579c2ad3244778f79.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c26
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/Makefile106
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/README34
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/client.cpp747
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/client.h128
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/cubit.idl71
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.cpp189
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.h109
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/server.cpp149
-rw-r--r--TAO/tests/Cubit/COOL/IDL_Cubit/tmplinst.cpp15
10 files changed, 1574 insertions, 0 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 53d372f24da..3b1743c4aaa 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,5 +1,31 @@
Fri Jan 30 01:55:59 1998 Sergio Flores <sergio@polka.cs.wustl.edu>
+ * tests/Cubit/COOL/IDL_Cubit/README:
+ * tests/Cubit/COOL/IDL_Cubit/Makefile:
+ * tests/Cubit/COOL/IDL_Cubit/client.cpp:
+ * tests/Cubit/COOL/IDL_Cubit/client.h:
+ * tests/Cubit/COOL/IDL_Cubit/cubit.idl:
+ * tests/Cubit/COOL/IDL_Cubit/cubit_i.cpp:
+ * tests/Cubit/COOL/IDL_Cubit/cubit_i.h:
+ * tests/Cubit/COOL/IDL_Cubit/server.cpp:
+ * tests/Cubit/COOL/IDL_Cubit/tmplinst.cpp: Added test code for
+ Chorus COOL ORB, for the IDL Cubit example.
+
+ * tests/Thruput/COOL/README:
+ * tests/Thruput/COOL/Makefile:
+ * tests/Thruput/COOL/client.cpp:
+ * tests/Thruput/COOL/server.cpp:
+ * tests/Thruput/COOL/ttcp.idl:
+ * tests/Thruput/COOL/ttcp_decl.h:
+ * tests/Thruput/COOL/ttcp_i.cpp:
+ * tests/Thruput/COOL/ttcp_i.h:
+ * tests/Thruput/COOL/utils.cpp: Added test code for Chorus COOL
+ ORB, for the Thruput example.
+
+ * tests/Thruput/TAO/ttcp_decl.h: Make declarations of variables
+ consistent with definition. Changed srcDataSize from CORBA::ULong
+ to unsigned long.
+
* tests/Thruput/TAO/Makefile: Updated to use rules.tao.GNU. and
taoconfig.mk. This was suggested by a change Carlos O'Ryan did to
the long lost Thruput_test directory.
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/Makefile b/TAO/tests/Cubit/COOL/IDL_Cubit/Makefile
new file mode 100644
index 00000000000..5114253d385
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/Makefile
@@ -0,0 +1,106 @@
+#----------------------------------------------------------------------------
+# @(#)Makefile 1.1 10/18/96
+#
+# Makefile for the CHORUS COOL Cubit tests
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+IDL_SRC = cubit.cpp cubit.H sk_cubit.C sk_cubit.H
+
+SRC = $(IDL_SRC) cubit_i.cpp server.cpp client.cpp tmplinst.cpp
+
+SVR_OBJS = cubit_i.o server.o cubit.o tmplinst.o
+
+CLT_OBJS = client.o cubit.o tmplinst.o
+
+LDLIBS = -lm -lOrb-mt -lposix4
+
+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
+
+#----------------------------------------------------------------------------
+# CHORUS related macros and target settings.
+#----------------------------------------------------------------------------
+
+CHORUS_BINDIR = $(CHORUS_ROOT)/bin
+CHORUS_LIBDIR = $(CHORUS_ROOT)/lib
+CHORUS_INCDIR = $(CHORUS_ROOT)/include
+
+CPPFLAGS += -I$(CHORUS_INCDIR) -I$(CHORUS_ROOT)
+LDFLAGS += -L$(CHORUS_LIBDIR) -R $(CHORUS_LIBDIR) -L$(ACE)/ace
+IDLFLAGS = --stub-header --stub-impl --skeleton-header --skeleton-impl --no-local --binding Cubit Cubit_i --binding Cubit_Factory Cubit_Factory_i
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+all: $(IDL_SRC) server client
+
+$(IDL_SRC): cubit.idl
+ $(CHORUS_BINDIR)/chic $(IDLFLAGS) cubit.idl
+ -/bin/mv cubit.C cubit.cpp
+
+server: $(addprefix $(VDIR),$(SVR_OBJS))
+ $(LINK.cc) -o server $(addprefix $(VDIR),$(SVR_OBJS)) $(LDFLAGS) $(ITIIOP) $(ITSRV) $(VLDLIBS)
+
+client: $(addprefix $(VDIR),$(CLT_OBJS))
+ $(LINK.cc) -o client $(addprefix $(VDIR),$(CLT_OBJS)) $(LDFLAGS) $(ITIIOP) $(ITCLT) $(VLDLIBS)
+
+realclean: clean
+ -/bin/rm -rf cubit.cpp cubit.H sk_cubit.C sk_cubit.H server client
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/cubit.o .obj/cubit.so .shobj/cubit.o .shobj/cubit.so: cubit.cpp cubit.H \
+ /project/doc/miniCOOL/minicool.r4.3/solaris2.5-CC-mt/include/corba/longSeq.H
+.obj/sk_cubit.o .obj/sk_cubit.so .shobj/sk_cubit.o .shobj/sk_cubit.so: sk_cubit.C
+.obj/cubit_i.o .obj/cubit_i.so .shobj/cubit_i.o .shobj/cubit_i.so: cubit_i.cpp cubit_i.h cubit.H \
+ /project/doc/miniCOOL/minicool.r4.3/solaris2.5-CC-mt/include/corba/cool.H \
+ /project/doc/miniCOOL/minicool.r4.3/solaris2.5-CC-mt/include/corba/longSeq.H
+.obj/clnt.o .obj/clnt.so .shobj/clnt.o .shobj/clnt.so: clnt.cpp \
+ $(ACE_ROOT)/ace/Profile_Timer.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/inc_user_config.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/High_Res_Timer.h \
+ $(ACE_ROOT)/ace/High_Res_Timer.i \
+ $(ACE_ROOT)/ace/Profile_Timer.i \
+ $(ACE_ROOT)/ace/Env_Value_T.h \
+ $(ACE_ROOT)/ace/Env_Value_T.i clnt.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i cubit.H \
+ /project/doc/miniCOOL/minicool.r4.3/solaris2.5-CC-mt/include/corba/cool.H \
+ /project/doc/miniCOOL/minicool.r4.3/solaris2.5-CC-mt/include/corba/longSeq.H
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/README b/TAO/tests/Cubit/COOL/IDL_Cubit/README
new file mode 100644
index 00000000000..5987e0d6df2
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/README
@@ -0,0 +1,34 @@
+This is the cubit example that uses the TAO IDL compiler to generate
+the stubs and skeletons. Additional features include presence of a
+factory to create Cubit objects and testing the _bind call to get the
+factory object reference.
+
+You can either run the server in the background in the same window as
+the client or open a separate window for the client and server.
+
+server:
+-------
+
+% server [-d] [-ORBhost <serverhost>] [-ORBport <portnum>]
+ [-n <number-of-cubit-objects>]
+
+The server cubit factory maintained num_of_cubit objects (default =
+1). They are assigned keys that look like "key0", "key1", ...
+
+When the server is started and you have used the -d flag, you should
+see as the first line of output something that looks like
+ iiop:1.0//serverhost:10013/factory (using -ORBobjrefstyle url)
+or
+ IOR:000000000000001649444c3a43756269745... (using default -ORBobjrefstyle ior)
+
+Using -d turns on debugging messages. It is additive, i.e., the more
+-d options provided, the more debugging you can get. At the moment,
+only 2 levels of debugging are implemented, and more than 2 -d options
+are ignored.
+
+client:
+-------
+
+% client [-d] -h <hostname> -p <port> -k <cubit key> -n <iterations>
+
+cubit_key corresponds to "key0", "key1", ...
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/client.cpp b/TAO/tests/Cubit/COOL/IDL_Cubit/client.cpp
new file mode 100644
index 00000000000..8ddb3e88602
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/client.cpp
@@ -0,0 +1,747 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/IDL_Cubit
+//
+// = FILENAME
+// clnt.cpp
+//
+// = DESCRIPTION
+// This class implements a simple "cube" CORBA client for the Cubit
+// example using stubs generated by the TAO ORB IDL compiler.
+//
+// = AUTHORS
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// and
+// Aniruddha Gokhale, Sumedh Mungee, and Sergio Flores-Gaitan
+//
+// ============================================================================
+
+#include "ace/Profile_Timer.h"
+#include "ace/Env_Value_T.h"
+#include "client.h"
+
+#include "api/api.H"
+#include "cubit.H"
+#include "sk_cubit.H"
+
+// Constants
+u_int _debug_level = 0;
+const u_int DEFAULT_PORT = 3000;
+CORBA::Environment Cubit_Client::env_;
+
+
+// Constructor.
+
+#define quote(x) #x
+
+Cubit_Client::Cubit_Client (void)
+ : cubit_factory_key_ ("factory"),
+ cubit_key_ ("key0"),
+ hostname_ (ACE_DEFAULT_SERVER_HOST),
+ loop_count_ (250),
+ exit_later_ (0),
+ factory_ (Cubit_Factory::_nil ()),
+ objref_ (CORBA::Object::_nil ()),
+ cubit_ (Cubit::_nil ()),
+ orb_ptr_ (0),
+ call_count_ (0),
+ error_count_ (0),
+ portnum_(DEFAULT_PORT)
+{
+}
+
+// Simple function that returns the substraction of 117 from the
+// parameter.
+
+int
+Cubit_Client::func (u_int i)
+{
+ return i - 117;
+}
+
+// Parses the command line arguments and returns an error status.
+
+int
+Cubit_Client::parse_args (void)
+{
+ ACE_Get_Opt get_opts (argc_, argv_, "dn:h:p:k:x");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag
+ _debug_level++;
+ break;
+ case 'n': // loop count
+ loop_count_ = (u_int) ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 'h':
+ hostname_ = ACE_OS::strdup (get_opts.optarg);
+ break;
+ case 'p':
+ portnum_ = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 'k': // stringified objref
+ cubit_key_ = ACE_OS::strdup (get_opts.optarg);
+ break;
+ case 'x':
+ this->exit_later_++;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " [-d]"
+ " [-n loopcount]"
+ " [-k cubit-obj-ref-key]"
+ " [-h hostname]"
+ " [-p port]"
+ " [-x]"
+ "\n",
+ this->argv_ [0]),
+ -1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+// Exercise the union. Cube a union.
+
+void
+Cubit_Client::cube_union_stub (void)
+{
+ CORBA::Environment env;
+ Cubit::oneof u, r;
+
+ this->call_count_++;
+
+ u.l (3); // use the long union branch
+
+ // Cube a "union" ...
+ r = this->cubit_->cube_union (u, this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("from cube_union");
+ this->error_count_++;
+ }
+ else
+ {
+ if (_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "cube union ..."));
+ u.l (u.l () * u.l () * u.l ()) ;
+
+ if (u.l () != r.l ())
+ {
+ ACE_DEBUG ((LM_DEBUG, "** cube_union ERROR\n"));
+ this->error_count_++;
+ }
+
+ }
+
+ this->call_count_++;
+
+ u._d (Cubit::e_3rd);
+#if 0
+ u.cm ().l = this->func (i);
+ u.cm ().s = this->func (i);
+ u.cm ().o = this->func (i);
+#endif
+
+ u.cm ().l = 7;
+ u.cm ().s = 5;
+ u.cm ().o = 3;
+
+ // Cube another "union" which uses the default arm ... NOT tested yet
+ r = this->cubit_->cube_union (u, this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("from cube_union");
+ this->error_count_++;
+ }
+ else
+ {
+ if (_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "cube union ..."));
+ u.cm ().l = u.cm ().l * u.cm ().l * u.cm ().l;
+ u.cm ().s = u.cm ().s * u.cm ().s * u.cm ().s;
+ u.cm ().o = u.cm ().o * u.cm ().o * u.cm ().o;
+
+ if (u.cm ().l != r.cm ().l
+ || u.cm ().s != r.cm ().s
+ || u.cm ().o != r.cm ().o)
+ {
+ ACE_DEBUG ((LM_DEBUG, "** cube_union ERROR\n"));
+ this->error_count_++;
+ }
+ }
+}
+
+// Exercise the union using dii.
+
+void
+Cubit_Client::cube_union_dii (void)
+{
+ // Create the request ...
+ CORBA::Request_ptr req;
+
+ this->call_count_++;
+
+ req = this->cubit_->_request ((CORBA::String) "cube_union", this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->error_count_++;
+
+ this->print_exception ("cube_union_dii request create");
+ return;
+ }
+
+ // ... initialise the argument list and result ...
+ Cubit::oneof *u, r;
+
+ u = new Cubit::oneof;
+ u->_d (Cubit::e_3rd);
+
+ u->cm ().l = 5;
+ u->cm ().s = -7;
+ u->cm ().o = 3;
+
+ CORBA::Any tmp_arg (Cubit::_tc_oneof, u, CORBA_FALSE);
+
+ req->arguments ()->add_value ("values", tmp_arg, CORBA_ARG_IN, this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->error_count_++;
+ this->print_exception ("cube_union_dii request arg add");
+ CORBA::release (req);
+ return;
+ }
+
+ req->result ()->value ()->replace (Cubit::_tc_oneof, 0, CORBA_TRUE);
+
+ if (this->env_.exception () != 0)
+ {
+ this->error_count_++;
+ this->print_exception ("cube_union_dii result type");
+ CORBA::release (req);
+ return;
+ }
+
+ // Make the invocation, verify the result.
+
+ req->invoke ();
+
+ if (req->env ()->exception () != 0)
+ {
+ this->error_count_++;
+ this->print_exception ("cube_union_dii invoke", *req->env ());
+ CORBA::release (req);
+ return;
+ }
+
+ r = *(Cubit::oneof *) req->result ()->value ()->value ();
+
+ if (r.cm ().o != 27 || r.cm ().l != 125 || r.cm ().s != -343)
+ {
+ this->error_count_++;
+ ACE_ERROR ((LM_ERROR, "cube_union_dii -- bad results\n"));
+ }
+ else
+ ACE_DEBUG ((LM_DEBUG, "cube_union_dii ... success!!"));
+
+ CORBA::release (req);
+ delete u;
+}
+
+// Cube a short.
+
+void
+Cubit_Client::cube_short (int i)
+{
+ CORBA::Short arg_short = this->func (i);
+ // Cube a short.
+ CORBA::Short ret_short = cubit_->cube_short (arg_short, this->env_);
+
+ this->call_count_++;
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("from cube_short");
+ this->error_count_++;
+ }
+ else
+ {
+ if (_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "cube short: %d --> %d\n",
+ arg_short,
+ ret_short));
+ arg_short = arg_short * arg_short * arg_short;
+
+ if (arg_short != ret_short)
+ {
+ ACE_ERROR ((LM_ERROR, "** cube_short (%d) ERROR (--> %d)\n",
+ (CORBA::Short) this->func (i),
+ ret_short));
+ this->error_count_++;
+ }
+ }
+}
+
+// Cube an octet
+
+void
+Cubit_Client::cube_octet (int i)
+{
+ CORBA::Octet arg_octet = this->func (i);
+
+ // Cube an octet.
+ CORBA::Octet ret_octet = this->cubit_->cube_octet (arg_octet, this->env_);
+
+ this->call_count_++;
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("from cube_octet");
+ this->error_count_++;
+ }
+ else
+ {
+ if (_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "cube octet: %d --> %d\n", arg_octet, ret_octet));
+ arg_octet = arg_octet * arg_octet * arg_octet;
+ if (arg_octet != ret_octet) {
+ ACE_DEBUG ((LM_DEBUG,
+ "** cube_octet (%d) ERROR (--> %d)\n",
+ (CORBA::Octet) this->func (i),
+ ret_octet));
+ this->error_count_++;
+ }
+ }
+}
+
+// calculate the cube from a long
+
+void
+Cubit_Client::cube_long (int i)
+{
+ CORBA::Long arg_long = this->func (i);
+
+ // Cube a long.
+ CORBA::Long ret_long = this->cubit_->cube_long (arg_long, this->env_);;
+
+ this->call_count_++;
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("from cube_long");
+ this->error_count_++;
+ }
+ else
+ {
+ if (_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "cube long: %d --> %d\n", arg_long, ret_long));
+ arg_long = arg_long * arg_long * arg_long;
+ if (arg_long != ret_long) {
+ ACE_ERROR ((LM_ERROR,
+ "** cube_long (%ld) ERROR (--> %ld)\n",
+ (CORBA::Long) this->func (i),
+ ret_long));
+ this->error_count_++;
+ }
+ }
+}
+
+// Cube the numbers in a struct
+
+void
+Cubit_Client::cube_struct (int i)
+{
+ Cubit::Many arg_struct;
+ Cubit::Many ret_struct;
+
+ this->call_count_++;
+
+ arg_struct.l = this->func (i);
+ arg_struct.s = this->func (i);
+ arg_struct.o = this->func (i);
+
+ // Cube a "struct" ...
+ ret_struct = this->cubit_->cube_struct (arg_struct, this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("from cube_struct");
+ this->error_count_++;
+ }
+ else
+ {
+ if (_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "cube struct ..."));
+ arg_struct.l = arg_struct.l * arg_struct.l * arg_struct.l;
+ arg_struct.s = arg_struct.s * arg_struct.s * arg_struct.s;
+ arg_struct.o = arg_struct.o * arg_struct.o * arg_struct.o;
+
+ if (arg_struct.l != ret_struct.l
+ || arg_struct.s != ret_struct.s
+ || arg_struct.o != ret_struct.o)
+ {
+ ACE_ERROR ((LM_ERROR, "** cube_struct ERROR\n"));
+ this->error_count_++;
+ }
+ }
+}
+
+// Cube the numbers in a struct
+
+void
+Cubit_Client::cube_struct_dii (void)
+{
+ // Create the request ...
+ CORBA::Request_ptr req =
+ this->cubit_->_request ((CORBA::String) "cube_struct", this->env_);
+
+ this->call_count_++;
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("DII request create");
+ return;
+ }
+
+ // ... initialise the argument list and result ...
+ Cubit::Many arg;
+ Cubit::Many result;
+
+ arg.o = 3;
+ arg.l = 5;
+ arg.s = -7;
+
+ CORBA::Any tmp_arg (Cubit::_tc_Many, &arg, CORBA_FALSE);
+
+ req->arguments ()->add_value ("values", tmp_arg, CORBA_ARG_IN, this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("DII request arg add");
+ CORBA::release (req);
+ return;
+ }
+
+ req->result ()->value ()->replace (Cubit::_tc_Many, 0, CORBA_TRUE);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("DII request result type");
+ CORBA::release (req);
+ return;
+ }
+
+ // Make the invocation, verify the result
+
+ req->invoke ();
+
+ if (req->env ()->exception () != 0)
+ {
+ this->print_exception ("DII invoke sending struct", *req->env ());
+ CORBA::release (req);
+ return;
+ }
+
+ result = *(Cubit::Many *) req->result ()->value ()->value ();
+
+ if (result.o != 27 || result.l != 125 || result.s != -343)
+ ACE_ERROR ((LM_ERROR, "DII cube_struct -- bad results\n"));
+ else
+ ACE_DEBUG ((LM_DEBUG, "DII cube_struct ... success!!"));
+
+ CORBA::release (req);
+}
+
+void
+Cubit_Client::print_stats (const char *call_name, ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time)
+{
+ double tmp;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%s:\n",
+ call_name));
+
+ if (this->call_count_ > 0 && this->error_count_ == 0)
+ {
+ tmp = 1000 / elapsed_time.real_time;
+
+ elapsed_time.real_time *= ACE_ONE_SECOND_IN_MSECS;
+ elapsed_time.user_time *= ACE_ONE_SECOND_IN_MSECS;
+ elapsed_time.system_time *= ACE_ONE_SECOND_IN_MSECS;
+
+ elapsed_time.real_time /= this->call_count_;
+ elapsed_time.user_time /= this->call_count_;
+ elapsed_time.system_time /= this->call_count_;
+
+ tmp = 1000 / elapsed_time.real_time;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\treal_time\t= %0.06f ms, \n\t"
+ "user_time\t= %0.06f ms, \n\t"
+ "system_time\t= %0.06f ms\n"
+ "\t%0.00f calls/second\n",
+ elapsed_time.real_time < 0.0? 0.0:elapsed_time.real_time,
+ elapsed_time.user_time < 0.0? 0.0:elapsed_time.user_time,
+ elapsed_time.system_time < 0.0? 0.0:elapsed_time.system_time,
+ tmp < 0.0? 0.0 : tmp));
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR, "\tNo time stats printed. Call count zero or error ocurred.\n"));
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\t%d calls, %d errors\n",
+ this->call_count_,
+ this->error_count_));
+}
+
+// Execute client example code.
+
+int
+Cubit_Client::run (void)
+{
+ u_int i;
+
+ ACE_Profile_Timer timer;
+ ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time;
+
+ // ACE_Time_Value before;
+
+ // We start an ACE_Profile_Timer here...
+ timer.start ();
+
+ // Make the calls in a loop.
+ for (i = 0; i < this->loop_count_; i++)
+ {
+ this->cube_short (i);
+ this->cube_octet (i);
+ this->cube_long (i);
+ this->cube_struct (i);
+ }
+
+ // stop the timer.
+ timer.stop ();
+
+ timer.elapsed_time (elapsed_time);
+ // compute call average call time.
+ this->print_stats ("cube average call", elapsed_time);
+
+
+#if 0 // this test is segfaulting, comment for now.
+ // Simple test for DII: call "cube_struct". (It's not timed since
+ // the copious mallocation of DII would bias numbers against typical
+ // stub-based calls).
+
+ timer.start ();
+
+ this->call_count_ = 0;
+ this->error_count_ = 0;
+ // Make the calls in a loop.
+ for (i = 0; i < this->loop_count_; i++)
+ {
+ this->cube_struct_dii ();
+ }
+ timer.stop ();
+
+ timer.elapsed_time (elapsed_time);
+ // compute call average call time.
+ this->print_stats ("cube_struct_dii call", elapsed_time);
+
+ // ------------------>
+ // Two more tests, using the "cube_union" function
+
+ // unions using stubs
+ timer.start ();
+
+ this->call_count_ = 0;
+ this->error_count_ = 0;
+ // Make the calls in a loop.
+ for (i = 0; i < this->loop_count_; i++)
+ {
+ this->cube_union_stub ();
+ }
+
+ timer.stop ();
+
+ timer.elapsed_time (elapsed_time);
+ // compute call average call time.
+ this->print_stats ("cube_union_stub call", elapsed_time);
+
+ // union DII
+ timer.start ();
+
+ this->call_count_ = 0;
+ this->error_count_ = 0;
+ // Make the calls in a loop.
+ for (i = 0; i < this->loop_count_; i++)
+ {
+ this->cube_union_dii ();
+ }
+
+ timer.stop ();
+
+ timer.elapsed_time (elapsed_time);
+ // compute call average call time.
+ this->print_stats ("cube_union_dii call", elapsed_time);
+#endif
+ if (this->exit_later_)
+ {
+ this->cubit_->please_exit (this->env_);
+ this->print_exception ("server, please ACE_OS::exit", this->env_);
+ }
+
+ return this->error_count_ == 0 ? 0 : 1;
+}
+
+Cubit_Client::~Cubit_Client (void)
+{
+ // Free resources
+ CORBA::release (this->factory_);
+ CORBA::release (this->cubit_);
+}
+
+int
+Cubit_Client::init (int argc, char **argv)
+{
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ // Retrieve the ORB.
+ this->orb_ptr_ = CORBA::ORB_init (this->argc_,
+ this->argv_,
+ 0,
+ this->env_);
+
+ // Parse command line and verify parameters.
+ if (this->parse_args () == -1)
+ return -1;
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("ORB initialization");
+ return -1;
+ }
+
+ if (this->cubit_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s: must specify an object reference using -k <key>\n",
+ this->argv_[0]),
+ -1);
+
+ // Retrieve a factory objref.
+ char ior[BUFSIZ];
+ sprintf ( ior, "cool-tcp://%s:%d", this->hostname_, this->portnum_ );
+
+ ACE_DEBUG ((LM_DEBUG, "ior is \"%s\"\n", ior));
+
+ COOL::EOABindingData bindingData (ior);
+
+ this->factory_ = Cubit_Factory::_bind(bindingData, this->env_);
+
+ // this->objref_ = Cubit_Factory::_bind (this->hostname_,
+ // this->portnum_,
+ // this->cubit_factory_key_,
+ // this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("Cubit_Factory::_bind");
+ return -1;
+ }
+
+ if (CORBA::is_nil (this->factory_) == CORBA_TRUE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " _bind returned null object for host (%s), port (%d)\n",
+ this->hostname_,
+ this->portnum_),
+ -1);
+
+ // Narrow the CORBA::Object reference to the stub object, checking
+ // the type along the way using _is_a. There is really no need to
+ // narrow <objref> because <_bind> will return us the
+ // <Cubit_Factory> pointer. However, we do it so that we can
+ // explicitly test the _narrow function.
+
+//this->factory_ = Cubit_Factory::_narrow (this->objref_, this->env_);
+
+ //CORBA::release (this->objref_);
+ // this->objref_->Release ();
+
+ // if (this->factory_ == 0)
+ // ACE_ERROR_RETURN ((LM_ERROR,
+ // " (%P|%t) Unable to narrow object reference to a Cubit_Factory_ptr.\n"),
+ // -1);
+
+ // Now retrieve the Cubit obj ref corresponding to the key.
+ this->cubit_ =
+ this->factory_->make_cubit (this->cubit_key_, this->env_);
+
+ if (this->env_.exception () != 0)
+ {
+ this->print_exception ("make_cubit");
+ return -1;
+ }
+
+ if (CORBA::is_nil (this->cubit_))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "null cubit objref returned by factory\n"),
+ -1);
+
+ return 0;
+}
+
+void Cubit_Client::print_exception (const char * str,
+ const CORBA_Environment &env)
+{
+ CORBA::SystemException* ex;
+
+ ex = CORBA::SystemException::_narrow(env.exception());
+
+ if (ex)
+ {
+ CORBA::String_var msg = ex->message();
+ fprintf(stderr, "%s: %s.\n", str, (const char *) msg);
+ }
+ else
+ {
+ fprintf(stderr, "%s: Unknown user exception.\n", str);
+ }
+}
+
+
+
+
+// This function runs the test.
+
+int
+main (int argc, char **argv)
+{
+ Cubit_Client cubit_client;
+
+ if (cubit_client.init (argc, argv) == -1)
+ return 1;
+ else
+ return cubit_client.run ();
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Env_Value<unsigned long>;
+template class ACE_Env_Value<unsigned short>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Env_Value<unsigned long>
+#pragma instantiate ACE_Env_Value<unsigned short>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/client.h b/TAO/tests/Cubit/COOL/IDL_Cubit/client.h
new file mode 100644
index 00000000000..94cc36a14bd
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/client.h
@@ -0,0 +1,128 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/IDL_Cubit
+//
+// = FILENAME
+// clnt.h
+//
+// = DESCRIPTION
+// This class implements a simple "cube" CORBA client for the Cubit
+// example using stubs generated by the TAO ORB IDL compiler.
+//
+// = AUTHORS
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// and
+// Aniruddha Gokhale, Sumedh Mungee, and Sergio Flores-Gaitan
+//
+// ============================================================================
+
+#include "ace/Get_Opt.h"
+#include "cubit.H"
+
+class Cubit_Client
+ // = TITLE
+ // Defines a class that encapsulates behaviour of the Cubit client
+ // example. Provides a better understanding of the logic in an
+ // object oriented way.
+ //
+ // = DESCRIPTION
+ // This class declares an interface to run the example client for
+ // Cubit CORBA server. All the complexity for initializing the
+ // server is hidden in the class. Just the run() interface is needed.
+{
+public:
+ // = Constructor and destructor.
+ Cubit_Client (void);
+ ~Cubit_Client (void);
+
+ int run (void);
+ // Execute client example code.
+
+ int init (int argc, char **argv);
+ // Initialize the client communication endpoint with server.
+
+ void print_exception (const char * str,
+ const CORBA_Environment &env=Cubit_Client::env_);
+
+private:
+ int func (u_int i);
+ // simple function that returns the substraction of 117 from the parameter.
+
+ int parse_args (void);
+ // Parses the arguments passed on the command line.
+
+ void print_stats (const char *call_name, ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time);
+ // prints the time stats
+
+ void cube_union_stub (void);
+ // Exercise the union. Cube a union.
+
+ void cube_union_dii (void);
+ // Exercise the union using dii.
+
+ void cube_struct (int i);
+ // calculate the cube from a struct.
+
+ void cube_long (int i);
+ // calculate the cube from a long
+
+ void cube_octet (int i);
+ // Cube an octet
+
+ void cube_short (int i);
+ // Cube a short.
+
+ void cube_sequence (int i);
+ // Cube a sequence.
+
+ void cube_struct_dii (void);
+ // Cube the numbers in a struct
+
+ int argc_;
+ // # of arguments on the command line.
+
+ char **argv_;
+ // arguments from command line.
+
+ const char *cubit_factory_key_;
+ // Key of factory obj ref.
+
+ char *cubit_key_;
+ // Key of the obj ref to be retrieved via the factory.
+
+ char *hostname_;
+ // Hostname of server.
+
+ CORBA::UShort portnum_;
+ // default port number of server.
+
+ u_int loop_count_;
+ // Number of times to do the cube operations.
+
+ int exit_later_;
+ // Flag to tell server to not exit immediately
+
+ Cubit_Factory_ptr factory_;
+ // factory pointer for cubit.
+
+ CORBA::Object_ptr objref_;
+ // storage of the factory objref
+
+ static CORBA::Environment env_;
+ // Environment variable
+
+ Cubit_ptr cubit_;
+ // Cubit obj ref
+
+ CORBA::ORB_ptr orb_ptr_;
+ // Remember our orb
+
+ u_int call_count_;
+ // # of calls made to functions
+
+ u_int error_count_;
+ // # of errors incurred in the lifetime of the application.
+};
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/cubit.idl b/TAO/tests/Cubit/COOL/IDL_Cubit/cubit.idl
new file mode 100644
index 00000000000..9ddc2d8954f
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/cubit.idl
@@ -0,0 +1,71 @@
+// $Id$
+
+interface Cubit
+ // = TITLE
+ // Defines an interface that encapsulates operations that cube
+ // numbers.
+ //
+ // = DESCRIPTION
+ // This interface encapsulates operations that cube
+ // octets, shorts, longs, structs and unions.
+
+{
+ octet cube_octet (in octet o);
+ // cube an octet
+
+ short cube_short (in short s);
+ // cube a short
+
+ long cube_long (in long l);
+ // cube a long
+
+ struct Many
+ {
+ octet o; // + 3 bytes padding (normally) ...
+ long l;
+ short s; // + 2 bytes padding (normally) ...
+ };
+
+ Many cube_struct (in Many values);
+ // Cube a struct
+
+ enum discrim
+ {
+ e_0th,
+ e_1st,
+ e_2nd,
+ e_3rd
+ };
+ // Enumeration of the different elements in a union.
+
+ union oneof switch (discrim)
+ {
+ // this is an easy union to interpret; no padding
+ // is needed between discriminant and value.
+ case e_0th:
+ octet o;
+ case e_1st:
+ short s;
+ case e_2nd:
+ long l;
+ case e_3rd:
+ Many cm;
+
+ // default:
+ // Many cm;
+ };
+ // Union of different types.
+
+ oneof cube_union (in oneof values);
+ // cube a union.
+
+ oneway void please_exit ();
+ // shutdown the application.
+};
+
+interface Cubit_Factory
+ // = TITLE
+ // Creates Cubit objects
+{
+ Cubit make_cubit (in string key);
+};
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.cpp b/TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.cpp
new file mode 100644
index 00000000000..cf4a3c99630
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.cpp
@@ -0,0 +1,189 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/IDL_Cubit
+//
+// = FILENAME
+// cubit_i.cpp
+//
+// = AUTHOR
+// Andy Gokhale, Sumedh Mungee and Sergio Flores-Gaitan
+//
+// ============================================================================
+
+#include "cubit_i.h"
+#include <api/api.H>
+#include <api/binding.H>
+#include <corba/eoa.H>
+#include <corba/eorb.H>
+
+extern void print_exception (const CORBA_Environment &env, const char * str);
+
+// Constructor
+
+Cubit_Factory_i::Cubit_Factory_i (const char *key, int numobjs)
+{
+ // Create implementation object with user specified key.
+
+ this->numobjs_ = numobjs;
+ this->my_cubit_ = new Cubit_i_ptr [this->numobjs_];
+
+ static char obj_str [MAXNAMELEN];
+
+ for (u_int i = 0; i < this->numobjs_; i++)
+ {
+ ACE_OS::memset (obj_str, '\0', MAXNAMELEN);
+ ACE_OS::sprintf (obj_str, "key%d", i);
+
+ my_cubit_[i] = new Cubit_i (obj_str);
+
+ if (my_cubit_[i] == 0)
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to create implementation object%d\n",
+ i));
+
+ }
+}
+
+// Destructor
+
+Cubit_Factory_i::~Cubit_Factory_i (void)
+{
+ delete [] this->my_cubit_;
+}
+
+Cubit_ptr
+Cubit_Factory_i::make_cubit (const char *key, CORBA::Environment &env)
+{
+ Cubit_ptr cb = 0;
+
+ for (size_t i = 0; i < this->numobjs_; i++)
+ {
+ const char *obj_str = this->my_cubit_[i]->_get_name ();
+
+ // Keys matched.
+ if (!ACE_OS::strcmp (obj_str, key))
+ {
+ COOL_bind(*(this->my_cubit_ [i]), cb, env);
+ if (env.exception() != 0)
+ print_exception (env, "COOL_bind");
+ // return Cubit::_duplicate (this->my_cubit_ [i]);
+ return cb;
+ }
+ }
+
+ return Cubit::_nil ();
+}
+
+// Constructor
+
+Cubit_i::Cubit_i (const char *obj_name)
+ // : POA_Cubit (obj_name)
+{
+ obj_name_ = ACE_OS::strdup (obj_name);
+}
+
+const char *
+Cubit_i::_get_name (void)
+{
+ return this->obj_name_;
+}
+
+// Destructor
+
+Cubit_i::~Cubit_i (void)
+{
+}
+
+// Cube an octet
+
+CORBA::Octet
+Cubit_i::cube_octet (CORBA::Octet o,
+ CORBA::Environment &env)
+{
+ ACE_UNUSED_ARG (env);
+ return o * o * o;
+}
+
+// Cube a short.
+
+CORBA::Short
+Cubit_i::cube_short (CORBA::Short s,
+ CORBA::Environment &env)
+{
+ ACE_UNUSED_ARG (env);
+ return s * s * s;
+}
+
+// Cube a long
+
+CORBA::Long
+Cubit_i::cube_long (CORBA::Long l,
+ CORBA::Environment &env)
+{
+ ACE_UNUSED_ARG (env);
+ return l * l * l;
+}
+
+// Cube a struct
+
+Cubit::Many
+Cubit_i::cube_struct (const Cubit::Many &values,
+ CORBA::Environment &env)
+{
+ Cubit::Many temp;
+
+ ACE_UNUSED_ARG (env);
+ temp.o = values.o * values.o * values.o;
+ temp.s = values.s * values.s * values.s;
+ temp.l = values.l * values.l * values.l;
+
+ return temp;
+}
+
+// Cube a union
+
+Cubit::oneof
+Cubit_i::cube_union (const Cubit::oneof &values,
+ CORBA::Environment &env)
+{
+ Cubit::oneof temp;
+
+ ACE_UNUSED_ARG (env);
+ switch (values._d ())
+ {
+ case Cubit::e_0th:
+ temp.o (values.o () * values.o () * values.o ());
+ break;
+ case Cubit::e_1st:
+ temp.s (values.s () * values.s () * values.s ());
+ break;
+ case Cubit::e_2nd:
+ temp.l (values.l () * values.l () * values.l ());
+ break;
+ case Cubit::e_3rd:
+ default:
+ temp._d (values._d ()); // set the discriminant
+ // use the read/write accessor
+ temp.cm ().o = values.cm ().o * values.cm ().o * values.cm ().o;
+ temp.cm ().s = values.cm ().s * values.cm ().s * values.cm ().s;
+ temp.cm ().l = values.cm ().l * values.cm ().l * values.cm ().l;
+
+ }
+ return temp;
+}
+
+// Shutdown.
+
+void Cubit_i::please_exit (CORBA::Environment &env)
+{
+ // Macro to avoid "warning: unused parameter" type warning.
+ ACE_UNUSED_ARG (env);
+
+ ACE_DEBUG ((LM_DEBUG, "I've been asked to shut down..."));
+ thisCapsule->boa()->shutdown();
+
+ CORBA_BOA::deactivate_object(this, env);
+}
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.h b/TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.h
new file mode 100644
index 00000000000..9db23e7dbb6
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/cubit_i.h
@@ -0,0 +1,109 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/IDL_Cubit
+//
+// = FILENAME
+// cubit_i.h
+//
+// = AUTHOR
+// Andy Gokhale, Sumedh Mungee and Sergio Flores-Gaitan
+//
+// ============================================================================
+
+#if !defined (_CUBIT_I_HH)
+#define _CUBIT_I_HH
+
+#include "ace/ACE.h"
+
+#include <api/api.H>
+#include <api/binding.H>
+#include <corba/eoa.H>
+#include <corba/eorb.H>
+
+extern COOL_CurrentCapsule* thisCapsule;
+
+#include "cubit.H"
+#include "sk_cubit.H"
+
+// Forward declarations
+class Cubit_i;
+
+// Typedefs.
+typedef Cubit_i *Cubit_i_ptr;
+typedef Cubit_i_ptr Cubit_i_ref;
+
+class Cubit_i
+ // = TITLE
+ // Illustrates how to integrate a servant with the
+ // generated skeleton.
+ // = DESCRIPTION
+ // Implementation of the cubit example at the servant side.
+ // Cubes an octet, short, long, struct and union.
+{
+public:
+ Cubit_i (const char *obj_name = 0);
+ // Constructor
+
+ ~Cubit_i (void);
+ // Destructor
+
+ virtual CORBA::Octet cube_octet (CORBA::Octet o,
+ CORBA::Environment &env);
+ // Cube an octet
+
+ virtual CORBA::Short cube_short (CORBA::Short s,
+ CORBA::Environment &env);
+ // Cube a short
+
+ virtual CORBA::Long cube_long (CORBA::Long l,
+ CORBA::Environment &env);
+ // Cube a long
+
+ virtual Cubit::Many cube_struct (const Cubit::Many &values,
+ CORBA::Environment &env);
+ // Cube a struct.
+
+ virtual Cubit::oneof cube_union (const Cubit::oneof &values,
+ CORBA::Environment &env);
+ // Cube a union.
+
+ virtual void please_exit (CORBA::Environment &env);
+ // Shutdown routine.
+
+ const char *_get_name (void);
+
+ private:
+ const char * obj_name_;
+};
+
+
+class Cubit_Factory_i;
+
+typedef Cubit_Factory_i *Cubit_Factory_i_ptr;
+
+class Cubit_Factory_i
+ // =TITLE
+ // Cubit_Factory_i
+ //
+ // DESCRIPTION
+ // factory object returning the cubit objrefs
+{
+public:
+ Cubit_Factory_i (const char *key, int numobjs);
+ // constructor
+
+ ~Cubit_Factory_i (void);
+ // destructor
+
+ virtual Cubit_ptr make_cubit (const char *key, CORBA::Environment &env);
+ // make the cubit object whose key is "key"
+
+private:
+ Cubit_i_ptr *my_cubit_;
+ u_int numobjs_;
+};
+
+#endif /* _CUBIT_I_HH */
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/server.cpp b/TAO/tests/Cubit/COOL/IDL_Cubit/server.cpp
new file mode 100644
index 00000000000..6a787fe7e93
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/server.cpp
@@ -0,0 +1,149 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/IDL_Cubit
+//
+// = FILENAME
+// svr.cpp
+//
+// = AUTHOR
+// Andy Gokhale, Sumedh Mungee and Sergio Flores-Gaitan
+//
+// ============================================================================
+
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+#include "cubit_i.h"
+
+#include <api/binding.H>
+#include <api/api.H>
+#include "cubit.H"
+#include "sk_cubit.H"
+#include "sk_cubit.C"
+
+void print_exception (const CORBA_Environment &env,
+ const char * str)
+{
+ CORBA::SystemException* ex;
+
+ ex = CORBA::SystemException::_narrow(env.exception());
+
+ if (ex)
+ {
+ CORBA::String_var msg = ex->message();
+ fprintf(stderr, "%s: %s.\n", str, (const char *) msg);
+ }
+ else
+ {
+ fprintf(stderr, "Unknown user exception.\n");
+ }
+}
+
+
+// Global Variables
+static int num_of_objs = 1;
+
+u_int _debug_level = 0;
+
+// Parses the command line arguments and returns an error status
+
+static int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "dn:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag
+ _debug_level++;
+ break;
+ case 'n': // number of cubit objects we hold
+ num_of_objs = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " [-d]"
+ " [-n] <num of cubit objects>"
+ "\n", argv [0]), 1);
+ }
+
+ return 0; // Indicates successful parsing of command line
+}
+
+// Standard command line parsing utilities used.
+
+int
+main (int argc, char *argv[])
+{
+ CORBA::Environment env;
+
+ COOL::EOA::bind(argv[1], env);
+ if (env.exception()) {
+ ACE_DEBUG ((LM_ERROR, "Impossible to bind the ORB to the description:%s\n", argv[1]));
+ return -1;
+ }
+
+ CORBA::ORB_ptr orb_ptr = CORBA::ORB_init (argc, argv, 0, env);
+
+ if (env.exception () != 0)
+ {
+ print_exception (env, "ORB init");
+ return 1;
+ }
+
+ // Initialize the Object Adapter
+ CORBA_BOA_ptr oa_ptr = orb_ptr->OA_init (argc, argv, 0, env);
+
+ if (env.exception() != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ // Parse remaining command line and verify parameters.
+ parse_args (argc, argv);
+
+ // create a factory implementation
+ Cubit_Factory_ptr factory;
+ Cubit_Factory_i *factory_i;
+ COOL::EOABindingData bindingData;
+
+ ACE_NEW_RETURN (factory_i, Cubit_Factory_i ("factory", num_of_objs), 1);
+
+ COOL_bind (*factory_i, factory, bindingData, env);
+
+ if (_debug_level > 0)
+ {
+ // Stringify the objref we'll be implementing, and print it to
+ // stdout. Someone will take that string and give it to a
+ // client. Then release the object.
+
+ CORBA::String str;
+
+ str = orb_ptr->object_to_string (factory, env);
+
+ if (env.exception () != 0)
+ {
+ print_exception (env, "object_to_string");
+ return -1;
+ }
+
+ ACE_OS::puts ((char *) str);
+ ACE_OS::fflush (stdout);
+
+ ACE_DEBUG ((LM_DEBUG, "listening as object '%s'\n", str));
+ }
+
+ // Handle requests for this object until we're killed, or one of the
+ // methods asks us to exit.
+ ACE_DEBUG ((LM_DEBUG, "Entering boa->run ().\n"));
+ oa_ptr->run ();
+
+ return 0;
+}
diff --git a/TAO/tests/Cubit/COOL/IDL_Cubit/tmplinst.cpp b/TAO/tests/Cubit/COOL/IDL_Cubit/tmplinst.cpp
new file mode 100644
index 00000000000..f5cb1888b55
--- /dev/null
+++ b/TAO/tests/Cubit/COOL/IDL_Cubit/tmplinst.cpp
@@ -0,0 +1,15 @@
+//
+// $Id$
+//
+
+// The contents of this file REALLY should be generated by the IDL
+// compiler, but that functionality isn't available yet.
+
+#include "cubit.H"
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class TAO_Unbounded_Sequence<long>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate TAO_Unbounded_Sequence<long>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+