summaryrefslogtreecommitdiff
path: root/TAO/IIOP
diff options
context:
space:
mode:
authorbmendel <bmendel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-15 16:03:24 +0000
committerbmendel <bmendel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-15 16:03:24 +0000
commitcff957a7049c344dd0658a2cd229b1c0830843e2 (patch)
tree71c59f10715b6accc069bca7f8c796780fb9e1e2 /TAO/IIOP
parentd8f94812d3efe8217cb6aa9e642a7fe450a8ac27 (diff)
downloadATCD-cff957a7049c344dd0658a2cd229b1c0830843e2.tar.gz
Modified Cubit example to use stubs and skeletons with new Object Adapter.
cubitC.{h,cpp} - Client side stubs cubitS.{h,cpp} - Server Side Skeletons cubit_i.{h,cpp} - Implementation Code. method_db.i - File that contains code to initialize method database. This will be handled by the IDL compiler. Modified by Brian Mendel. 15-May-1997.
Diffstat (limited to 'TAO/IIOP')
-rw-r--r--TAO/IIOP/test/cubitC.cpp381
-rw-r--r--TAO/IIOP/test/cubitC.h102
-rw-r--r--TAO/IIOP/test/cubitS.cpp216
-rw-r--r--TAO/IIOP/test/cubitS.h84
-rw-r--r--TAO/IIOP/test/cubit_i.cpp92
-rw-r--r--TAO/IIOP/test/cubit_i.h54
-rw-r--r--TAO/IIOP/test/method_db.i67
7 files changed, 996 insertions, 0 deletions
diff --git a/TAO/IIOP/test/cubitC.cpp b/TAO/IIOP/test/cubitC.cpp
new file mode 100644
index 00000000000..92423ffbbd2
--- /dev/null
+++ b/TAO/IIOP/test/cubitC.cpp
@@ -0,0 +1,381 @@
+// @(#)cubitC.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+#include "cubitC.h" // for stubs ...
+
+Cubit_ptr Cubit::_duplicate(Cubit_ptr obj)
+{
+ if (obj)
+ obj->AddRef();
+
+ return obj;
+}
+
+Cubit_ptr Cubit::_narrow(CORBA_Object_ptr obj)
+{
+ CORBA_Environment env;
+ if (obj->_is_a("IDL:Cubit:1.0", env))
+ {
+ STUB_Object *istub;
+ if (obj->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ return Cubit::_nil();
+ }
+ Cubit_ptr new_obj = new Cubit(istub);
+ return Cubit::_duplicate(new_obj);
+ }
+ return Cubit::_nil();
+}
+
+Cubit_ptr Cubit::_nil()
+{
+ return (Cubit_ptr)NULL;
+}
+
+//
+// CUBE OCTET
+//
+
+static const paramdata Cubit_cube_octet_params [] =
+{
+ { _tc_CORBA_Octet, PARAM_RETURN, 0 },
+ { _tc_CORBA_Octet, PARAM_IN, 0 }
+};
+
+
+static const calldata Cubit_cube_octet_calldata =
+{
+ "cube_octet", CORBA_B_TRUE,
+ 2, &Cubit_cube_octet_params [0],
+ 0, 0
+};
+
+
+CORBA_Octet
+Cubit::Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env)
+{
+ CORBA_Octet retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_octet_calldata,
+ &retval, &o);
+ istub->Release ();
+
+ return retval;
+}
+
+
+//
+// CUBE SHORT
+//
+
+static const paramdata Cubit_cube_short_params [] =
+{
+ { _tc_CORBA_Short, PARAM_RETURN, 0 },
+ { _tc_CORBA_Short, PARAM_IN, 0 }
+};
+
+static const calldata Cubit_cube_short_calldata =
+{
+ "cube_short", CORBA_B_TRUE,
+ 2, &Cubit_cube_short_params [0],
+ 0, 0
+};
+
+
+CORBA_Short
+Cubit::Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env)
+{
+ CORBA_Short retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call(env, &Cubit_cube_short_calldata,
+ &retval, &s);
+
+ istub->Release ();
+
+ return retval;
+}
+
+//
+// CUBE LONG
+//
+
+static const paramdata Cubit_cube_long_params [] =
+{
+ { _tc_CORBA_Long, PARAM_RETURN, 0 },
+ { _tc_CORBA_Long, PARAM_IN, 0 }
+};
+
+static const calldata Cubit_cube_long_calldata =
+{
+ "cube_long", CORBA_B_TRUE,
+ 2, &Cubit_cube_long_params [0],
+ 0, 0
+};
+
+
+CORBA_Long
+Cubit::Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env)
+{
+ CORBA_Long retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_long_calldata,
+ &retval, &l);
+ istub->Release ();
+
+ return retval;
+}
+
+
+//
+// Encapsulated parameters for struct "Cubit_Many" typecode.
+// None of these parameters is complicated, so this is just
+// a linear sequence of element encodings
+//
+// NOTE: it's important that this be longword aligned!!
+//
+static const CORBA_Long _oc_Cubit_Many [] =
+{
+ 1, // byte order flag (TRICKY!)
+
+ 1, 0, // empty string: repository/type ID
+ 1, 0, // empty string: struct name
+
+ 3, // three struct elements
+
+ // First structure element: name, typecode for Octet
+ 1, 0, // empty string: name "o"
+ tk_octet,
+
+ // Second structure element: name, typecode for Long
+ 1, 0, // empty string: name "l"
+ tk_long,
+
+ // Third structure element: name, typecode for Short
+ 1, 0, // empty string: name "s"
+ tk_short,
+};
+
+static CORBA_TypeCode _tc_Cubit_Many (tk_struct,
+ sizeof _oc_Cubit_Many, (unsigned char *) &_oc_Cubit_Many,
+ CORBA_B_FALSE);
+CORBA_TypeCode_ptr TC_Cubit_Many = &_tc_Cubit_Many;
+
+
+//
+// CUBE STRUCT
+//
+
+static const paramdata Cubit_cube_struct_params [] =
+{
+ { &_tc_Cubit_Many, PARAM_RETURN, sizeof (Cubit_Many) },
+ { &_tc_Cubit_Many, PARAM_IN, 0 }
+};
+
+static const calldata Cubit_cube_struct_calldata =
+{
+ "cube_struct", CORBA_B_TRUE,
+ 2, &Cubit_cube_struct_params [0],
+ 0, 0
+};
+
+Cubit_Many*
+Cubit::Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env)
+{
+ Cubit_Many *retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_struct_calldata,
+ &retval, &values);
+ istub->Release ();
+
+ return retval;
+}
+
+
+//
+// CUBE UNION
+//
+
+//
+// NOTE: not all union typecodes can be encoded as an array
+// of "long "values, but this one can. Ones with discriminants
+// that are one or two bytes long can't easily be coded portably.
+//
+// The benefit of doing it as an array of "long" values is
+// twofold: (a) easier to read; (b) on most systems it's then
+// adequately aligned for the typecode interpreter to use, so
+// no additional runtime copy needs to be made.
+//
+static const CORBA_Long _oc_Cubit_oneof [] =
+{
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted struct name, "oneof"
+
+ //
+ // discriminant typecode:
+ //
+ tk_enum, // tk_enum
+ 72, // encapsulation length
+
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted enum name, "discrim"
+ 6, // 5 elements in the enum
+
+ 1, 0, // omitted member name, "e_0th"
+ 1, 0, // omitted member name, "e_1st"
+ 1, 0, // omitted member name, "e_2nd"
+ 1, 0, // omitted member name, "e_3rd"
+ 1, 0, // omitted member name, "e_4th"
+ 1, 0, // omitted member name, "e_5th"
+
+ 4, // default member index (zero based)
+ 5, // number of union members
+
+ // the 1st union branch arm
+ e_0th, // member label value
+ 1, 0, // omitted member name, "o"
+ tk_octet, // member typecode
+
+ // the 2nd union branch arm
+ e_1st, // member label value
+ 1, 0, // omitted member name, "s"
+ tk_short, // member typecode
+
+ // the 3rd union branch arm
+ e_2nd, // member label value
+ 1, 0, // omitted member name, "l"
+ tk_long, // member typecode
+
+ // the 4th union branch arm
+ e_3rd, // member label value
+ 1, 0, // omitted member name, "cm"
+
+ // the 4th union member typecode
+ tk_struct, // tk_struct
+ 60, // encap length
+
+ 1, // byte order flag (TRICKY)
+ 1, 0, // omitted repository/type ID
+ 1, 0, // omitted struct name, "Many"
+ 3, // three struct members
+
+ // First structure element
+ 1, 0, // omitted member name, "o"
+ tk_octet, // member type, tk_octet
+
+ // Second structure element
+ 1, 0, // omitted member name, "l"
+ tk_long, // member type, tk_long
+
+ // Third structure element
+ 1, 0, // omitted member name, "s"
+ tk_short, // member type, tk_short
+
+ // the 5th union branch arm
+ 4, // the 5th member label value
+ 1, 0, // omitted member name, "cm"
+ ~0, // indirected typecode (~0)
+ -84 // offset to struct "Many" typecode
+};
+
+static CORBA_TypeCode _tc_Cubit_oneof (tk_union,
+ (sizeof _oc_Cubit_oneof), (unsigned char *) &_oc_Cubit_oneof,
+ CORBA_B_FALSE);
+CORBA_TypeCode_ptr TC_Cubit_oneof = &_tc_Cubit_oneof;
+
+static const paramdata Cubit_cube_union_params [] =
+{
+ { &_tc_Cubit_oneof, PARAM_RETURN, sizeof (Cubit_oneof) },
+ { &_tc_Cubit_oneof, PARAM_IN, 0 }
+};
+
+static const calldata Cubit_cube_union_calldata =
+{
+ "cube_union", CORBA_B_TRUE,
+ 2, &Cubit_cube_union_params [0],
+ 0, 0
+};
+
+Cubit_oneof*
+Cubit::Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env)
+{
+ Cubit_oneof *retval;
+
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return 0;
+ }
+
+ istub->do_call (env, &Cubit_cube_union_calldata,
+ &retval, &values);
+ istub->Release ();
+
+ return retval;
+}
+
+
+
+//
+// PLEASE EXIT
+//
+
+static const calldata Cubit_please_exit_calldata =
+{
+ "please_exit", CORBA_B_FALSE,
+ 0, 0,
+ 0, 0
+};
+
+void
+Cubit::Cubit_please_exit (CORBA_Environment &env)
+{
+ STUB_Object *istub;
+ if (this->QueryInterface(IID_STUB_Object, (void **)&istub) != NOERROR)
+ {
+ env.exception(new CORBA_DATA_CONVERSION (COMPLETED_NO));
+ return;
+ }
+
+ istub->do_call (env, &Cubit_please_exit_calldata);
+ istub->Release ();
+}
diff --git a/TAO/IIOP/test/cubitC.h b/TAO/IIOP/test/cubitC.h
new file mode 100644
index 00000000000..2e89efb6723
--- /dev/null
+++ b/TAO/IIOP/test/cubitC.h
@@ -0,0 +1,102 @@
+// @(#)cubitC.h 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+/**************************************************************************
+This file has been hand-crafted to work with the ORB API of the SUN's IIOP
+implementation
+***************************************************************************/
+
+#ifndef _CUBIT_HH
+#define _CUBIT_HH
+
+#ifdef _MSC_VER
+#pragma pack (push, 1) // VC++, known padding rules
+#endif // VC++
+
+#include <corba/orb.hh>
+#include <corba/stub.hh>
+
+#include <iostream.h>
+
+extern CORBA_TypeCode_ptr TC_Cubit_Many;
+extern CORBA_TypeCode_ptr TC_Cubit_oneof;
+
+struct Cubit_Many
+{
+ CORBA_Octet o;
+ CORBA_Long l;
+ CORBA_Short s;
+};
+
+enum Cubit_discrim
+ { e_0th = 0, e_1st = 1, e_2nd = 2,
+ e_3rd = 3, e_4th = 4, e_5th = 5 };
+
+struct Cubit_oneof
+{
+ Cubit_discrim _disc;
+
+ union
+ {
+ CORBA_Octet o;
+ CORBA_Short s;
+ CORBA_Long l;
+ Cubit_Many cm;
+ };
+};
+
+class Cubit;
+typedef Cubit *Cubit_ptr;
+typedef Cubit_ptr Cubit_ref;
+
+class Cubit : public virtual CORBA_Object
+{
+public:
+
+ static Cubit_ptr _duplicate(Cubit_ptr obj);
+ static Cubit_ptr _narrow(CORBA_Object_ptr obj);
+ static Cubit_ptr _nil();
+
+ virtual
+ CORBA_Octet Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Short Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Long Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_Many* Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_oneof* Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env);
+
+ virtual
+ void Cubit_please_exit (CORBA_Environment &env);
+
+protected:
+ Cubit() { }
+ Cubit(STUB_Object *objref)
+ : CORBA_Object(objref) { }
+ virtual ~Cubit() { }
+
+
+};
+
+extern const CORBA_Char *Cubit__id; // type ID
+
+#ifdef _MSC_VER
+#pragma pack (pop) // VC++, go back to other padding rules
+#endif // VC++
+
+#endif // _CUBIT_HH
diff --git a/TAO/IIOP/test/cubitS.cpp b/TAO/IIOP/test/cubitS.cpp
new file mode 100644
index 00000000000..61081d9f0ae
--- /dev/null
+++ b/TAO/IIOP/test/cubitS.cpp
@@ -0,0 +1,216 @@
+// @(#)cubitS.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written C-style "Cubit" stubs and "skeletons"
+//
+
+#include "cubitS.h"
+#include "cubitC.cpp"
+
+#include <connect.hh>
+#include <params.hh>
+
+#include <corba/debug.hh> // ... and debugging
+#include "tao_dyn_op_table.h" // TAO Dynamic Operation Table
+#include "method_db.i"
+#include "iiopobj.hh"
+
+TAO_Dynamic_Operation_Table tao_cubit_optable(7); // Dynamic Operation Table
+
+_skel_Cubit::_skel_Cubit(const char* obj_name)
+{
+ // Initialize Method Database
+ initialize_method_db (&tao_cubit_optable);
+
+ char *type_id = "IDL:Cubit:1.0";
+ // CORBA_String type_id = "IDL:Cubit:1.0";
+ IIOP_Object *data;
+
+ CORBA_BOA_ptr oa = ROA_PARAMS::instance()->oa();
+ this->optable_ = &tao_cubit_optable;
+ data = new IIOP_Object(type_id);
+
+ data->profile.iiop_version.major = IIOP::MY_MAJOR;
+ data->profile.iiop_version.minor = IIOP::MY_MINOR;
+ data->profile.host = ACE_OS::strdup(oa->get_addr().get_host_name());
+ data->profile.port = oa->get_addr().get_port_number();
+ data->profile.object_key.length = ACE_OS::strlen(obj_name);
+ data->profile.object_key.maximum = data->profile.object_key.length;
+ data->profile.object_key.buffer = new CORBA_Octet [(size_t)data->profile.object_key.length+1];
+
+ ACE_OS::memcpy (data->profile.object_key.buffer,
+ obj_name,
+ data->profile.object_key.length);
+
+ this->set_parent(data);
+ this->sub_ = this;
+
+ if (oa)
+ oa->register_obj(data->profile.object_key, this);
+
+}
+
+void
+_skel_Cubit::_cube_octet_skel(CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Octet);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_octet, add value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_octet, get params");
+
+ // Call Implementation
+ CORBA_Octet *value = new CORBA_Octet;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+
+ *value = the_cubit->Cubit_cube_octet(*(CORBA_Octet *)nv->value()->value(), env);
+
+ CORBA_Any *any = new CORBA_Any (_tc_CORBA_Octet, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_octet, result");
+}
+
+void
+_skel_Cubit::_cube_short_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Short);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_short, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_short, get params");
+
+ // Call Implementation
+ CORBA_Short *value = new CORBA_Short;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ *value = the_cubit->Cubit_cube_short(*(CORBA_Short *)nv->value ()->value (), env);
+
+ CORBA_Any *any = new CORBA_Any (_tc_CORBA_Short, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_short, result");
+}
+
+void
+_skel_Cubit::_cube_long_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_Long);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_long, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_long, get params");
+
+ // Call Implementation
+ CORBA_Long *value = new CORBA_Long;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ *value = the_cubit->Cubit_cube_long(*(CORBA_Long *)nv->value ()->value (), env);
+
+ CORBA_Any *any =
+ new CORBA_Any (_tc_CORBA_Long, value, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_long, result");
+}
+
+void
+_skel_Cubit::_cube_struct_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (TC_Cubit_Many);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_struct, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_struct, get params");
+
+ // Call Implementation
+ Cubit_Many *value;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ value = the_cubit->Cubit_cube_struct(*(Cubit_Many*)nv->value()->value(), env);
+
+ Cubit_Many *retval = new Cubit_Many;
+ retval->o = (CORBA_Octet)value->o;
+ retval->s = (CORBA_Short)value->s;
+ retval->l = value->l;
+
+ // dmsg2 ("cube struct.o, %d -> %d", value->o, retval->o);
+ // dmsg2 ("cube struct.s, %d -> %d", value->s, retval->s);
+ // dmsg2 ("cube struct.l, %d -> %d", value->l, retval->l);
+
+ CORBA_Any *any = new CORBA_Any (TC_Cubit_Many, retval, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_struct, result");
+}
+
+void
+_skel_Cubit::_cube_union_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (TC_Cubit_oneof);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+ dexc (env, "cube_union_3rd, add_value");
+
+ req.params (nvlist, env);
+ dexc (env, "cube_union_3rd, get params");
+
+ // Call Implementation
+ Cubit_oneof *v;
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ v = the_cubit->Cubit_cube_union(*(Cubit_oneof *)nv->value ()->value (), env);
+
+ Cubit_oneof *r = new Cubit_oneof;
+ r->_disc = v->_disc;
+ r->o = (CORBA_Octet) (v->o);
+ r->s = (CORBA_Short) (v->s);
+ r->l = v->l;
+ r->cm.o = (CORBA_Octet) (v->cm.o);
+ r->cm.s = (CORBA_Short) (v->cm.s);
+ r->cm.l = v->cm.l;
+
+ CORBA_Any *any = new CORBA_Any (TC_Cubit_oneof, r, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "cube_struct, result");
+}
+
+void
+_skel_Cubit::_please_exit_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ Cubit *the_cubit = (Cubit*)obj->get_subclass();
+ the_cubit->Cubit_please_exit(env);
+}
diff --git a/TAO/IIOP/test/cubitS.h b/TAO/IIOP/test/cubitS.h
new file mode 100644
index 00000000000..05ddd99df61
--- /dev/null
+++ b/TAO/IIOP/test/cubitS.h
@@ -0,0 +1,84 @@
+// @(#)cubitS.h 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+/**************************************************************************
+This file has been hand-crafted to work with the ORB API of the SUN's IIOP
+implementation
+***************************************************************************/
+
+#ifndef _SKEL_CUBIT_HH
+#define _SKEL_CUBIT_HH
+
+#include "CubitC.h"
+
+class _skel_Cubit;
+typedef _skel_Cubit *_skel_Cubit_ptr;
+typedef _skel_Cubit_ptr _skel_Cubit_ref;
+
+class TAO_Active_Operation_Table;
+
+class _skel_Cubit : public Cubit
+{
+public:
+ virtual
+ CORBA_Octet Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env) = 0;
+ static
+ void _cube_octet_skel(CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Short Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_short_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Long Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_long_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_Many* Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_struct_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_oneof* Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env) = 0;
+
+ static
+ void _cube_union_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+
+ virtual
+ void Cubit_please_exit (CORBA_Environment &env) = 0;
+
+ static
+ void _please_exit_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env);
+protected:
+ _skel_Cubit(const char* obj_name = 0);
+ virtual ~_skel_Cubit() { }
+
+};
+
+#endif // _SKEL_CUBIT_HH
diff --git a/TAO/IIOP/test/cubit_i.cpp b/TAO/IIOP/test/cubit_i.cpp
new file mode 100644
index 00000000000..8bad76a48df
--- /dev/null
+++ b/TAO/IIOP/test/cubit_i.cpp
@@ -0,0 +1,92 @@
+// @(#)cubit_i.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written Cubit Implementation
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+#include "cubit_i.h"
+
+#include <corba/boa.hh> // ... and skeletons
+#include <corba/debug.hh> // ... and debugging
+
+#include "connect.hh"
+#include "params.hh"
+
+Cubit_i::Cubit_i(const char* obj_name)
+: _skel_Cubit(obj_name)
+{
+ cout << "Cubit_i ident: " << this << endl;
+}
+
+Cubit_i::~Cubit_i()
+{
+}
+
+CORBA_Octet
+Cubit_i::Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env)
+{
+
+ return (CORBA_Octet) (o * o * o);
+}
+
+CORBA_Short
+Cubit_i::Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env)
+{
+ return (CORBA_Short) (s * s * s);
+}
+
+
+CORBA_Long
+Cubit_i::Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env)
+{
+ return (CORBA_Long) (l * l * l);
+}
+
+Cubit_Many*
+Cubit_i::Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env)
+{
+ values.o = values.o * values.o * values.o;
+ values.s = values.s * values.s * values.s;
+ values.l = values.l * values.l * values.l;
+
+ return &values;
+}
+
+Cubit_oneof*
+Cubit_i::Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env)
+{
+ switch (values._disc) {
+ case e_0th:
+ values.o = (CORBA_Octet) (values.o * values.o * values.o);
+ break;
+ case e_1st:
+ values.s = (CORBA_Short) (values.s * values.s * values.s);
+ break;
+ case e_2nd:
+ values.l = values.l * values.l * values.l;
+ break;
+ case e_3rd:
+ default:
+ values.cm.o = (CORBA_Octet) (values.cm.o * values.cm.o * values.cm.o);
+ values.cm.s = (CORBA_Short) (values.cm.s * values.cm.s * values.cm.s);
+ values.cm.l = values.cm.l * values.cm.l * values.cm.l;
+ }
+ return &values;
+}
+
+void Cubit_i::Cubit_please_exit (CORBA_Environment &env)
+{
+ ROA_Parameters* params = ROA_PARAMS::instance();
+
+ dmsg ("I've been asked to shut down...");
+ params->oa()->please_shutdown(env);
+ dexc (env, "please_exit, please_shutdown");
+}
diff --git a/TAO/IIOP/test/cubit_i.h b/TAO/IIOP/test/cubit_i.h
new file mode 100644
index 00000000000..6f4bee0d486
--- /dev/null
+++ b/TAO/IIOP/test/cubit_i.h
@@ -0,0 +1,54 @@
+// @(#)cubit_i.cpp 05/14/97
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+//
+// TEST: hand-written Cubit Implementation
+//
+// Modified version of Cubit Example written by Sun Microsystems Inc.
+// Modified by: Brian Mendel
+
+/**************************************************************************
+This file has been hand-crafted to work with the ORB API of the SUN's IIOP
+implementation
+***************************************************************************/
+
+#ifndef _CUBIT_I_HH
+#define _CUBIT_I_HH
+
+#include "cubitS.h"
+
+class Cubit_i;
+typedef Cubit_i *Cubit_i_ptr;
+typedef Cubit_i_ptr Cubit_i_ref;
+
+class Cubit_i : public _skel_Cubit
+{
+public:
+ Cubit_i(const char* obj_name = 0);
+ ~Cubit_i();
+
+ virtual
+ CORBA_Octet Cubit_cube_octet (CORBA_Octet o,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Short Cubit_cube_short (CORBA_Short s,
+ CORBA_Environment &env);
+
+ virtual
+ CORBA_Long Cubit_cube_long (CORBA_Long l,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_Many* Cubit_cube_struct (Cubit_Many &values,
+ CORBA_Environment &env);
+
+ virtual
+ Cubit_oneof* Cubit_cube_union (Cubit_oneof &values,
+ CORBA_Environment &env);
+
+ virtual
+ void Cubit_please_exit (CORBA_Environment &env);
+};
+
+#endif // _CUBIT_I_HH
diff --git a/TAO/IIOP/test/method_db.i b/TAO/IIOP/test/method_db.i
new file mode 100644
index 00000000000..d2b552e8284
--- /dev/null
+++ b/TAO/IIOP/test/method_db.i
@@ -0,0 +1,67 @@
+// @(#)method_db.i 05/14/97
+
+// This file provides a way of initializing the method database
+// Written by: Brian Mendel
+
+#include "cubitS.h"
+
+static void
+is_a_skel (CORBA_ServerRequest &req,
+ CORBA_Object_ptr obj,
+ CORBA_Environment &env)
+{
+ CORBA_NVList_ptr nvlist;
+ CORBA_NamedValue_ptr nv;
+ CORBA_Any temp_value (_tc_CORBA_String);
+
+ req.orb()->create_list (0, nvlist);
+ nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);
+
+ req.params (nvlist, env);
+ if (env.exception () != 0)
+ {
+ dexc (env, "is_a_skel, get params");
+ return;
+ }
+
+ CORBA_Boolean *retval;
+ CORBA_String value = *(CORBA_String *) nv->value()->value();
+
+ if (ACE_OS::strcmp ((char*)value, "IDL:Cubit:1.0") == 0
+ || ACE_OS::strcmp ((char *)value, _tc_CORBA_Object->id (env)) == 0)
+ retval = new CORBA_Boolean (CORBA_B_TRUE);
+ else
+ retval = new CORBA_Boolean (CORBA_B_FALSE);
+
+ CORBA_Any *any = new CORBA_Any (_tc_CORBA_Boolean, retval, CORBA_B_TRUE);
+
+ req.result (any, env);
+ dexc (env, "_is_a, result");
+}
+
+
+struct method_db
+{
+ CORBA_String opname;
+ skeleton skel_ptr;
+};
+
+static const method_db cubit_operations[] = {
+ { "_is_a", &is_a_skel },
+ { "cube_octet", &_skel_Cubit::_cube_octet_skel },
+ { "cube_short", &_skel_Cubit::_cube_short_skel },
+ { "cube_long", &_skel_Cubit::_cube_long_skel },
+ { "cube_struct", &_skel_Cubit::_cube_struct_skel },
+ { "cube_union", &_skel_Cubit::_cube_union_skel },
+ { "please_exit", &_skel_Cubit::_please_exit_skel },
+ { 0, 0 }
+};
+
+
+void initialize_method_db (TAO_Dynamic_Operation_Table *the_optable)
+{
+ for (int ndx = 0; ndx < 7; ndx++)
+ the_optable->register_op(cubit_operations[ndx].opname,
+ cubit_operations[ndx].skel_ptr);
+
+}