diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1997-07-02 04:06:11 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1997-07-02 04:06:11 +0000 |
commit | b0f42b7f68e680720653efb7305b370c17958eb2 (patch) | |
tree | 3fc5d5c30d2c13b7bb03e380231ba57d617fcf44 /TAO | |
parent | 2dafa30ae25644e2e05a6439091245fd067fb29c (diff) | |
download | ATCD-b0f42b7f68e680720653efb7305b370c17958eb2.tar.gz |
Orbix Cubit thread per request
Diffstat (limited to 'TAO')
24 files changed, 4498 insertions, 0 deletions
diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/Makefile b/TAO/IIOP/tests/Cubit/Orbix/tpr/Makefile new file mode 100644 index 00000000000..0c384944355 --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/Makefile @@ -0,0 +1,89 @@ +#---------------------------------------------------------------------------- +# @(#)Makefile 1.1 10/18/96 +# +# Makefile for the ACE_MT_CORBA_Handler tests +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +SRC = cubitS.cpp cubit_impl.cpp server.cpp tpr.cpp + +SVR_OBJS = cubitS.o cubit_impl.o server.o tpr.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)/corba2/lib +ORBIX_INCDIR = $(ORBIX_ROOT)/corba2/include + +# Remove -DCubit_USE_BOA from below to use the TIE approach + +CPPFLAGS += -DEXCEPTIONS -I$(ORBIX_INCDIR) -DWANT_ORBIX_FDS -DCubit_USE_BOA +LDFLAGS += -L$(ORBIX_LIBDIR) -R $(ORBIX_LIBDIR) -L$(ACE)/ace + +IDLFLAGS = -s S.cpp -c C.cpp -B + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +all: server + +server: $(addprefix $(VDIR),$(SVR_OBJS)) + $(LINK.cc) -o server $(addprefix $(VDIR),$(SVR_OBJS)) $(LDFLAGS) $(ITIIOP) $(ITSRV) $(VLDLIBS) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +.obj/cubit_impl.o .shobj/cubit_impl.so: cubit_impl.cpp cubit_impl.h cubit.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/config-sunos5.5-sunc++-4.x.h \ + $(WRAPPER_ROOT)/ace/stdcpp.h \ + $(WRAPPER_ROOT)/ace/OS.i \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i +.obj/server.o .shobj/server.so: server.cpp cubit_impl.h cubit.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/config-sunos5.5-sunc++-4.x.h \ + $(WRAPPER_ROOT)/ace/stdcpp.h \ + $(WRAPPER_ROOT)/ace/OS.i \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit.h b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit.h new file mode 100644 index 00000000000..1c868a6597d --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit.h @@ -0,0 +1,727 @@ + +#ifndef cubit_hh +#define cubit_hh + +#include "ace/OS.h" +#include <CORBA.h> + + +#ifndef _Cubit_defined +#define _Cubit_defined +class Cubit_dispatch : public virtual CORBA::PPTR { +public: + + Cubit_dispatch (void *IT_p, CORBA::Object* IT_o, const char *IT_m, + CORBA::LoaderClass *IT_l, char *IT_i, void* IT_im) + : PPTR (IT_p,IT_o,IT_m,IT_l,IT_i,IT_im) {} + + + Cubit_dispatch (char *IT_OR, void *IT_p, CORBA::Object *IT_o) + : PPTR (IT_OR,IT_p,IT_o) {} + + + Cubit_dispatch () {} + + Cubit_dispatch (ObjectReference *IT_OR, void *IT_p, CORBA::Object *IT_o) + : PPTR (IT_OR,IT_p,IT_o) {} + + + Cubit_dispatch (void *IT_p, CORBA::Object *IT_o, const char *IT_m, + char *IT_i, CORBA::Object* IT_ob, void* IT_im) + : PPTR (IT_p,IT_o,IT_m,IT_i,IT_ob,IT_im) {} + + + virtual unsigned char dispatch (CORBA::Request &IT_r, + unsigned char IT_isTarget, void* IT_pp=NULL); + + +}; + +class Cubit; + +#ifndef CubitPtr +#define CubitPtr + +typedef Cubit* Cubit_ptr; + +typedef Cubit* CubitRef; + +#endif + + +#ifndef CubitForwH +#define CubitForwH +CORBA::ObjectRef Cubit_getBase (void *); +void Cubit_release (Cubit *, CORBA::Environment &IT_env); +void Cubit_release (Cubit_ptr); +Cubit* Cubit_duplicate (Cubit_ptr, CORBA::Environment &IT_env); +Cubit* Cubit_duplicate (Cubit_ptr ); +Cubit_ptr Cubit_nil (CORBA::Environment &IT_env); +Cubit_ptr Cubit_nil (); +#endif +#define Cubit_IMPL "Cubit" + + +class Cubit; + +typedef Cubit CubitProxy; +#define Cubit_IR "Cubit$v1.1" +#define Cubit_IMPL "Cubit" + +#ifndef CubitPtr +#define CubitPtr + +typedef Cubit* Cubit_ptr; + +typedef Cubit* CubitRef; + +#endif + +class Cubit: public virtual CORBA::Object { +public: + Cubit (char *IT_OR); + Cubit (ObjectReference *IT_OR); + Cubit () : CORBA::Object (1) {} +protected: + Cubit_ptr __duplicate( + CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { + CORBA::Object::__duplicate (IT_env); + return this; + } +public: + static Cubit_ptr _duplicate( + Cubit_ptr, + CORBA::Environment &IT_pEnv=CORBA::IT_chooseDefaultEnv ()); +public: + static Cubit* _bind (const char* IT_markerServer, const char* host, + const CORBA::Context &IT_c, + CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + static Cubit* _bind (CORBA::Environment &IT_env); + static Cubit* _bind (const char* IT_markerServer=NULL, const char* host=NULL, + CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + static Cubit* _narrow (CORBA::Object* , CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + static Cubit_ptr _nil (CORBA::Environment &IT_pEnv=CORBA::IT_chooseDefaultEnv ()) { + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + return (Cubit_ptr) CORBA::OBJECT_NIL;} + +#ifndef Cubit_Many_defined +#define Cubit_Many_defined + +struct Many { + CORBA::Octet o; + CORBA::Long l; + CORBA::Short s; + + void encodeOp (CORBA::Request &IT_r) const; + void decodeOp (CORBA::Request &IT_r); + void decodeInOutOp (CORBA::Request &IT_r); + Many(const Many &); + Many(); + ~Many(); + Many& operator= (const Many&); +}; + +#ifndef Cubit_ManyVarH +#define Cubit_ManyVarH + +#ifndef Cubit_ManyvPtr +#define Cubit_ManyvPtr +typedef Many* Many_vPtr; +typedef const Many* Many_cvPtr; +#endif + +class Many_var : public CORBA::_var +{ + private: + + unsigned char copyHelper (const Many_var &IT_s) { + if (!IT_s._ptr) { + _ptr = IT_s._ptr; + } else + { + _ptr = new Many; + *(_ptr) = *(IT_s._ptr); + } + return 1; + } + + public: + + Many_var (const Many_var &IT_s) { + (void) copyHelper (IT_s); + } + + Many_var () { + _ptr = new Many; +; + } + + Many_var (Many *IT_p) { + _ptr = IT_p; + } + + Many_var &operator= (Many *IT_p) { + if (_ptr != IT_p) { + delete _ptr; + } + _ptr = IT_p; + return (*this); + } + + Many_var &operator= (const Many_var &IT_s) { + if (_ptr != IT_s._ptr) { + delete _ptr; + } + _ptr = new Many; + *(_ptr) = *(IT_s._ptr); + return (*this); + } + + ~Many_var () { + delete _ptr; + } + + Many* operator-> () { + return _ptr; + } + + operator Many_cvPtr () const { return _ptr;} + operator Many_vPtr& () { return _ptr;} + operator Many& () const { return * _ptr;} + + protected: + Many *_ptr; + private: + Many_var &operator= (const CORBA::_var &IT_s); + Many_var (const CORBA::_var &IT_s); +}; + +#endif + + +#endif + +enum discrim {e_0th,e_1st,e_2nd,e_3rd,e_4th,e_5th, IT__ENUM_Cubit_discrim=CORBA_ULONG_MAX}; + +#ifndef Cubit_oneof_defined +#define Cubit_oneof_defined + +struct oneof { + private: + + discrim __d; + union { + CORBA::Octet _o_; + CORBA::Short _s_; + CORBA::Long _l_; + Many * _cm_; + }; + + public: + + void encodeOp (CORBA::Request &IT_r) const; + void decodeOp (CORBA::Request &IT_r); + void decodeInOutOp (CORBA::Request &IT_r); + + private: + + unsigned char isSet; + + public: + + discrim _d () const { return __d; } + + CORBA::Octet o () const { + return _o_; + } + + void o (CORBA::Octet IT_member) { + if (isSet && (__d != Cubit::e_0th)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_0th; + isSet = 1; + _o_ = IT_member; + } + + CORBA::Short s () const { + return _s_; + } + + void s (CORBA::Short IT_member) { + if (isSet && (__d != Cubit::e_1st)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_1st; + isSet = 1; + _s_ = IT_member; + } + + CORBA::Long l () const { + return _l_; + } + + void l (CORBA::Long IT_member) { + if (isSet && (__d != Cubit::e_2nd)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_2nd; + isSet = 1; + _l_ = IT_member; + } + + Many& cm () { + return (*_cm_); + } + + const Many& cm () const { + return (*_cm_); + } + + void cm (const Many& IT_member) { + if (isSet && (__d != Cubit::e_3rd)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_3rd; + + if (!isSet) { + _cm_ = new Many; + isSet = 1; + } + *(_cm_) = IT_member; + } + + + oneof(); + oneof(const oneof &); + ~oneof(); + oneof& operator= (const oneof&); +}; + +#ifndef Cubit_oneofVarH +#define Cubit_oneofVarH + +#ifndef Cubit_oneofvPtr +#define Cubit_oneofvPtr +typedef oneof* oneof_vPtr; +typedef const oneof* oneof_cvPtr; +#endif + +class oneof_var : public CORBA::_var +{ + private: + + unsigned char copyHelper (const oneof_var &IT_s) { + if (!IT_s._ptr) { + _ptr = IT_s._ptr; + } else + { + _ptr = new oneof; + *(_ptr) = *(IT_s._ptr); + } + return 1; + } + + public: + + oneof_var (const oneof_var &IT_s) { + (void) copyHelper (IT_s); + } + + oneof_var () { + _ptr = NULL; + } + + oneof_var (oneof *IT_p) { + _ptr = IT_p; + } + + oneof_var &operator= (oneof *IT_p) { + if (_ptr != IT_p) { + delete _ptr; + } + _ptr = IT_p; + return (*this); + } + + oneof_var &operator= (const oneof_var &IT_s) { + if (_ptr != IT_s._ptr) { + delete _ptr; + } + _ptr = new oneof; + *(_ptr) = *(IT_s._ptr); + return (*this); + } + + ~oneof_var () { + delete _ptr; + } + + oneof* operator-> () { + return _ptr; + } + + operator oneof_cvPtr () const { return _ptr;} + operator oneof_vPtr& () { return _ptr;} + operator oneof& () const { return * _ptr;} + + protected: + oneof *_ptr; + private: + oneof_var &operator= (const CORBA::_var &IT_s); + oneof_var (const CORBA::_var &IT_s); +}; + +#endif + + +#endif + virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual Many cube_struct (const Many& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual oneof cube_union (const oneof& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual void please_exit (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); +}; + +#ifndef CubitVarH +#define CubitVarH + +#ifndef CubitvPtr +#define CubitvPtr +typedef Cubit* Cubit_vPtr; +typedef const Cubit* Cubit_cvPtr; +#endif + +class Cubit_var : public CORBA::_var +{ + private: + + unsigned char copyHelper (const Cubit_var &IT_s) { + { + _ptr = Cubit_duplicate (IT_s._ptr); + } + return 1; + } + + public: + + Cubit_var (const Cubit_var &IT_s) { + (void) copyHelper (IT_s); + } + + Cubit_var () { + _ptr = Cubit_nil (); + } + + Cubit_var (Cubit *IT_p) { + _ptr = IT_p; + } + + Cubit_var &operator= (Cubit *IT_p) { + Cubit_release (_ptr); + _ptr = IT_p; + return (*this); + } + + Cubit_var &operator= (const Cubit_var &IT_s) { + Cubit_release (_ptr); + _ptr = Cubit_duplicate (IT_s._ptr); + return (*this); + } + + ~Cubit_var () { + Cubit_release (_ptr); + } + + Cubit* operator-> () { + return _ptr; + } + + operator Cubit_cvPtr () const { return _ptr;} + operator Cubit_vPtr& () { return _ptr;} + + protected: + Cubit *_ptr; + private: + Cubit_var &operator= (const CORBA::_var &IT_s); + Cubit_var (const CORBA::_var &IT_s); + Cubit_var &operator= (const CORBA::_mgr &IT_s); + Cubit_var &operator= (const CORBA::_SeqElem &IT_s); + Cubit_var (const CORBA::_mgr &IT_s); + Cubit_var (const CORBA::_SeqElem &IT_s); +}; + +#endif + + +#ifndef CubitMgrH +#define CubitMgrH + +class Cubit_mgr : public CORBA::_mgr +{ + public: + + Cubit_mgr () { + _ptr = Cubit_nil (); + _release = 1; + } + + Cubit_mgr (const Cubit_mgr &IT_s) { + _ptr = Cubit_duplicate (IT_s._ptr); + _release = 1; + } + + Cubit_mgr &operator= (Cubit *IT_p) { + if (_ptr && _release) + Cubit_release (_ptr); + _ptr = IT_p; + _release = 1; + return (*this); + } + + Cubit_mgr &operator= (const Cubit_mgr &IT_s) { + if (_ptr && _release) + Cubit_release (_ptr); + _ptr = Cubit_duplicate(IT_s._ptr); + _release = 1; + return (*this); + } + + Cubit_mgr &operator= (Cubit_var &IT_s) { + if (_ptr && _release) + Cubit_release (_ptr); + _ptr = Cubit_duplicate(IT_s); + _release = 1; + return (*this); + } + + ~Cubit_mgr () { + if (_release) + Cubit_release (_ptr); + } + + unsigned char release () { + return _release; + } + + void release (unsigned char rel) { + _release = rel; + } + + operator int () const { + return (((CORBA::Object_ptr) _ptr) ? 1 : 0); + } + + operator void* () const { + return _ptr; + } + + operator CORBA::Object * () const { + return (CORBA::Object *) _ptr; + } + + operator Cubit* () const { + return (Cubit*) _ptr; + } + + Cubit_ptr operator-> () const { + return _ptr; + } + + Cubit *_ptr; + + protected: + + unsigned char _release; +}; + +typedef Cubit_mgr Cubit_mgr_IT_const; +#endif + +#ifndef CubitSeqElemH +#define CubitSeqElemH + +class Cubit_SeqElem : public CORBA::_SeqElem +{ + public: + + Cubit_SeqElem (Cubit_ptr* IT_p, unsigned char rel) { + _ptr = IT_p; + _release = rel; + } + + Cubit_SeqElem &operator= (Cubit_ptr IT_p) { + if (_ptr) { + if (*(_ptr) && _release) + Cubit_release (*(_ptr)); + *(_ptr) = IT_p; + } + return (*this); + } + + Cubit_SeqElem &operator= (const Cubit_SeqElem &IT_s) { + if (_ptr && IT_s._ptr) { + if (*(_ptr) && _release) + Cubit_release (*(_ptr)); + *(_ptr) = Cubit_duplicate(*(IT_s._ptr)); + } + return (*this); + } + + operator Cubit_ptr () const { + return _ptr ? (Cubit_ptr) (*_ptr) : Cubit_nil(); + } + + Cubit_ptr operator->() const { return *_ptr;} + + protected: + Cubit_ptr *_ptr; + unsigned char _release; +}; + +#endif + + +#define TIE_Cubit(X) Cubit##X + +#define DEF_TIE_Cubit(X) \ + class Cubit##X : public virtual Cubit { \ + X* m_obj; \ + public: \ + \ + \ + Cubit##X (X *objp, const char* m="", CORBA::LoaderClass *l=0)\ + : Cubit(), m_obj(objp) { \ + m_pptr = new Cubit_dispatch \ + (( Cubit*)this,(CORBA::Object*)this,m,l,Cubit_IR,m_obj); \ + } \ + Cubit##X (CORBA::Object *IT_p, const char* IT_m="", void *IT_q=0)\ + : Cubit() { \ + m_pptr = new Cubit_dispatch \ + (( Cubit*)this,(CORBA::Object*)this,IT_m,Cubit_IR,IT_p,IT_q); \ + m_obj = (X*)(m_pptr->getImplObj ()); \ + } \ + \ + virtual ~Cubit##X () { \ + if (_okToDeleteImpl ()) delete m_obj; } \ + virtual void* _deref () { \ + return m_obj; } \ + \ +virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_octet ( o,IT_env);\ +}\ + \ +virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_short ( s,IT_env);\ +}\ + \ +virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_long ( l,IT_env);\ +}\ + \ +virtual Cubit::Many cube_struct (const Cubit::Many& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_struct ( values,IT_env);\ +}\ + \ +virtual Cubit::oneof cube_union (const Cubit::oneof& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_union ( values,IT_env);\ +}\ + \ +virtual void please_exit (CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +m_obj->please_exit (IT_env);\ +}\ + \ + }; \ + + +#define QUALS_Cubit \ +virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_octet ( o,IT_env);\ +}\ + \ +virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_short ( s,IT_env);\ +}\ + \ +virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_long ( l,IT_env);\ +}\ + \ +virtual Many cube_struct (const Many& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_struct ( values,IT_env);\ +}\ + \ +virtual oneof cube_union (const oneof& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_union ( values,IT_env);\ +}\ + \ +virtual void please_exit (CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +m_obj->please_exit (IT_env);\ +}\ + + + + +class CubitProxyFactoryClass : public virtual CORBA::ObjectFactoryClass { +public: + CubitProxyFactoryClass (unsigned char IT_p=0) + : CORBA::ProxyFactory (Cubit_IR, IT_p) {} + + virtual void* New (char *IT_OR, CORBA::Environment&); + + virtual void* New (ObjectReference *IT_OR, CORBA::Environment&); + + virtual void* New2 (); + + virtual CORBA::Object* NewObject (char *IT_OR, CORBA::Environment&); + + virtual CORBA::Object* NewObject (ObjectReference *IT_OR, CORBA::Environment&); + + virtual CORBA::Object* New2Object (); + + virtual void* IT_castUp (void *IT_p, char* IT_s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + + virtual CORBA::PPTR* pptr (void *IT_p); + + virtual void baseInterfaces (_IDL_SEQUENCE_string&); + + +}; + +extern CubitProxyFactoryClass CubitProxyFactory; + +class CubitBOAImpl : public virtual Cubit { +public: + CubitBOAImpl (const char *m="", CORBA::LoaderClass *l=NULL) { + if (CORBA::PPTR::isOK (m_pptr, Cubit_IR)) + m_pptr = new Cubit_dispatch ( (Cubit*)this, + (CORBA::Object*)this, m, l, Cubit_IR, this); +} + + virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual Many cube_struct (const Many& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual oneof cube_union (const oneof& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual void please_exit (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; +}; + + +#endif + + +#endif diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit.idl b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit.idl new file mode 100644 index 00000000000..d9b38c34a2a --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit.idl @@ -0,0 +1,40 @@ +// @(#)cubit.idl 1.1 95/09/10 +// Copyright 1994-1995 by Sun Microsystems, Inc. + +#pragma prefix "Eng.SUN.COM" +#pragma version Cubit 1.1 + +interface Cubit { + octet cube_octet (in octet o); + short cube_short (in short s); + long cube_long (in long l); + + struct Many { + octet o; // + 3 bytes padding (normally) ... + long l; + short s; // + 2 bytes padding (normally) ... + }; + + Many cube_struct (in Many values); + + enum discrim {e_0th, e_1st, e_2nd, e_3rd, e_4th, e_5th}; + + 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: + default: + Many cm; + }; + + oneof cube_union (in oneof values); + + oneway void please_exit (); +}; diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitC.cpp b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitC.cpp new file mode 100644 index 00000000000..c47e38f26ee --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitC.cpp @@ -0,0 +1,557 @@ +#include "cubit.h" + +Cubit::Cubit (char *IT_OR) { + m_pptr = new Cubit_dispatch (IT_OR, this,(CORBA::Object*)this); +} +Cubit::Cubit (ObjectReference *IT_OR) { + m_pptr = new Cubit_dispatch (IT_OR, this,(CORBA::Object*)this); +} + +#ifndef CubitForwC +#define CubitForwC +CORBA::ObjectRef Cubit_getBase(void *IT_p){ + return (Cubit*) IT_p;} + +void Cubit_release (Cubit_ptr IT_p, CORBA::Environment &IT_env) { + CORBA::release(IT_p, IT_env);} + +void Cubit_release (Cubit_ptr IT_p) { + Cubit_release (IT_p, CORBA::IT_chooseDefaultEnv ()); } + +Cubit_ptr Cubit_nil (CORBA::Environment &) { + return Cubit:: _nil ();} + +Cubit_ptr Cubit_nil () { + return Cubit_nil (CORBA::IT_chooseDefaultEnv ());} + +Cubit_ptr Cubit_duplicate (Cubit_ptr IT_p, CORBA::Environment &IT_env) { + return (Cubit::_duplicate(IT_p, IT_env)); } +Cubit_ptr Cubit_duplicate (Cubit_ptr IT_p) { + return Cubit_duplicate (IT_p, CORBA::IT_chooseDefaultEnv ()); } +#endif + +Cubit_ptr Cubit::_duplicate(Cubit_ptr obj, CORBA::Environment& IT_pEnv) { + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (!obj) { + return (obj); + } + Cubit_ptr IT_obj = obj->__duplicate (IT_env); + return IT_obj; +} + + + +Cubit* Cubit:: _bind (const char* IT_markerServer, const char* host, + const CORBA::Context &IT_c, + CORBA::Environment &IT_env) { + return (Cubit*)CORBA::Factory.New (IT_markerServer, IT_env, IT_c, host, + Cubit_IMPL, Cubit_IR); +} + + + +Cubit* Cubit:: _bind (CORBA::Environment &IT_env) { + return _bind (NULL,NULL,CORBA::Context(), IT_env); } + + +Cubit* Cubit:: _bind (const char* IT_markerServer, const char* host, + CORBA::Environment &IT_env) { + return _bind (IT_markerServer, host, CORBA::Context (), IT_env); } +Cubit* Cubit::_narrow (CORBA::Object* IT_obj, CORBA::Environment &IT_pEnv) { + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (CORBA::is_nil (IT_obj)) { + return Cubit:: _nil(); + } + + Cubit* IT_p = (Cubit*)CORBA::Object::_castDown (IT_obj, Cubit_IR, IT_env); + IT_p = IT_p ? IT_p->__duplicate(IT_env) : NULL; + if ((IT_env) &&(!strcmp(IT_env.exception()->id(), "CORBA::StExcep::BAD_PARAM")) && (((CORBA::BAD_PARAM*)IT_env.exception())-> minor() == NARROW_FAILED)) { + IT_env.exception_free(); + } + return IT_p; + } + + +#ifndef Cubit_Many_Ops +#define Cubit_Many_Ops + +void Cubit::Many:: encodeOp (CORBA::Request &IT_r) const { + + IT_r.insertOctet (o); + + IT_r << l; + + IT_r << s; +} + +void Cubit::Many:: decodeOp (CORBA::Request &IT_r) { + + IT_r.extractOctet (o); + + IT_r >> l; + + IT_r >> s; +} + +void Cubit::Many:: decodeInOutOp (CORBA::Request &IT_r) { + + IT_r.extractOctet (o); + + IT_r >> l; + + IT_r >> s; +} + +Cubit::Many ::~Many () { +} + +Cubit::Many:: Many (const Cubit::Many &IT_s) + { + o = IT_s.o; + l = IT_s.l; + s = IT_s.s; +} + +Cubit::Many:: Many () { +} + +Cubit::Many &Cubit::Many:: operator= (const Cubit::Many& IT_s) { + if (this == &IT_s) return *this; + o = IT_s.o; + l = IT_s.l; + s = IT_s.s; + return *this; +} + + +#endif + + +#ifndef Cubit_oneof_Ops +#define Cubit_oneof_Ops +void Cubit::oneof:: encodeOp (CORBA::Request &IT_r) const { + if (!isSet) return; + { + CORBA::ULong IT_0 = (CORBA::ULong) __d; + IT_r << IT_0; + } + switch (__d) { + case Cubit::e_0th: + IT_r.insertOctet (_o_); + break; + case Cubit::e_1st: + IT_r << _s_; + break; + case Cubit::e_2nd: + IT_r << _l_; + break; + case Cubit::e_3rd: + default: + (*_cm_).encodeOp (IT_r); + break; + } + +} + +void Cubit::oneof:: decodeOp (CORBA::Request &IT_r) { + isSet = 0; + { + CORBA::ULong IT_1; + IT_r >> IT_1; + __d = Cubit::discrim(IT_1); + } + switch (__d) { + case Cubit::e_0th: + if (!isSet) { + isSet = 1; + } + IT_r.extractOctet (_o_); + break; + case Cubit::e_1st: + if (!isSet) { + isSet = 1; + } + IT_r >> _s_; + break; + case Cubit::e_2nd: + if (!isSet) { + isSet = 1; + } + IT_r >> _l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + (*_cm_).decodeOp (IT_r); + break; + } + +} +void Cubit::oneof:: decodeInOutOp (CORBA::Request &IT_r) { + Cubit::discrim IT_d; + { + CORBA::ULong IT_2; + IT_r >> IT_2; + IT_d = Cubit::discrim(IT_2); + } + if (IT_d == __d) + switch (__d) { + case Cubit::e_0th: + if (!isSet) { + isSet = 1; + } + IT_r.extractOctet (_o_); + break; + case Cubit::e_1st: + if (!isSet) { + isSet = 1; + } + IT_r >> _s_; + break; + case Cubit::e_2nd: + if (!isSet) { + isSet = 1; + } + IT_r >> _l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + (*_cm_).decodeInOutOp (IT_r); + break; + } + + else { + this->oneof:: ~oneof(); + memset(this, 0, sizeof(*this)); + __d = IT_d; + switch (__d) { + case Cubit::e_0th: + if (!isSet) { + isSet = 1; + } + IT_r.extractOctet (_o_); + break; + case Cubit::e_1st: + if (!isSet) { + isSet = 1; + } + IT_r >> _s_; + break; + case Cubit::e_2nd: + if (!isSet) { + isSet = 1; + } + IT_r >> _l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + (*_cm_).decodeOp (IT_r); + break; + } + isSet = 1; + } + +} + +Cubit::oneof:: oneof() { + memset(this, 0, sizeof(*this)); + isSet = 0; +} + +Cubit::oneof ::~oneof() { + if (!isSet) return; + switch (__d) { + case Cubit::e_0th: break; + case Cubit::e_1st: break; + case Cubit::e_2nd: break; + case Cubit::e_3rd: + default: if (_cm_) delete _cm_; + break; + } + + isSet = 0; +} + +Cubit::oneof:: oneof (const Cubit::oneof &IT_s) { + isSet = 0; + memset(this, 0, sizeof(*this)); + __d = IT_s.__d; + switch (__d) { + case Cubit::e_0th: isSet = 1; + _o_ = IT_s._o_; + break; + case Cubit::e_1st: isSet = 1; + _s_ = IT_s._s_; + break; + case Cubit::e_2nd: isSet = 1; + _l_ = IT_s._l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + *(_cm_) = *(IT_s._cm_); + break; + } + isSet = 1; +} + +Cubit::oneof& Cubit::oneof:: operator= (const Cubit::oneof & IT_s) { + if (this == &IT_s) return *this; + if (isSet && (__d != IT_s.__d)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = IT_s.__d; + switch (__d) { + case Cubit::e_0th: isSet = 1; + _o_ = IT_s._o_; + break; + case Cubit::e_1st: isSet = 1; + _s_ = IT_s._s_; + break; + case Cubit::e_2nd: isSet = 1; + _l_ = IT_s._l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + *(_cm_) = *(IT_s._cm_); + break; + } + isSet = 1; + return *this; +} + + +#endif + +void* CubitProxyFactoryClass::New (char *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +void* CubitProxyFactoryClass::New (ObjectReference *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +void* CubitProxyFactoryClass::New2 () { + return new class Cubit((char*)0);} + +CORBA::Object* CubitProxyFactoryClass::NewObject (char *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +CORBA::Object* CubitProxyFactoryClass::NewObject (ObjectReference *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +CORBA::Object* CubitProxyFactoryClass::New2Object () { + return new class Cubit((char*)0);} + +void* CubitProxyFactoryClass::IT_castUp (void *IT_p, char* IT_s, CORBA::Environment &IT_env) { + void *IT_l; + if (!CORBA::_interfaceCmp (IT_s,Cubit_IR, IT_env)) + return IT_p; + else if (IT_l=CORBA::ObjectFactoryClass::IT_castUp((CORBA::Object*)((class Cubit*)IT_p),IT_s, IT_env)) + return IT_l; + else return NULL; + } + + +CORBA::PPTR* CubitProxyFactoryClass::pptr (void *IT_p) { + return ((class Cubit*)IT_p)->_pptr ();} + +void CubitProxyFactoryClass::baseInterfaces (_IDL_SEQUENCE_string& seq) { + add (seq, Cubit_IR); + CORBA::ObjectFactoryClass::baseInterfaces (seq); +} + +CubitProxyFactoryClass CubitProxyFactory(1); + +CORBA::Octet Cubit:: cube_octet (CORBA::Octet o, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return 0; + } + CORBA::Request IT_r (this, "cube_octet",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + IT_r.insertOctet (o); + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + CORBA::Octet IT_result; + IT_r.extractOctet (IT_result); + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + return 0; +} + +CORBA::Short Cubit:: cube_short (CORBA::Short s, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return 0; + } + CORBA::Request IT_r (this, "cube_short",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + IT_r << s; + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + CORBA::Short IT_result; + IT_r >> IT_result; + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + return 0; +} + +CORBA::Long Cubit:: cube_long (CORBA::Long l, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return 0; + } + CORBA::Request IT_r (this, "cube_long",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + IT_r << l; + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + CORBA::Long IT_result; + IT_r >> IT_result; + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + return 0; +} + +Cubit::Many Cubit:: cube_struct (const Cubit::Many& values, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + { + Cubit::Many IT_l0; + return IT_l0; + } + } + CORBA::Request IT_r (this, "cube_struct",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + values.encodeOp (IT_r); + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + Cubit::Many IT_result; + IT_result.decodeOp (IT_r); + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + { + Cubit::Many IT_l1; + return IT_l1; + } +} + +Cubit::oneof Cubit:: cube_union (const Cubit::oneof& values, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + { + Cubit::oneof IT_l0; + return IT_l0; + } + } + CORBA::Request IT_r (this, "cube_union",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + values.encodeOp (IT_r); + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + Cubit::oneof IT_result; + IT_result.decodeOp (IT_r); + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + { + Cubit::oneof IT_l1; + return IT_l1; + } +} + +void Cubit:: please_exit (CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return ; + } + CORBA::Request IT_r (this, "please_exit",IT_env,1,1); + + IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } +} + + + + + +#ifndef Cubit_dispatch_impl + +unsigned char Cubit_dispatch::dispatch (CORBA::Request &IT_r, + unsigned char, void *) { + IT_r.makeRuntimeException1 ("Cubit"); + return 0; +} + +#endif + diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitC.h b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitC.h new file mode 100644 index 00000000000..15247168d3c --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitC.h @@ -0,0 +1,343 @@ +#ifndef _cubitC_h +#define _cubitC_h + +/************************************************************************/ +/* */ +/* This file is automatically generated by ORBeline IDL compiler */ +/* Do not modify this file. */ +/* */ +/* ORBeline (c) is copyrighted by PostModern Computing, Inc. */ +/* */ +/* The generated code conforms to OMG's IDL C++ mapping as */ +/* specified in OMG Document Number: 94-9-14. */ +/* */ +/************************************************************************/ + +#include "corba.h" + + + +class Cubit; +typedef Cubit *Cubit_ptr; +typedef Cubit_ptr CubitRef; + +#ifndef _Cubit_var_ +#define _Cubit_var_ +class Cubit_var +{ + public: + Cubit_var(); + Cubit_var(Cubit_ptr); + Cubit_var(const Cubit_var&); + ~Cubit_var(); + Cubit_var& operator=(Cubit_ptr); + operator Cubit_ptr() const { return _ptr; } +#if defined(_HPCC_BUG) + operator Cubit *&() { return _ptr; } +#else + operator Cubit_ptr&() { return _ptr; } +#endif + Cubit_ptr operator->() const { return _ptr;} + friend NCistream& operator>>(NCistream&, Cubit_var&); + friend NCostream& operator<<(NCostream&, const Cubit_var&); + friend istream& operator>>(istream&, Cubit_var&); + friend ostream& operator<<(ostream&, const Cubit_var&); + private: + Cubit_ptr _ptr; + void operator=(const Cubit_var&) {} +}; +#endif +class Cubit: public virtual CORBA_Object +{ + private: + static const CORBA::TypeInfo _class_info; + Cubit(const Cubit&) {} + void operator=(const Cubit&){} + public: + static const CORBA::TypeInfo *_desc(); + virtual const CORBA::TypeInfo *_type_info() const; + virtual void *_safe_narrow(const CORBA::TypeInfo& ) const; + static CORBA::Object *_factory(); + protected: + Cubit(const char *obj_name = NULL) :CORBA_Object(obj_name, 1) {} + Cubit(NCistream& strm) :CORBA_Object(strm) {} + virtual ~Cubit() {} + public: + static Cubit_ptr _duplicate(Cubit_ptr obj) { + if (obj ) obj->_ref(); + return obj; + } + static Cubit_ptr _nil() { return (Cubit_ptr)NULL;} + static Cubit_ptr _narrow(CORBA::Object *obj); + static Cubit_ptr _clone(Cubit_ptr obj) { + CORBA::Object_var obj_var(__clone(obj)); + +#if defined(_HPCC_BUG) + return _narrow(obj_var.operator CORBA::Object_ptr()); +#else + return _narrow(obj_var); +#endif + } + static Cubit_ptr _bind(const char *object_name = NULL, + const char *host_name = NULL, + const CORBA::BindOptions* opt = NULL); + + virtual CORBA::Octet cube_octet(CORBA::Octet o); + + virtual CORBA::Short cube_short(CORBA::Short s); + + virtual CORBA::Long cube_long(CORBA::Long l); + + struct Many { + CORBA::Octet o; + CORBA::Long l; + CORBA::Short s; + }; + friend NCostream& operator<<(NCostream&, const Many& ); + friend NCistream& operator>>(NCistream&, Many& ); + + friend ostream& operator<<(ostream&, const Many& ); + inline friend istream& operator>>(istream& _strm, Many& _obj) { + NCistream _istrm(_strm); + _istrm >> _obj; + return _strm; + } + + + typedef Many *Many_ptr; + class Many_var + { + public: + Many_var() { _ptr = (Many*)NULL;} + Many_var(Many *ptr) { + _ptr = ptr; + } + Many_var(const Many_var& var) { + if (var._ptr) + _ptr = new Many(*var._ptr); + else + _ptr = (Many *)NULL; + } + ~Many_var() { + if (_ptr != (Many *)NULL) delete _ptr; + } + Many_var& operator=(Many *ptr) { + if (_ptr != (Many *)NULL) delete _ptr; + _ptr = ptr; + return *this; + } + Many_var& operator=(const Many_var& var) { + if (_ptr != (Many *)NULL) delete _ptr; + if (var._ptr) + _ptr = new Many(*var._ptr); + else + _ptr = (Many *)NULL; + return *this; + } + Many *operator->() { return _ptr; } + operator Many () const { return *_ptr; } + operator Many& () { return *_ptr; } + inline friend NCostream& operator<<(NCostream& strm, + const Many_var& var) { + if (var._ptr == (Many *)NULL) { + throw CORBA::BAD_PARAM(); + } + else + strm << *var._ptr; + return strm; + } + inline friend NCistream& operator>>(NCistream& strm, + Many_var& var) { + if ( ! var._ptr) + var._ptr = new Many; + strm >> *var._ptr; + return strm; + } + private: + Many *_ptr; + }; + + + virtual Cubit::Many cube_struct(const Cubit::Many& values); + + enum discrim { + e_0th, + e_1st, + e_2nd, + e_3rd, + e_4th, + e_5th + }; + inline friend NCostream& operator<<(NCostream& _strm, discrim _enum_type) { + _strm << (CORBA::ULong)_enum_type; + return _strm; + } + inline friend NCistream& operator>>(NCistream& _strm, discrim& _enum_type) { + CORBA::ULong _temp; + _strm >> _temp; + if (_temp >= 6) + throw CORBA::BAD_PARAM(); + _enum_type = discrim(_temp); + return _strm; + } + inline friend ostream& operator<<(ostream& _strm, discrim _enum_type) { + if( &_strm == &cout || &_strm == &cerr || &_strm == &clog) { + _strm << "discrim:"; + switch(_enum_type) { + case e_0th: + _strm << "e_0th" << endl; + break; + case e_1st: + _strm << "e_1st" << endl; + break; + case e_2nd: + _strm << "e_2nd" << endl; + break; + case e_3rd: + _strm << "e_3rd" << endl; + break; + case e_4th: + _strm << "e_4th" << endl; + break; + case e_5th: + _strm << "e_5th" << endl; + break; + } + } + else + _strm << (CORBA::ULong)_enum_type; + return _strm; + } + inline friend istream& operator>>(istream& _strm, discrim& _enum_type) { + CORBA::ULong _temp; + _strm >> _temp; + _enum_type = discrim(_temp); + return _strm; + } + + + class oneof + { + public: + private: + discrim _disc; + CORBA::Octet __o; + CORBA::Short __s; + CORBA::Long __l; + Cubit::Many __cm; + public: + oneof() : _disc(discrim(0)) {} + ~oneof() {} + oneof(const oneof& obj); + oneof& operator=(const oneof& obj); + + void _d(discrim val) { _disc = val; } + discrim _d() const { return _disc; } + + void o(CORBA::Octet val) { + __o = val; + _disc = Cubit::e_0th; + } + CORBA::Octet o() const { return __o; } + + void s(CORBA::Short val) { + __s = val; + _disc = Cubit::e_1st; + } + CORBA::Short s() const { return __s; } + + void l(CORBA::Long val) { + __l = val; + _disc = Cubit::e_2nd; + } + CORBA::Long l() const { return __l; } + + void cm(const Cubit::Many& val) { + __cm = val; + _disc = Cubit::e_3rd; + } + const Cubit::Many& cm() const { return __cm; } + Cubit::Many& cm() { return __cm; } + + friend NCostream& operator<<(NCostream&, const oneof& ); + friend NCistream& operator>>(NCistream&, oneof& ); + friend ostream& operator<<(ostream&, const oneof&); + inline friend istream& operator>>(istream& strm, oneof& obj) { + NCistream istrm(strm); + strm >> obj; + return strm; + } + }; + + typedef oneof *oneof_ptr; + class oneof_var + { + public: + oneof_var() { _ptr = (oneof*)NULL;} + oneof_var(oneof *ptr) { + _ptr = ptr; + } + oneof_var(const oneof_var& var) { + _ptr = new oneof(*var._ptr); + } + ~oneof_var() { + if (_ptr != (oneof *)NULL) delete _ptr; + } + oneof_var& operator=(oneof *ptr) { + if (_ptr != (oneof *)NULL) delete _ptr; + _ptr = ptr; + return *this; + } + oneof_var& operator=(const oneof_var& var) { + if (_ptr != (oneof *)NULL) delete _ptr; + _ptr = new oneof(*var._ptr); + return *this; + } + oneof *operator->() { return _ptr; } + operator oneof () const { return *_ptr; } + operator oneof& () { return *_ptr; } + inline friend NCostream& operator<<(NCostream& strm, + const oneof_var& var) { + if (var._ptr == (oneof *)NULL) { + throw CORBA::BAD_PARAM(); + } + else + strm << *var._ptr; + return strm; + } + inline friend NCistream& operator>>(NCistream& strm, + oneof_var& var) { + if ( ! var._ptr) + var._ptr = new oneof; + strm >> *var._ptr; + return strm; + } + private: + oneof *_ptr; + }; + + + virtual Cubit::oneof cube_union(const Cubit::oneof& values); + + virtual void please_exit(); + + inline friend NCistream& operator>>(NCistream& strm, Cubit_ptr& obj) { + CORBA::Object_var _obj(obj); + _obj = CORBA::Object::_read(strm, Cubit::_desc()); + obj = Cubit::_narrow(_obj); + return strm; + } + inline friend ostream& operator<<(ostream& strm, const Cubit_ptr obj) { + strm << (CORBA::Object_ptr)obj; + return strm; + } + inline friend istream& operator>>(istream& strm, Cubit_ptr& obj) { + NCistream istrm(strm); + istrm >> obj; + return strm; + } +}; + + +#endif + diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitS.cpp b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitS.cpp new file mode 100644 index 00000000000..449a8c23548 --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitS.cpp @@ -0,0 +1,226 @@ +#include "cubit.h" + + +#define Cubit_dispatch_impl + +unsigned char Cubit_dispatch::dispatch (CORBA::Request &IT_r, + unsigned char IT_isTarget, void *IT_pp) { + if (!IT_pp) + IT_pp = m_obj; + const char *IT_s = IT_r.getOperation (); + if (!strcmp(IT_s,"cube_octet")) { + CORBA::Octet IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_octet~+o{o},>{o},N{}\ +")) + return 1; + CORBA::Octet o; + + IT_r.extractOctet (o); + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_octet ( o, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +o\ +", IT_env)) return 1; + IT_r.insertOctet (IT_result); + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_short")) { + CORBA::Short IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_short~+s{s},>{s},N{}\ +")) + return 1; + CORBA::Short s; + + IT_r >> s; + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_short ( s, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +s\ +", IT_env)) return 1; + IT_r << IT_result; + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_long")) { + CORBA::Long IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_long~+l{l},>{l},N{}\ +")) + return 1; + CORBA::Long l; + + IT_r >> l; + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_long ( l, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +l\ +", IT_env)) return 1; + IT_r << IT_result; + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_struct")) { + Cubit::Many IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_struct~+values{R~Cubit::Many~o{o},l{l},s{s}},>{R~Cubit::Many~o{o},l{l},s{s}},N{}\ +")) + return 1; + Cubit::Many values; + + values.decodeOp (IT_r); + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_struct ( values, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +R~Cubit::Many~o{o},l{l},s{s}\ +", IT_env)) return 1; + IT_result.encodeOp (IT_r); + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_union")) { + Cubit::oneof IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + IT_r.tcPreAssert ( +"\ +Ro~cube_union~+values{U~Cubit::oneof~{E~Cubit::discrim~e_0th,e_1st,e_2nd,e_3rd,e_4th,e_5th}~Cubit::e_0th o{o};Cubit::e_1st s{s};Cubit::e_2nd l{l};Cubit::e_3rd,$ cm{R~Cubit::Many~o{o},l{l},s{s}}},>{U~Cubit::oneof~{E~Cubit::discrim~e_0th,e_1st,e_2nd,e_3rd,\ +"); + if (!IT_r.tcAssert ("\ +e_4th,e_5th}~Cubit::e_0th o{o};Cubit::e_1st s{s};Cubit::e_2nd l{l};Cubit::e_3rd,$ cm{R~Cubit::Many~o{o},l{l},s{s}}},N{}\ +")) + return 1; + Cubit::oneof values; + + values.decodeOp (IT_r); + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_union ( values, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +U~Cubit::oneof~{E~Cubit::discrim~e_0th,e_1st,e_2nd,e_3rd,e_4th,e_5th}~Cubit::e_0th o{o};Cubit::e_1st s{s};Cubit::e_2nd l{l};Cubit::e_3rd,$ cm{R~Cubit::Many~o{o},l{l},s{s}}\ +", IT_env)) return 1; + IT_result.encodeOp (IT_r); + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"please_exit")) { + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~please_exit~>{v},O{}\ +")) + return 1; + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + ((Cubit*)IT_pp)->please_exit (IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); + return 1; + } + + if (IT_isTarget) + IT_r.makeRuntimeException2 (); + + return 0; +} + +#include "cubitC.cpp" + diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitS.h b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitS.h new file mode 100644 index 00000000000..757af4664ad --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubitS.h @@ -0,0 +1,118 @@ +#ifndef _cubitS_h +#define _cubitS_h + +#include "cubitC.h" + +/************************************************************************/ +/* */ +/* This file is automatically generated by ORBeline IDL compiler */ +/* Do not modify this file. */ +/* */ +/* ORBeline (c) is copyrighted by PostModern Computing, Inc. */ +/* */ +/* The generated code conforms to OMG's IDL C++ mapping as */ +/* specified in OMG Document Number: 94-9-14. */ +/* */ +/************************************************************************/ + +class _sk_Cubit : public Cubit +{ + protected: + _sk_Cubit(const char *object_name = (const char *)NULL); + _sk_Cubit(const char *service_name, const CORBA::ReferenceData& data); + virtual ~_sk_Cubit() {} + public: + static const CORBA::TypeInfo _skel_info; + + // The following operations need to be implemented by the server. + virtual CORBA::Octet cube_octet(CORBA::Octet o) = 0; + virtual CORBA::Short cube_short(CORBA::Short s) = 0; + virtual CORBA::Long cube_long(CORBA::Long l) = 0; + virtual Cubit::Many cube_struct(const Cubit::Many& values) = 0; + virtual Cubit::oneof cube_union(const Cubit::oneof& values) = 0; + virtual void please_exit() = 0; + + // Skeleton Operations implemented automatically + + static void _cube_octet(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_short(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_long(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_struct(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_union(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _please_exit(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + +}; +template <class T> +class _tie_Cubit : public Cubit +{ + public: + _tie_Cubit(T& t, const char *obj_name=(char*)NULL) : + Cubit(obj_name), + _ref(t) { + _object_name(obj_name); + } + _tie_Cubit(T& t, const char *service_name, + const CORBA::ReferenceData& id) + :_ref(t) { + _service(service_name, id); + } + ~_tie_Cubit() {} + CORBA::Octet cube_octet(CORBA::Octet o) { + return _ref.cube_octet( + o); + } + CORBA::Short cube_short(CORBA::Short s) { + return _ref.cube_short( + s); + } + CORBA::Long cube_long(CORBA::Long l) { + return _ref.cube_long( + l); + } + Cubit::Many cube_struct(const Cubit::Many& values) { + return _ref.cube_struct( + values); + } + Cubit::oneof cube_union(const Cubit::oneof& values) { + return _ref.cube_union( + values); + } + void please_exit() { + _ref.please_exit(); + } + + private: + T& _ref; +}; + +#endif + diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit_impl.cpp b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit_impl.cpp new file mode 100644 index 00000000000..e35f1084118 --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit_impl.cpp @@ -0,0 +1,46 @@ +#include "cubit_impl.h" + +CORBA::Octet Cubit_Impl:: cube_octet (CORBA::Octet o, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + return (CORBA::Octet) (o * o * o); +} + +CORBA::Short Cubit_Impl:: cube_short (CORBA::Short s, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + return (CORBA::Short) (s * s * s); +} + +CORBA::Long Cubit_Impl:: cube_long (CORBA::Long l, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + return (CORBA::Long) (l * l * l); +} + +Cubit::Many Cubit_Impl:: cube_struct (const Cubit::Many& values, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + Cubit::Many out_values; + out_values.o = values.o * values.o * values.o; + out_values.s = values.s * values.s * values.s; + out_values.l = values.l * values.l * values.l; + return out_values; +} + +Cubit::oneof Cubit_Impl:: cube_union (const Cubit::oneof& values, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + Cubit::oneof out_values; + switch (values._d ()) { + case Cubit::e_0th: + out_values.o (values.o () * values.o () * values.o ()); + break; + case Cubit::e_1st: + out_values.s (values.s () * values.s () * values.s ()); + break; + case Cubit::e_2nd: + out_values.l (values.l () * values.l () * values.l ()); + break; + case Cubit::e_3rd: + default: + out_values.cm ().o = values.cm ().o * values.cm ().o * values.cm ().o ; + out_values.cm ().s = values.cm ().s * values.cm ().s * values.cm ().s ; + out_values.cm ().l = values.cm ().l * values.cm ().l * values.cm ().l ; + break; + } + return out_values; +} + +void Cubit_Impl:: please_exit (CORBA::Environment &IT_env) throw (CORBA::SystemException) { +} diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit_impl.h b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit_impl.h new file mode 100644 index 00000000000..1e710bb15d1 --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/cubit_impl.h @@ -0,0 +1,27 @@ + +#ifndef cubit_ih +#define cubit_ih + +#include "cubit.h" + + +#ifdef Cubit_USE_BOA +class Cubit_Impl : public virtual CubitBOAImpl { +#else +class Cubit_Impl { +#endif /* Cubit_USE_BOA */ + +public: + virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual Cubit::Many cube_struct (const Cubit::Many& values, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual Cubit::oneof cube_union (const Cubit::oneof& values, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual void please_exit (CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); +}; + +#ifndef Cubit_USE_BOA +DEF_TIE_Cubit (Cubit_Impl) +#endif /* Cubit_USE_BOA */ + +#endif diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/server.cpp b/TAO/IIOP/tests/Cubit/Orbix/tpr/server.cpp new file mode 100644 index 00000000000..96117fe3e0d --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/server.cpp @@ -0,0 +1,40 @@ +//************************************************************************** +// +// NAME : tpr_server.cpp +// DESCRIPTION: +// +// Server mainline +// +//**************************************************************************** +#define IT_EX_MACROS + +#include "cubit_impl.h" // server header file + +int +main (int , char**) +{ + +#ifdef Cubit_USE_BOA + Cubit_var cb = new Cubit_Impl; + cout << "Using BOA approach" << endl; +#else + Cubit_var cb = new TIE_Cubit (Cubit_Impl) (new Cubit_Impl); + cout << "Using TIE approach" << endl; +#endif /* Cubit_USE_BOA */ + + // + // Go get some work to do.... + // + IT_TRY { + CORBA::Orbix.impl_is_ready("Cubit", IT_X); + } + IT_CATCHANY { + cout << IT_X << endl; + } + IT_ENDTRY; + + cout << "Cubit server is exiting." << endl; + + + return 0; +} diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/tpr.cpp b/TAO/IIOP/tests/Cubit/Orbix/tpr/tpr.cpp new file mode 100644 index 00000000000..bd8a1c5e899 --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/tpr.cpp @@ -0,0 +1,26 @@ +#include "tpr.h" + +void * +worker(void *vp) +{ + ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); + CORBA::Orbix.continueThreadDispatch (*(CORBA::Request *)vp); + return NULL; +} + + +int +tpr_filter::inRequestPreMarshal(CORBA::Request &r, CORBA::Environment&) +{ +// thread_t tid; +// thr_create(NULL, 0, worker, (void *)&r, THR_DETACHED, &tid); + + ACE_Thread_Manager *thr_mgr = ACE_Service_Config::thr_mgr (); + thr_mgr->spawn (ACE_THR_FUNC (worker), + (void *) &r, + THR_DETACHED); + + return -1; +} + +tpr_filter tpr_dispatcher; diff --git a/TAO/IIOP/tests/Cubit/Orbix/tpr/tpr.h b/TAO/IIOP/tests/Cubit/Orbix/tpr/tpr.h new file mode 100644 index 00000000000..38c2ccc7069 --- /dev/null +++ b/TAO/IIOP/tests/Cubit/Orbix/tpr/tpr.h @@ -0,0 +1,10 @@ +#include "cubit.h" +#include "ace/Service_Config.h" +#include "ace/Thread_Manager.h" + +// +// Create a thread filter to dispatch incoming calls +// +class tpr_filter : public CORBA::ThreadFilter { + virtual int inRequestPreMarshal(CORBA::Request &, CORBA::Environment&); +}; diff --git a/TAO/tests/Cubit/Orbix/tpr/Makefile b/TAO/tests/Cubit/Orbix/tpr/Makefile new file mode 100644 index 00000000000..0c384944355 --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/Makefile @@ -0,0 +1,89 @@ +#---------------------------------------------------------------------------- +# @(#)Makefile 1.1 10/18/96 +# +# Makefile for the ACE_MT_CORBA_Handler tests +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +SRC = cubitS.cpp cubit_impl.cpp server.cpp tpr.cpp + +SVR_OBJS = cubitS.o cubit_impl.o server.o tpr.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)/corba2/lib +ORBIX_INCDIR = $(ORBIX_ROOT)/corba2/include + +# Remove -DCubit_USE_BOA from below to use the TIE approach + +CPPFLAGS += -DEXCEPTIONS -I$(ORBIX_INCDIR) -DWANT_ORBIX_FDS -DCubit_USE_BOA +LDFLAGS += -L$(ORBIX_LIBDIR) -R $(ORBIX_LIBDIR) -L$(ACE)/ace + +IDLFLAGS = -s S.cpp -c C.cpp -B + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +all: server + +server: $(addprefix $(VDIR),$(SVR_OBJS)) + $(LINK.cc) -o server $(addprefix $(VDIR),$(SVR_OBJS)) $(LDFLAGS) $(ITIIOP) $(ITSRV) $(VLDLIBS) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +.obj/cubit_impl.o .shobj/cubit_impl.so: cubit_impl.cpp cubit_impl.h cubit.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/config-sunos5.5-sunc++-4.x.h \ + $(WRAPPER_ROOT)/ace/stdcpp.h \ + $(WRAPPER_ROOT)/ace/OS.i \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i +.obj/server.o .shobj/server.so: server.cpp cubit_impl.h cubit.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/config-sunos5.5-sunc++-4.x.h \ + $(WRAPPER_ROOT)/ace/stdcpp.h \ + $(WRAPPER_ROOT)/ace/OS.i \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/Cubit/Orbix/tpr/cubit.h b/TAO/tests/Cubit/Orbix/tpr/cubit.h new file mode 100644 index 00000000000..1c868a6597d --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubit.h @@ -0,0 +1,727 @@ + +#ifndef cubit_hh +#define cubit_hh + +#include "ace/OS.h" +#include <CORBA.h> + + +#ifndef _Cubit_defined +#define _Cubit_defined +class Cubit_dispatch : public virtual CORBA::PPTR { +public: + + Cubit_dispatch (void *IT_p, CORBA::Object* IT_o, const char *IT_m, + CORBA::LoaderClass *IT_l, char *IT_i, void* IT_im) + : PPTR (IT_p,IT_o,IT_m,IT_l,IT_i,IT_im) {} + + + Cubit_dispatch (char *IT_OR, void *IT_p, CORBA::Object *IT_o) + : PPTR (IT_OR,IT_p,IT_o) {} + + + Cubit_dispatch () {} + + Cubit_dispatch (ObjectReference *IT_OR, void *IT_p, CORBA::Object *IT_o) + : PPTR (IT_OR,IT_p,IT_o) {} + + + Cubit_dispatch (void *IT_p, CORBA::Object *IT_o, const char *IT_m, + char *IT_i, CORBA::Object* IT_ob, void* IT_im) + : PPTR (IT_p,IT_o,IT_m,IT_i,IT_ob,IT_im) {} + + + virtual unsigned char dispatch (CORBA::Request &IT_r, + unsigned char IT_isTarget, void* IT_pp=NULL); + + +}; + +class Cubit; + +#ifndef CubitPtr +#define CubitPtr + +typedef Cubit* Cubit_ptr; + +typedef Cubit* CubitRef; + +#endif + + +#ifndef CubitForwH +#define CubitForwH +CORBA::ObjectRef Cubit_getBase (void *); +void Cubit_release (Cubit *, CORBA::Environment &IT_env); +void Cubit_release (Cubit_ptr); +Cubit* Cubit_duplicate (Cubit_ptr, CORBA::Environment &IT_env); +Cubit* Cubit_duplicate (Cubit_ptr ); +Cubit_ptr Cubit_nil (CORBA::Environment &IT_env); +Cubit_ptr Cubit_nil (); +#endif +#define Cubit_IMPL "Cubit" + + +class Cubit; + +typedef Cubit CubitProxy; +#define Cubit_IR "Cubit$v1.1" +#define Cubit_IMPL "Cubit" + +#ifndef CubitPtr +#define CubitPtr + +typedef Cubit* Cubit_ptr; + +typedef Cubit* CubitRef; + +#endif + +class Cubit: public virtual CORBA::Object { +public: + Cubit (char *IT_OR); + Cubit (ObjectReference *IT_OR); + Cubit () : CORBA::Object (1) {} +protected: + Cubit_ptr __duplicate( + CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { + CORBA::Object::__duplicate (IT_env); + return this; + } +public: + static Cubit_ptr _duplicate( + Cubit_ptr, + CORBA::Environment &IT_pEnv=CORBA::IT_chooseDefaultEnv ()); +public: + static Cubit* _bind (const char* IT_markerServer, const char* host, + const CORBA::Context &IT_c, + CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + static Cubit* _bind (CORBA::Environment &IT_env); + static Cubit* _bind (const char* IT_markerServer=NULL, const char* host=NULL, + CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + static Cubit* _narrow (CORBA::Object* , CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + static Cubit_ptr _nil (CORBA::Environment &IT_pEnv=CORBA::IT_chooseDefaultEnv ()) { + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + return (Cubit_ptr) CORBA::OBJECT_NIL;} + +#ifndef Cubit_Many_defined +#define Cubit_Many_defined + +struct Many { + CORBA::Octet o; + CORBA::Long l; + CORBA::Short s; + + void encodeOp (CORBA::Request &IT_r) const; + void decodeOp (CORBA::Request &IT_r); + void decodeInOutOp (CORBA::Request &IT_r); + Many(const Many &); + Many(); + ~Many(); + Many& operator= (const Many&); +}; + +#ifndef Cubit_ManyVarH +#define Cubit_ManyVarH + +#ifndef Cubit_ManyvPtr +#define Cubit_ManyvPtr +typedef Many* Many_vPtr; +typedef const Many* Many_cvPtr; +#endif + +class Many_var : public CORBA::_var +{ + private: + + unsigned char copyHelper (const Many_var &IT_s) { + if (!IT_s._ptr) { + _ptr = IT_s._ptr; + } else + { + _ptr = new Many; + *(_ptr) = *(IT_s._ptr); + } + return 1; + } + + public: + + Many_var (const Many_var &IT_s) { + (void) copyHelper (IT_s); + } + + Many_var () { + _ptr = new Many; +; + } + + Many_var (Many *IT_p) { + _ptr = IT_p; + } + + Many_var &operator= (Many *IT_p) { + if (_ptr != IT_p) { + delete _ptr; + } + _ptr = IT_p; + return (*this); + } + + Many_var &operator= (const Many_var &IT_s) { + if (_ptr != IT_s._ptr) { + delete _ptr; + } + _ptr = new Many; + *(_ptr) = *(IT_s._ptr); + return (*this); + } + + ~Many_var () { + delete _ptr; + } + + Many* operator-> () { + return _ptr; + } + + operator Many_cvPtr () const { return _ptr;} + operator Many_vPtr& () { return _ptr;} + operator Many& () const { return * _ptr;} + + protected: + Many *_ptr; + private: + Many_var &operator= (const CORBA::_var &IT_s); + Many_var (const CORBA::_var &IT_s); +}; + +#endif + + +#endif + +enum discrim {e_0th,e_1st,e_2nd,e_3rd,e_4th,e_5th, IT__ENUM_Cubit_discrim=CORBA_ULONG_MAX}; + +#ifndef Cubit_oneof_defined +#define Cubit_oneof_defined + +struct oneof { + private: + + discrim __d; + union { + CORBA::Octet _o_; + CORBA::Short _s_; + CORBA::Long _l_; + Many * _cm_; + }; + + public: + + void encodeOp (CORBA::Request &IT_r) const; + void decodeOp (CORBA::Request &IT_r); + void decodeInOutOp (CORBA::Request &IT_r); + + private: + + unsigned char isSet; + + public: + + discrim _d () const { return __d; } + + CORBA::Octet o () const { + return _o_; + } + + void o (CORBA::Octet IT_member) { + if (isSet && (__d != Cubit::e_0th)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_0th; + isSet = 1; + _o_ = IT_member; + } + + CORBA::Short s () const { + return _s_; + } + + void s (CORBA::Short IT_member) { + if (isSet && (__d != Cubit::e_1st)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_1st; + isSet = 1; + _s_ = IT_member; + } + + CORBA::Long l () const { + return _l_; + } + + void l (CORBA::Long IT_member) { + if (isSet && (__d != Cubit::e_2nd)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_2nd; + isSet = 1; + _l_ = IT_member; + } + + Many& cm () { + return (*_cm_); + } + + const Many& cm () const { + return (*_cm_); + } + + void cm (const Many& IT_member) { + if (isSet && (__d != Cubit::e_3rd)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = Cubit::e_3rd; + + if (!isSet) { + _cm_ = new Many; + isSet = 1; + } + *(_cm_) = IT_member; + } + + + oneof(); + oneof(const oneof &); + ~oneof(); + oneof& operator= (const oneof&); +}; + +#ifndef Cubit_oneofVarH +#define Cubit_oneofVarH + +#ifndef Cubit_oneofvPtr +#define Cubit_oneofvPtr +typedef oneof* oneof_vPtr; +typedef const oneof* oneof_cvPtr; +#endif + +class oneof_var : public CORBA::_var +{ + private: + + unsigned char copyHelper (const oneof_var &IT_s) { + if (!IT_s._ptr) { + _ptr = IT_s._ptr; + } else + { + _ptr = new oneof; + *(_ptr) = *(IT_s._ptr); + } + return 1; + } + + public: + + oneof_var (const oneof_var &IT_s) { + (void) copyHelper (IT_s); + } + + oneof_var () { + _ptr = NULL; + } + + oneof_var (oneof *IT_p) { + _ptr = IT_p; + } + + oneof_var &operator= (oneof *IT_p) { + if (_ptr != IT_p) { + delete _ptr; + } + _ptr = IT_p; + return (*this); + } + + oneof_var &operator= (const oneof_var &IT_s) { + if (_ptr != IT_s._ptr) { + delete _ptr; + } + _ptr = new oneof; + *(_ptr) = *(IT_s._ptr); + return (*this); + } + + ~oneof_var () { + delete _ptr; + } + + oneof* operator-> () { + return _ptr; + } + + operator oneof_cvPtr () const { return _ptr;} + operator oneof_vPtr& () { return _ptr;} + operator oneof& () const { return * _ptr;} + + protected: + oneof *_ptr; + private: + oneof_var &operator= (const CORBA::_var &IT_s); + oneof_var (const CORBA::_var &IT_s); +}; + +#endif + + +#endif + virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual Many cube_struct (const Many& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual oneof cube_union (const oneof& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); + virtual void please_exit (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); +}; + +#ifndef CubitVarH +#define CubitVarH + +#ifndef CubitvPtr +#define CubitvPtr +typedef Cubit* Cubit_vPtr; +typedef const Cubit* Cubit_cvPtr; +#endif + +class Cubit_var : public CORBA::_var +{ + private: + + unsigned char copyHelper (const Cubit_var &IT_s) { + { + _ptr = Cubit_duplicate (IT_s._ptr); + } + return 1; + } + + public: + + Cubit_var (const Cubit_var &IT_s) { + (void) copyHelper (IT_s); + } + + Cubit_var () { + _ptr = Cubit_nil (); + } + + Cubit_var (Cubit *IT_p) { + _ptr = IT_p; + } + + Cubit_var &operator= (Cubit *IT_p) { + Cubit_release (_ptr); + _ptr = IT_p; + return (*this); + } + + Cubit_var &operator= (const Cubit_var &IT_s) { + Cubit_release (_ptr); + _ptr = Cubit_duplicate (IT_s._ptr); + return (*this); + } + + ~Cubit_var () { + Cubit_release (_ptr); + } + + Cubit* operator-> () { + return _ptr; + } + + operator Cubit_cvPtr () const { return _ptr;} + operator Cubit_vPtr& () { return _ptr;} + + protected: + Cubit *_ptr; + private: + Cubit_var &operator= (const CORBA::_var &IT_s); + Cubit_var (const CORBA::_var &IT_s); + Cubit_var &operator= (const CORBA::_mgr &IT_s); + Cubit_var &operator= (const CORBA::_SeqElem &IT_s); + Cubit_var (const CORBA::_mgr &IT_s); + Cubit_var (const CORBA::_SeqElem &IT_s); +}; + +#endif + + +#ifndef CubitMgrH +#define CubitMgrH + +class Cubit_mgr : public CORBA::_mgr +{ + public: + + Cubit_mgr () { + _ptr = Cubit_nil (); + _release = 1; + } + + Cubit_mgr (const Cubit_mgr &IT_s) { + _ptr = Cubit_duplicate (IT_s._ptr); + _release = 1; + } + + Cubit_mgr &operator= (Cubit *IT_p) { + if (_ptr && _release) + Cubit_release (_ptr); + _ptr = IT_p; + _release = 1; + return (*this); + } + + Cubit_mgr &operator= (const Cubit_mgr &IT_s) { + if (_ptr && _release) + Cubit_release (_ptr); + _ptr = Cubit_duplicate(IT_s._ptr); + _release = 1; + return (*this); + } + + Cubit_mgr &operator= (Cubit_var &IT_s) { + if (_ptr && _release) + Cubit_release (_ptr); + _ptr = Cubit_duplicate(IT_s); + _release = 1; + return (*this); + } + + ~Cubit_mgr () { + if (_release) + Cubit_release (_ptr); + } + + unsigned char release () { + return _release; + } + + void release (unsigned char rel) { + _release = rel; + } + + operator int () const { + return (((CORBA::Object_ptr) _ptr) ? 1 : 0); + } + + operator void* () const { + return _ptr; + } + + operator CORBA::Object * () const { + return (CORBA::Object *) _ptr; + } + + operator Cubit* () const { + return (Cubit*) _ptr; + } + + Cubit_ptr operator-> () const { + return _ptr; + } + + Cubit *_ptr; + + protected: + + unsigned char _release; +}; + +typedef Cubit_mgr Cubit_mgr_IT_const; +#endif + +#ifndef CubitSeqElemH +#define CubitSeqElemH + +class Cubit_SeqElem : public CORBA::_SeqElem +{ + public: + + Cubit_SeqElem (Cubit_ptr* IT_p, unsigned char rel) { + _ptr = IT_p; + _release = rel; + } + + Cubit_SeqElem &operator= (Cubit_ptr IT_p) { + if (_ptr) { + if (*(_ptr) && _release) + Cubit_release (*(_ptr)); + *(_ptr) = IT_p; + } + return (*this); + } + + Cubit_SeqElem &operator= (const Cubit_SeqElem &IT_s) { + if (_ptr && IT_s._ptr) { + if (*(_ptr) && _release) + Cubit_release (*(_ptr)); + *(_ptr) = Cubit_duplicate(*(IT_s._ptr)); + } + return (*this); + } + + operator Cubit_ptr () const { + return _ptr ? (Cubit_ptr) (*_ptr) : Cubit_nil(); + } + + Cubit_ptr operator->() const { return *_ptr;} + + protected: + Cubit_ptr *_ptr; + unsigned char _release; +}; + +#endif + + +#define TIE_Cubit(X) Cubit##X + +#define DEF_TIE_Cubit(X) \ + class Cubit##X : public virtual Cubit { \ + X* m_obj; \ + public: \ + \ + \ + Cubit##X (X *objp, const char* m="", CORBA::LoaderClass *l=0)\ + : Cubit(), m_obj(objp) { \ + m_pptr = new Cubit_dispatch \ + (( Cubit*)this,(CORBA::Object*)this,m,l,Cubit_IR,m_obj); \ + } \ + Cubit##X (CORBA::Object *IT_p, const char* IT_m="", void *IT_q=0)\ + : Cubit() { \ + m_pptr = new Cubit_dispatch \ + (( Cubit*)this,(CORBA::Object*)this,IT_m,Cubit_IR,IT_p,IT_q); \ + m_obj = (X*)(m_pptr->getImplObj ()); \ + } \ + \ + virtual ~Cubit##X () { \ + if (_okToDeleteImpl ()) delete m_obj; } \ + virtual void* _deref () { \ + return m_obj; } \ + \ +virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_octet ( o,IT_env);\ +}\ + \ +virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_short ( s,IT_env);\ +}\ + \ +virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_long ( l,IT_env);\ +}\ + \ +virtual Cubit::Many cube_struct (const Cubit::Many& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_struct ( values,IT_env);\ +}\ + \ +virtual Cubit::oneof cube_union (const Cubit::oneof& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_union ( values,IT_env);\ +}\ + \ +virtual void please_exit (CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +m_obj->please_exit (IT_env);\ +}\ + \ + }; \ + + +#define QUALS_Cubit \ +virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_octet ( o,IT_env);\ +}\ + \ +virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_short ( s,IT_env);\ +}\ + \ +virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_long ( l,IT_env);\ +}\ + \ +virtual Many cube_struct (const Many& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_struct ( values,IT_env);\ +}\ + \ +virtual oneof cube_union (const oneof& values, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +return m_obj->cube_union ( values,IT_env);\ +}\ + \ +virtual void please_exit (CORBA::Environment &IT_env) throw (CORBA::SystemException){\ +m_obj->please_exit (IT_env);\ +}\ + + + + +class CubitProxyFactoryClass : public virtual CORBA::ObjectFactoryClass { +public: + CubitProxyFactoryClass (unsigned char IT_p=0) + : CORBA::ProxyFactory (Cubit_IR, IT_p) {} + + virtual void* New (char *IT_OR, CORBA::Environment&); + + virtual void* New (ObjectReference *IT_OR, CORBA::Environment&); + + virtual void* New2 (); + + virtual CORBA::Object* NewObject (char *IT_OR, CORBA::Environment&); + + virtual CORBA::Object* NewObject (ObjectReference *IT_OR, CORBA::Environment&); + + virtual CORBA::Object* New2Object (); + + virtual void* IT_castUp (void *IT_p, char* IT_s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); + + virtual CORBA::PPTR* pptr (void *IT_p); + + virtual void baseInterfaces (_IDL_SEQUENCE_string&); + + +}; + +extern CubitProxyFactoryClass CubitProxyFactory; + +class CubitBOAImpl : public virtual Cubit { +public: + CubitBOAImpl (const char *m="", CORBA::LoaderClass *l=NULL) { + if (CORBA::PPTR::isOK (m_pptr, Cubit_IR)) + m_pptr = new Cubit_dispatch ( (Cubit*)this, + (CORBA::Object*)this, m, l, Cubit_IR, this); +} + + virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual Many cube_struct (const Many& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual oneof cube_union (const oneof& values, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; + virtual void please_exit (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException) =0; +}; + + +#endif + + +#endif diff --git a/TAO/tests/Cubit/Orbix/tpr/cubit.idl b/TAO/tests/Cubit/Orbix/tpr/cubit.idl new file mode 100644 index 00000000000..d9b38c34a2a --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubit.idl @@ -0,0 +1,40 @@ +// @(#)cubit.idl 1.1 95/09/10 +// Copyright 1994-1995 by Sun Microsystems, Inc. + +#pragma prefix "Eng.SUN.COM" +#pragma version Cubit 1.1 + +interface Cubit { + octet cube_octet (in octet o); + short cube_short (in short s); + long cube_long (in long l); + + struct Many { + octet o; // + 3 bytes padding (normally) ... + long l; + short s; // + 2 bytes padding (normally) ... + }; + + Many cube_struct (in Many values); + + enum discrim {e_0th, e_1st, e_2nd, e_3rd, e_4th, e_5th}; + + 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: + default: + Many cm; + }; + + oneof cube_union (in oneof values); + + oneway void please_exit (); +}; diff --git a/TAO/tests/Cubit/Orbix/tpr/cubitC.cpp b/TAO/tests/Cubit/Orbix/tpr/cubitC.cpp new file mode 100644 index 00000000000..c47e38f26ee --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubitC.cpp @@ -0,0 +1,557 @@ +#include "cubit.h" + +Cubit::Cubit (char *IT_OR) { + m_pptr = new Cubit_dispatch (IT_OR, this,(CORBA::Object*)this); +} +Cubit::Cubit (ObjectReference *IT_OR) { + m_pptr = new Cubit_dispatch (IT_OR, this,(CORBA::Object*)this); +} + +#ifndef CubitForwC +#define CubitForwC +CORBA::ObjectRef Cubit_getBase(void *IT_p){ + return (Cubit*) IT_p;} + +void Cubit_release (Cubit_ptr IT_p, CORBA::Environment &IT_env) { + CORBA::release(IT_p, IT_env);} + +void Cubit_release (Cubit_ptr IT_p) { + Cubit_release (IT_p, CORBA::IT_chooseDefaultEnv ()); } + +Cubit_ptr Cubit_nil (CORBA::Environment &) { + return Cubit:: _nil ();} + +Cubit_ptr Cubit_nil () { + return Cubit_nil (CORBA::IT_chooseDefaultEnv ());} + +Cubit_ptr Cubit_duplicate (Cubit_ptr IT_p, CORBA::Environment &IT_env) { + return (Cubit::_duplicate(IT_p, IT_env)); } +Cubit_ptr Cubit_duplicate (Cubit_ptr IT_p) { + return Cubit_duplicate (IT_p, CORBA::IT_chooseDefaultEnv ()); } +#endif + +Cubit_ptr Cubit::_duplicate(Cubit_ptr obj, CORBA::Environment& IT_pEnv) { + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (!obj) { + return (obj); + } + Cubit_ptr IT_obj = obj->__duplicate (IT_env); + return IT_obj; +} + + + +Cubit* Cubit:: _bind (const char* IT_markerServer, const char* host, + const CORBA::Context &IT_c, + CORBA::Environment &IT_env) { + return (Cubit*)CORBA::Factory.New (IT_markerServer, IT_env, IT_c, host, + Cubit_IMPL, Cubit_IR); +} + + + +Cubit* Cubit:: _bind (CORBA::Environment &IT_env) { + return _bind (NULL,NULL,CORBA::Context(), IT_env); } + + +Cubit* Cubit:: _bind (const char* IT_markerServer, const char* host, + CORBA::Environment &IT_env) { + return _bind (IT_markerServer, host, CORBA::Context (), IT_env); } +Cubit* Cubit::_narrow (CORBA::Object* IT_obj, CORBA::Environment &IT_pEnv) { + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (CORBA::is_nil (IT_obj)) { + return Cubit:: _nil(); + } + + Cubit* IT_p = (Cubit*)CORBA::Object::_castDown (IT_obj, Cubit_IR, IT_env); + IT_p = IT_p ? IT_p->__duplicate(IT_env) : NULL; + if ((IT_env) &&(!strcmp(IT_env.exception()->id(), "CORBA::StExcep::BAD_PARAM")) && (((CORBA::BAD_PARAM*)IT_env.exception())-> minor() == NARROW_FAILED)) { + IT_env.exception_free(); + } + return IT_p; + } + + +#ifndef Cubit_Many_Ops +#define Cubit_Many_Ops + +void Cubit::Many:: encodeOp (CORBA::Request &IT_r) const { + + IT_r.insertOctet (o); + + IT_r << l; + + IT_r << s; +} + +void Cubit::Many:: decodeOp (CORBA::Request &IT_r) { + + IT_r.extractOctet (o); + + IT_r >> l; + + IT_r >> s; +} + +void Cubit::Many:: decodeInOutOp (CORBA::Request &IT_r) { + + IT_r.extractOctet (o); + + IT_r >> l; + + IT_r >> s; +} + +Cubit::Many ::~Many () { +} + +Cubit::Many:: Many (const Cubit::Many &IT_s) + { + o = IT_s.o; + l = IT_s.l; + s = IT_s.s; +} + +Cubit::Many:: Many () { +} + +Cubit::Many &Cubit::Many:: operator= (const Cubit::Many& IT_s) { + if (this == &IT_s) return *this; + o = IT_s.o; + l = IT_s.l; + s = IT_s.s; + return *this; +} + + +#endif + + +#ifndef Cubit_oneof_Ops +#define Cubit_oneof_Ops +void Cubit::oneof:: encodeOp (CORBA::Request &IT_r) const { + if (!isSet) return; + { + CORBA::ULong IT_0 = (CORBA::ULong) __d; + IT_r << IT_0; + } + switch (__d) { + case Cubit::e_0th: + IT_r.insertOctet (_o_); + break; + case Cubit::e_1st: + IT_r << _s_; + break; + case Cubit::e_2nd: + IT_r << _l_; + break; + case Cubit::e_3rd: + default: + (*_cm_).encodeOp (IT_r); + break; + } + +} + +void Cubit::oneof:: decodeOp (CORBA::Request &IT_r) { + isSet = 0; + { + CORBA::ULong IT_1; + IT_r >> IT_1; + __d = Cubit::discrim(IT_1); + } + switch (__d) { + case Cubit::e_0th: + if (!isSet) { + isSet = 1; + } + IT_r.extractOctet (_o_); + break; + case Cubit::e_1st: + if (!isSet) { + isSet = 1; + } + IT_r >> _s_; + break; + case Cubit::e_2nd: + if (!isSet) { + isSet = 1; + } + IT_r >> _l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + (*_cm_).decodeOp (IT_r); + break; + } + +} +void Cubit::oneof:: decodeInOutOp (CORBA::Request &IT_r) { + Cubit::discrim IT_d; + { + CORBA::ULong IT_2; + IT_r >> IT_2; + IT_d = Cubit::discrim(IT_2); + } + if (IT_d == __d) + switch (__d) { + case Cubit::e_0th: + if (!isSet) { + isSet = 1; + } + IT_r.extractOctet (_o_); + break; + case Cubit::e_1st: + if (!isSet) { + isSet = 1; + } + IT_r >> _s_; + break; + case Cubit::e_2nd: + if (!isSet) { + isSet = 1; + } + IT_r >> _l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + (*_cm_).decodeInOutOp (IT_r); + break; + } + + else { + this->oneof:: ~oneof(); + memset(this, 0, sizeof(*this)); + __d = IT_d; + switch (__d) { + case Cubit::e_0th: + if (!isSet) { + isSet = 1; + } + IT_r.extractOctet (_o_); + break; + case Cubit::e_1st: + if (!isSet) { + isSet = 1; + } + IT_r >> _s_; + break; + case Cubit::e_2nd: + if (!isSet) { + isSet = 1; + } + IT_r >> _l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + (*_cm_).decodeOp (IT_r); + break; + } + isSet = 1; + } + +} + +Cubit::oneof:: oneof() { + memset(this, 0, sizeof(*this)); + isSet = 0; +} + +Cubit::oneof ::~oneof() { + if (!isSet) return; + switch (__d) { + case Cubit::e_0th: break; + case Cubit::e_1st: break; + case Cubit::e_2nd: break; + case Cubit::e_3rd: + default: if (_cm_) delete _cm_; + break; + } + + isSet = 0; +} + +Cubit::oneof:: oneof (const Cubit::oneof &IT_s) { + isSet = 0; + memset(this, 0, sizeof(*this)); + __d = IT_s.__d; + switch (__d) { + case Cubit::e_0th: isSet = 1; + _o_ = IT_s._o_; + break; + case Cubit::e_1st: isSet = 1; + _s_ = IT_s._s_; + break; + case Cubit::e_2nd: isSet = 1; + _l_ = IT_s._l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + *(_cm_) = *(IT_s._cm_); + break; + } + isSet = 1; +} + +Cubit::oneof& Cubit::oneof:: operator= (const Cubit::oneof & IT_s) { + if (this == &IT_s) return *this; + if (isSet && (__d != IT_s.__d)) + { + this-> oneof::~oneof(); + memset(this, 0, sizeof(*this)); + } + + __d = IT_s.__d; + switch (__d) { + case Cubit::e_0th: isSet = 1; + _o_ = IT_s._o_; + break; + case Cubit::e_1st: isSet = 1; + _s_ = IT_s._s_; + break; + case Cubit::e_2nd: isSet = 1; + _l_ = IT_s._l_; + break; + case Cubit::e_3rd: + default: + if (!isSet) { + _cm_ = new Cubit::Many; + isSet = 1; + } + *(_cm_) = *(IT_s._cm_); + break; + } + isSet = 1; + return *this; +} + + +#endif + +void* CubitProxyFactoryClass::New (char *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +void* CubitProxyFactoryClass::New (ObjectReference *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +void* CubitProxyFactoryClass::New2 () { + return new class Cubit((char*)0);} + +CORBA::Object* CubitProxyFactoryClass::NewObject (char *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +CORBA::Object* CubitProxyFactoryClass::NewObject (ObjectReference *IT_OR, CORBA::Environment&) { + return new class Cubit(IT_OR);} + +CORBA::Object* CubitProxyFactoryClass::New2Object () { + return new class Cubit((char*)0);} + +void* CubitProxyFactoryClass::IT_castUp (void *IT_p, char* IT_s, CORBA::Environment &IT_env) { + void *IT_l; + if (!CORBA::_interfaceCmp (IT_s,Cubit_IR, IT_env)) + return IT_p; + else if (IT_l=CORBA::ObjectFactoryClass::IT_castUp((CORBA::Object*)((class Cubit*)IT_p),IT_s, IT_env)) + return IT_l; + else return NULL; + } + + +CORBA::PPTR* CubitProxyFactoryClass::pptr (void *IT_p) { + return ((class Cubit*)IT_p)->_pptr ();} + +void CubitProxyFactoryClass::baseInterfaces (_IDL_SEQUENCE_string& seq) { + add (seq, Cubit_IR); + CORBA::ObjectFactoryClass::baseInterfaces (seq); +} + +CubitProxyFactoryClass CubitProxyFactory(1); + +CORBA::Octet Cubit:: cube_octet (CORBA::Octet o, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return 0; + } + CORBA::Request IT_r (this, "cube_octet",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + IT_r.insertOctet (o); + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + CORBA::Octet IT_result; + IT_r.extractOctet (IT_result); + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + return 0; +} + +CORBA::Short Cubit:: cube_short (CORBA::Short s, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return 0; + } + CORBA::Request IT_r (this, "cube_short",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + IT_r << s; + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + CORBA::Short IT_result; + IT_r >> IT_result; + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + return 0; +} + +CORBA::Long Cubit:: cube_long (CORBA::Long l, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return 0; + } + CORBA::Request IT_r (this, "cube_long",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + IT_r << l; + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + CORBA::Long IT_result; + IT_r >> IT_result; + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + return 0; +} + +Cubit::Many Cubit:: cube_struct (const Cubit::Many& values, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + { + Cubit::Many IT_l0; + return IT_l0; + } + } + CORBA::Request IT_r (this, "cube_struct",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + values.encodeOp (IT_r); + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + Cubit::Many IT_result; + IT_result.decodeOp (IT_r); + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + { + Cubit::Many IT_l1; + return IT_l1; + } +} + +Cubit::oneof Cubit:: cube_union (const Cubit::oneof& values, CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + { + Cubit::oneof IT_l0; + return IT_l0; + } + } + CORBA::Request IT_r (this, "cube_union",IT_env,1,0); + if (!IT_r.isException (IT_env)) { + + values.encodeOp (IT_r); + } + + IT_r.invoke (CORBA::Flags(0),IT_env); + if (!IT_r.isException (IT_env)) { + Cubit::oneof IT_result; + IT_result.decodeOp (IT_r); + IT_r.checkEnv (IT_env); + return IT_result; + } + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } + { + Cubit::oneof IT_l1; + return IT_l1; + } +} + +void Cubit:: please_exit (CORBA::Environment &IT_pEnv) throw (CORBA::SystemException) { + + CORBA::EnvExcRaiser IT_raise; + CORBA::Environment &IT_env = IT_raise.registerEnv (&IT_pEnv); + if (IT_env || m_isNull) { + return ; + } + CORBA::Request IT_r (this, "please_exit",IT_env,1,1); + + IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); + if (IT_r.exceptionKind () == CORBA::SYSTEM_EXCEPTION) { + IT_r.checkEnv (IT_env); + } +} + + + + + +#ifndef Cubit_dispatch_impl + +unsigned char Cubit_dispatch::dispatch (CORBA::Request &IT_r, + unsigned char, void *) { + IT_r.makeRuntimeException1 ("Cubit"); + return 0; +} + +#endif + diff --git a/TAO/tests/Cubit/Orbix/tpr/cubitC.h b/TAO/tests/Cubit/Orbix/tpr/cubitC.h new file mode 100644 index 00000000000..15247168d3c --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubitC.h @@ -0,0 +1,343 @@ +#ifndef _cubitC_h +#define _cubitC_h + +/************************************************************************/ +/* */ +/* This file is automatically generated by ORBeline IDL compiler */ +/* Do not modify this file. */ +/* */ +/* ORBeline (c) is copyrighted by PostModern Computing, Inc. */ +/* */ +/* The generated code conforms to OMG's IDL C++ mapping as */ +/* specified in OMG Document Number: 94-9-14. */ +/* */ +/************************************************************************/ + +#include "corba.h" + + + +class Cubit; +typedef Cubit *Cubit_ptr; +typedef Cubit_ptr CubitRef; + +#ifndef _Cubit_var_ +#define _Cubit_var_ +class Cubit_var +{ + public: + Cubit_var(); + Cubit_var(Cubit_ptr); + Cubit_var(const Cubit_var&); + ~Cubit_var(); + Cubit_var& operator=(Cubit_ptr); + operator Cubit_ptr() const { return _ptr; } +#if defined(_HPCC_BUG) + operator Cubit *&() { return _ptr; } +#else + operator Cubit_ptr&() { return _ptr; } +#endif + Cubit_ptr operator->() const { return _ptr;} + friend NCistream& operator>>(NCistream&, Cubit_var&); + friend NCostream& operator<<(NCostream&, const Cubit_var&); + friend istream& operator>>(istream&, Cubit_var&); + friend ostream& operator<<(ostream&, const Cubit_var&); + private: + Cubit_ptr _ptr; + void operator=(const Cubit_var&) {} +}; +#endif +class Cubit: public virtual CORBA_Object +{ + private: + static const CORBA::TypeInfo _class_info; + Cubit(const Cubit&) {} + void operator=(const Cubit&){} + public: + static const CORBA::TypeInfo *_desc(); + virtual const CORBA::TypeInfo *_type_info() const; + virtual void *_safe_narrow(const CORBA::TypeInfo& ) const; + static CORBA::Object *_factory(); + protected: + Cubit(const char *obj_name = NULL) :CORBA_Object(obj_name, 1) {} + Cubit(NCistream& strm) :CORBA_Object(strm) {} + virtual ~Cubit() {} + public: + static Cubit_ptr _duplicate(Cubit_ptr obj) { + if (obj ) obj->_ref(); + return obj; + } + static Cubit_ptr _nil() { return (Cubit_ptr)NULL;} + static Cubit_ptr _narrow(CORBA::Object *obj); + static Cubit_ptr _clone(Cubit_ptr obj) { + CORBA::Object_var obj_var(__clone(obj)); + +#if defined(_HPCC_BUG) + return _narrow(obj_var.operator CORBA::Object_ptr()); +#else + return _narrow(obj_var); +#endif + } + static Cubit_ptr _bind(const char *object_name = NULL, + const char *host_name = NULL, + const CORBA::BindOptions* opt = NULL); + + virtual CORBA::Octet cube_octet(CORBA::Octet o); + + virtual CORBA::Short cube_short(CORBA::Short s); + + virtual CORBA::Long cube_long(CORBA::Long l); + + struct Many { + CORBA::Octet o; + CORBA::Long l; + CORBA::Short s; + }; + friend NCostream& operator<<(NCostream&, const Many& ); + friend NCistream& operator>>(NCistream&, Many& ); + + friend ostream& operator<<(ostream&, const Many& ); + inline friend istream& operator>>(istream& _strm, Many& _obj) { + NCistream _istrm(_strm); + _istrm >> _obj; + return _strm; + } + + + typedef Many *Many_ptr; + class Many_var + { + public: + Many_var() { _ptr = (Many*)NULL;} + Many_var(Many *ptr) { + _ptr = ptr; + } + Many_var(const Many_var& var) { + if (var._ptr) + _ptr = new Many(*var._ptr); + else + _ptr = (Many *)NULL; + } + ~Many_var() { + if (_ptr != (Many *)NULL) delete _ptr; + } + Many_var& operator=(Many *ptr) { + if (_ptr != (Many *)NULL) delete _ptr; + _ptr = ptr; + return *this; + } + Many_var& operator=(const Many_var& var) { + if (_ptr != (Many *)NULL) delete _ptr; + if (var._ptr) + _ptr = new Many(*var._ptr); + else + _ptr = (Many *)NULL; + return *this; + } + Many *operator->() { return _ptr; } + operator Many () const { return *_ptr; } + operator Many& () { return *_ptr; } + inline friend NCostream& operator<<(NCostream& strm, + const Many_var& var) { + if (var._ptr == (Many *)NULL) { + throw CORBA::BAD_PARAM(); + } + else + strm << *var._ptr; + return strm; + } + inline friend NCistream& operator>>(NCistream& strm, + Many_var& var) { + if ( ! var._ptr) + var._ptr = new Many; + strm >> *var._ptr; + return strm; + } + private: + Many *_ptr; + }; + + + virtual Cubit::Many cube_struct(const Cubit::Many& values); + + enum discrim { + e_0th, + e_1st, + e_2nd, + e_3rd, + e_4th, + e_5th + }; + inline friend NCostream& operator<<(NCostream& _strm, discrim _enum_type) { + _strm << (CORBA::ULong)_enum_type; + return _strm; + } + inline friend NCistream& operator>>(NCistream& _strm, discrim& _enum_type) { + CORBA::ULong _temp; + _strm >> _temp; + if (_temp >= 6) + throw CORBA::BAD_PARAM(); + _enum_type = discrim(_temp); + return _strm; + } + inline friend ostream& operator<<(ostream& _strm, discrim _enum_type) { + if( &_strm == &cout || &_strm == &cerr || &_strm == &clog) { + _strm << "discrim:"; + switch(_enum_type) { + case e_0th: + _strm << "e_0th" << endl; + break; + case e_1st: + _strm << "e_1st" << endl; + break; + case e_2nd: + _strm << "e_2nd" << endl; + break; + case e_3rd: + _strm << "e_3rd" << endl; + break; + case e_4th: + _strm << "e_4th" << endl; + break; + case e_5th: + _strm << "e_5th" << endl; + break; + } + } + else + _strm << (CORBA::ULong)_enum_type; + return _strm; + } + inline friend istream& operator>>(istream& _strm, discrim& _enum_type) { + CORBA::ULong _temp; + _strm >> _temp; + _enum_type = discrim(_temp); + return _strm; + } + + + class oneof + { + public: + private: + discrim _disc; + CORBA::Octet __o; + CORBA::Short __s; + CORBA::Long __l; + Cubit::Many __cm; + public: + oneof() : _disc(discrim(0)) {} + ~oneof() {} + oneof(const oneof& obj); + oneof& operator=(const oneof& obj); + + void _d(discrim val) { _disc = val; } + discrim _d() const { return _disc; } + + void o(CORBA::Octet val) { + __o = val; + _disc = Cubit::e_0th; + } + CORBA::Octet o() const { return __o; } + + void s(CORBA::Short val) { + __s = val; + _disc = Cubit::e_1st; + } + CORBA::Short s() const { return __s; } + + void l(CORBA::Long val) { + __l = val; + _disc = Cubit::e_2nd; + } + CORBA::Long l() const { return __l; } + + void cm(const Cubit::Many& val) { + __cm = val; + _disc = Cubit::e_3rd; + } + const Cubit::Many& cm() const { return __cm; } + Cubit::Many& cm() { return __cm; } + + friend NCostream& operator<<(NCostream&, const oneof& ); + friend NCistream& operator>>(NCistream&, oneof& ); + friend ostream& operator<<(ostream&, const oneof&); + inline friend istream& operator>>(istream& strm, oneof& obj) { + NCistream istrm(strm); + strm >> obj; + return strm; + } + }; + + typedef oneof *oneof_ptr; + class oneof_var + { + public: + oneof_var() { _ptr = (oneof*)NULL;} + oneof_var(oneof *ptr) { + _ptr = ptr; + } + oneof_var(const oneof_var& var) { + _ptr = new oneof(*var._ptr); + } + ~oneof_var() { + if (_ptr != (oneof *)NULL) delete _ptr; + } + oneof_var& operator=(oneof *ptr) { + if (_ptr != (oneof *)NULL) delete _ptr; + _ptr = ptr; + return *this; + } + oneof_var& operator=(const oneof_var& var) { + if (_ptr != (oneof *)NULL) delete _ptr; + _ptr = new oneof(*var._ptr); + return *this; + } + oneof *operator->() { return _ptr; } + operator oneof () const { return *_ptr; } + operator oneof& () { return *_ptr; } + inline friend NCostream& operator<<(NCostream& strm, + const oneof_var& var) { + if (var._ptr == (oneof *)NULL) { + throw CORBA::BAD_PARAM(); + } + else + strm << *var._ptr; + return strm; + } + inline friend NCistream& operator>>(NCistream& strm, + oneof_var& var) { + if ( ! var._ptr) + var._ptr = new oneof; + strm >> *var._ptr; + return strm; + } + private: + oneof *_ptr; + }; + + + virtual Cubit::oneof cube_union(const Cubit::oneof& values); + + virtual void please_exit(); + + inline friend NCistream& operator>>(NCistream& strm, Cubit_ptr& obj) { + CORBA::Object_var _obj(obj); + _obj = CORBA::Object::_read(strm, Cubit::_desc()); + obj = Cubit::_narrow(_obj); + return strm; + } + inline friend ostream& operator<<(ostream& strm, const Cubit_ptr obj) { + strm << (CORBA::Object_ptr)obj; + return strm; + } + inline friend istream& operator>>(istream& strm, Cubit_ptr& obj) { + NCistream istrm(strm); + istrm >> obj; + return strm; + } +}; + + +#endif + diff --git a/TAO/tests/Cubit/Orbix/tpr/cubitS.cpp b/TAO/tests/Cubit/Orbix/tpr/cubitS.cpp new file mode 100644 index 00000000000..449a8c23548 --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubitS.cpp @@ -0,0 +1,226 @@ +#include "cubit.h" + + +#define Cubit_dispatch_impl + +unsigned char Cubit_dispatch::dispatch (CORBA::Request &IT_r, + unsigned char IT_isTarget, void *IT_pp) { + if (!IT_pp) + IT_pp = m_obj; + const char *IT_s = IT_r.getOperation (); + if (!strcmp(IT_s,"cube_octet")) { + CORBA::Octet IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_octet~+o{o},>{o},N{}\ +")) + return 1; + CORBA::Octet o; + + IT_r.extractOctet (o); + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_octet ( o, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +o\ +", IT_env)) return 1; + IT_r.insertOctet (IT_result); + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_short")) { + CORBA::Short IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_short~+s{s},>{s},N{}\ +")) + return 1; + CORBA::Short s; + + IT_r >> s; + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_short ( s, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +s\ +", IT_env)) return 1; + IT_r << IT_result; + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_long")) { + CORBA::Long IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_long~+l{l},>{l},N{}\ +")) + return 1; + CORBA::Long l; + + IT_r >> l; + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_long ( l, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +l\ +", IT_env)) return 1; + IT_r << IT_result; + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_struct")) { + Cubit::Many IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~cube_struct~+values{R~Cubit::Many~o{o},l{l},s{s}},>{R~Cubit::Many~o{o},l{l},s{s}},N{}\ +")) + return 1; + Cubit::Many values; + + values.decodeOp (IT_r); + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_struct ( values, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +R~Cubit::Many~o{o},l{l},s{s}\ +", IT_env)) return 1; + IT_result.encodeOp (IT_r); + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"cube_union")) { + Cubit::oneof IT_result; + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + IT_r.tcPreAssert ( +"\ +Ro~cube_union~+values{U~Cubit::oneof~{E~Cubit::discrim~e_0th,e_1st,e_2nd,e_3rd,e_4th,e_5th}~Cubit::e_0th o{o};Cubit::e_1st s{s};Cubit::e_2nd l{l};Cubit::e_3rd,$ cm{R~Cubit::Many~o{o},l{l},s{s}}},>{U~Cubit::oneof~{E~Cubit::discrim~e_0th,e_1st,e_2nd,e_3rd,\ +"); + if (!IT_r.tcAssert ("\ +e_4th,e_5th}~Cubit::e_0th o{o};Cubit::e_1st s{s};Cubit::e_2nd l{l};Cubit::e_3rd,$ cm{R~Cubit::Many~o{o},l{l},s{s}}},N{}\ +")) + return 1; + Cubit::oneof values; + + values.decodeOp (IT_r); + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + IT_result = ((Cubit*)IT_pp)->cube_union ( values, IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + + if (!IT_r.isException (IT_env)) { + if (!IT_r.convertToReply ("\ +U~Cubit::oneof~{E~Cubit::discrim~e_0th,e_1st,e_2nd,e_3rd,e_4th,e_5th}~Cubit::e_0th o{o};Cubit::e_1st s{s};Cubit::e_2nd l{l};Cubit::e_3rd,$ cm{R~Cubit::Many~o{o},l{l},s{s}}\ +", IT_env)) return 1; + IT_result.encodeOp (IT_r); + } + + else IT_r.makeSystemException (IT_env); + return 1; + } + + if (!strcmp(IT_s,"please_exit")) { + CORBA::Environment IT_env (IT_r); + CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); + if (!IT_r.tcAssert ("\ +Ro~please_exit~>{v},O{}\ +")) + return 1; + + if (IT_f && !IT_r.isException (IT_env)) + IT_f->inRequestPostM (IT_r, IT_env); + if (!IT_r.isException (IT_env)) { + try { + ((Cubit*)IT_pp)->please_exit (IT_env); + + } catch (CORBA::SystemException &IT_exSys) { + IT_env.propagate (&IT_exSys); + } catch (CORBA::UserException &IT_exUsr) { + IT_env.propagate (&IT_exUsr); + } + } + IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); + return 1; + } + + if (IT_isTarget) + IT_r.makeRuntimeException2 (); + + return 0; +} + +#include "cubitC.cpp" + diff --git a/TAO/tests/Cubit/Orbix/tpr/cubitS.h b/TAO/tests/Cubit/Orbix/tpr/cubitS.h new file mode 100644 index 00000000000..757af4664ad --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubitS.h @@ -0,0 +1,118 @@ +#ifndef _cubitS_h +#define _cubitS_h + +#include "cubitC.h" + +/************************************************************************/ +/* */ +/* This file is automatically generated by ORBeline IDL compiler */ +/* Do not modify this file. */ +/* */ +/* ORBeline (c) is copyrighted by PostModern Computing, Inc. */ +/* */ +/* The generated code conforms to OMG's IDL C++ mapping as */ +/* specified in OMG Document Number: 94-9-14. */ +/* */ +/************************************************************************/ + +class _sk_Cubit : public Cubit +{ + protected: + _sk_Cubit(const char *object_name = (const char *)NULL); + _sk_Cubit(const char *service_name, const CORBA::ReferenceData& data); + virtual ~_sk_Cubit() {} + public: + static const CORBA::TypeInfo _skel_info; + + // The following operations need to be implemented by the server. + virtual CORBA::Octet cube_octet(CORBA::Octet o) = 0; + virtual CORBA::Short cube_short(CORBA::Short s) = 0; + virtual CORBA::Long cube_long(CORBA::Long l) = 0; + virtual Cubit::Many cube_struct(const Cubit::Many& values) = 0; + virtual Cubit::oneof cube_union(const Cubit::oneof& values) = 0; + virtual void please_exit() = 0; + + // Skeleton Operations implemented automatically + + static void _cube_octet(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_short(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_long(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_struct(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _cube_union(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + + static void _please_exit(void *obj, + CORBA::MarshalStream &strm, + CORBA::Principal_ptr principal, + const char *oper, + void *priv_data); + +}; +template <class T> +class _tie_Cubit : public Cubit +{ + public: + _tie_Cubit(T& t, const char *obj_name=(char*)NULL) : + Cubit(obj_name), + _ref(t) { + _object_name(obj_name); + } + _tie_Cubit(T& t, const char *service_name, + const CORBA::ReferenceData& id) + :_ref(t) { + _service(service_name, id); + } + ~_tie_Cubit() {} + CORBA::Octet cube_octet(CORBA::Octet o) { + return _ref.cube_octet( + o); + } + CORBA::Short cube_short(CORBA::Short s) { + return _ref.cube_short( + s); + } + CORBA::Long cube_long(CORBA::Long l) { + return _ref.cube_long( + l); + } + Cubit::Many cube_struct(const Cubit::Many& values) { + return _ref.cube_struct( + values); + } + Cubit::oneof cube_union(const Cubit::oneof& values) { + return _ref.cube_union( + values); + } + void please_exit() { + _ref.please_exit(); + } + + private: + T& _ref; +}; + +#endif + diff --git a/TAO/tests/Cubit/Orbix/tpr/cubit_impl.cpp b/TAO/tests/Cubit/Orbix/tpr/cubit_impl.cpp new file mode 100644 index 00000000000..e35f1084118 --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubit_impl.cpp @@ -0,0 +1,46 @@ +#include "cubit_impl.h" + +CORBA::Octet Cubit_Impl:: cube_octet (CORBA::Octet o, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + return (CORBA::Octet) (o * o * o); +} + +CORBA::Short Cubit_Impl:: cube_short (CORBA::Short s, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + return (CORBA::Short) (s * s * s); +} + +CORBA::Long Cubit_Impl:: cube_long (CORBA::Long l, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + return (CORBA::Long) (l * l * l); +} + +Cubit::Many Cubit_Impl:: cube_struct (const Cubit::Many& values, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + Cubit::Many out_values; + out_values.o = values.o * values.o * values.o; + out_values.s = values.s * values.s * values.s; + out_values.l = values.l * values.l * values.l; + return out_values; +} + +Cubit::oneof Cubit_Impl:: cube_union (const Cubit::oneof& values, CORBA::Environment &IT_env) throw (CORBA::SystemException) { + Cubit::oneof out_values; + switch (values._d ()) { + case Cubit::e_0th: + out_values.o (values.o () * values.o () * values.o ()); + break; + case Cubit::e_1st: + out_values.s (values.s () * values.s () * values.s ()); + break; + case Cubit::e_2nd: + out_values.l (values.l () * values.l () * values.l ()); + break; + case Cubit::e_3rd: + default: + out_values.cm ().o = values.cm ().o * values.cm ().o * values.cm ().o ; + out_values.cm ().s = values.cm ().s * values.cm ().s * values.cm ().s ; + out_values.cm ().l = values.cm ().l * values.cm ().l * values.cm ().l ; + break; + } + return out_values; +} + +void Cubit_Impl:: please_exit (CORBA::Environment &IT_env) throw (CORBA::SystemException) { +} diff --git a/TAO/tests/Cubit/Orbix/tpr/cubit_impl.h b/TAO/tests/Cubit/Orbix/tpr/cubit_impl.h new file mode 100644 index 00000000000..1e710bb15d1 --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/cubit_impl.h @@ -0,0 +1,27 @@ + +#ifndef cubit_ih +#define cubit_ih + +#include "cubit.h" + + +#ifdef Cubit_USE_BOA +class Cubit_Impl : public virtual CubitBOAImpl { +#else +class Cubit_Impl { +#endif /* Cubit_USE_BOA */ + +public: + virtual CORBA::Octet cube_octet (CORBA::Octet o, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual CORBA::Short cube_short (CORBA::Short s, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual CORBA::Long cube_long (CORBA::Long l, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual Cubit::Many cube_struct (const Cubit::Many& values, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual Cubit::oneof cube_union (const Cubit::oneof& values, CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); + virtual void please_exit (CORBA::Environment &IT_env=CORBA::default_environment) throw (CORBA::SystemException); +}; + +#ifndef Cubit_USE_BOA +DEF_TIE_Cubit (Cubit_Impl) +#endif /* Cubit_USE_BOA */ + +#endif diff --git a/TAO/tests/Cubit/Orbix/tpr/server.cpp b/TAO/tests/Cubit/Orbix/tpr/server.cpp new file mode 100644 index 00000000000..96117fe3e0d --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/server.cpp @@ -0,0 +1,40 @@ +//************************************************************************** +// +// NAME : tpr_server.cpp +// DESCRIPTION: +// +// Server mainline +// +//**************************************************************************** +#define IT_EX_MACROS + +#include "cubit_impl.h" // server header file + +int +main (int , char**) +{ + +#ifdef Cubit_USE_BOA + Cubit_var cb = new Cubit_Impl; + cout << "Using BOA approach" << endl; +#else + Cubit_var cb = new TIE_Cubit (Cubit_Impl) (new Cubit_Impl); + cout << "Using TIE approach" << endl; +#endif /* Cubit_USE_BOA */ + + // + // Go get some work to do.... + // + IT_TRY { + CORBA::Orbix.impl_is_ready("Cubit", IT_X); + } + IT_CATCHANY { + cout << IT_X << endl; + } + IT_ENDTRY; + + cout << "Cubit server is exiting." << endl; + + + return 0; +} diff --git a/TAO/tests/Cubit/Orbix/tpr/tpr.cpp b/TAO/tests/Cubit/Orbix/tpr/tpr.cpp new file mode 100644 index 00000000000..bd8a1c5e899 --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/tpr.cpp @@ -0,0 +1,26 @@ +#include "tpr.h" + +void * +worker(void *vp) +{ + ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); + CORBA::Orbix.continueThreadDispatch (*(CORBA::Request *)vp); + return NULL; +} + + +int +tpr_filter::inRequestPreMarshal(CORBA::Request &r, CORBA::Environment&) +{ +// thread_t tid; +// thr_create(NULL, 0, worker, (void *)&r, THR_DETACHED, &tid); + + ACE_Thread_Manager *thr_mgr = ACE_Service_Config::thr_mgr (); + thr_mgr->spawn (ACE_THR_FUNC (worker), + (void *) &r, + THR_DETACHED); + + return -1; +} + +tpr_filter tpr_dispatcher; diff --git a/TAO/tests/Cubit/Orbix/tpr/tpr.h b/TAO/tests/Cubit/Orbix/tpr/tpr.h new file mode 100644 index 00000000000..38c2ccc7069 --- /dev/null +++ b/TAO/tests/Cubit/Orbix/tpr/tpr.h @@ -0,0 +1,10 @@ +#include "cubit.h" +#include "ace/Service_Config.h" +#include "ace/Thread_Manager.h" + +// +// Create a thread filter to dispatch incoming calls +// +class tpr_filter : public CORBA::ThreadFilter { + virtual int inRequestPreMarshal(CORBA::Request &, CORBA::Environment&); +}; |