diff options
Diffstat (limited to 'TAO/IIOP/test/Orbix/tpr')
-rw-r--r-- | TAO/IIOP/test/Orbix/tpr/cubit.h | 97 | ||||
-rw-r--r-- | TAO/IIOP/test/Orbix/tpr/cubitC.h | 588 | ||||
-rw-r--r-- | TAO/IIOP/test/Orbix/tpr/cubitS.h | 172 | ||||
-rw-r--r-- | TAO/IIOP/test/Orbix/tpr/tpr.h | 7 |
4 files changed, 437 insertions, 427 deletions
diff --git a/TAO/IIOP/test/Orbix/tpr/cubit.h b/TAO/IIOP/test/Orbix/tpr/cubit.h index 1fd0a2d3c7d..37fb9f317d4 100644 --- a/TAO/IIOP/test/Orbix/tpr/cubit.h +++ b/TAO/IIOP/test/Orbix/tpr/cubit.h @@ -5,6 +5,11 @@ #define cubit_hh #include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + #include <CORBA.h> @@ -13,7 +18,7 @@ class Cubit_dispatch : public virtual CORBA::PPTR { public: - Cubit_dispatch (void *IT_p, CORBA::Object* IT_o, const char *IT_m, + 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) {} @@ -28,12 +33,12 @@ public: : PPTR (IT_OR,IT_p,IT_o) {} - Cubit_dispatch (void *IT_p, CORBA::Object *IT_o, const char *IT_m, + 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, + virtual unsigned char dispatch (CORBA::Request &IT_r, unsigned char IT_isTarget, void* IT_pp=NULL); @@ -92,12 +97,12 @@ protected: } public: static Cubit_ptr _duplicate( - Cubit_ptr, + 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 ()); + 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 ()); @@ -585,7 +590,7 @@ class Cubit_SeqElem : public CORBA::_SeqElem } operator Cubit_ptr () const { - return _ptr ? (Cubit_ptr) (*_ptr) : Cubit_nil(); + return _ptr ? (Cubit_ptr) (*_ptr) : Cubit_nil(); } Cubit_ptr operator->() const { return *_ptr;} @@ -601,76 +606,76 @@ class Cubit_SeqElem : public CORBA::_SeqElem #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; } \ - \ + 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 \ +#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);\ }\ @@ -681,19 +686,19 @@ 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) {} + : 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 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 CORBA::Object* New2Object (); virtual void* IT_castUp (void *IT_p, char* IT_s, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); @@ -711,7 +716,7 @@ 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); + (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; diff --git a/TAO/IIOP/test/Orbix/tpr/cubitC.h b/TAO/IIOP/test/Orbix/tpr/cubitC.h index 584efa67c8d..5c020bd0c4b 100644 --- a/TAO/IIOP/test/Orbix/tpr/cubitC.h +++ b/TAO/IIOP/test/Orbix/tpr/cubitC.h @@ -28,316 +28,316 @@ typedef Cubit_ptr CubitRef; 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; } + 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; } + operator Cubit *&() { return _ptr; } #else - operator Cubit_ptr&() { return _ptr; } + 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&); + 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&) {} + 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&){} + 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(); + 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() {} + 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)); + 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()); + return _narrow(obj_var.operator CORBA::Object_ptr()); #else - return _narrow(obj_var); + 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; - } + } + 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; + } }; diff --git a/TAO/IIOP/test/Orbix/tpr/cubitS.h b/TAO/IIOP/test/Orbix/tpr/cubitS.h index 3ca717e2b49..7132e9d229c 100644 --- a/TAO/IIOP/test/Orbix/tpr/cubitS.h +++ b/TAO/IIOP/test/Orbix/tpr/cubitS.h @@ -20,100 +20,100 @@ 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() {} + _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); - + 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(); - } + _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; + T& _ref; }; #endif diff --git a/TAO/IIOP/test/Orbix/tpr/tpr.h b/TAO/IIOP/test/Orbix/tpr/tpr.h index b5e8be94cf1..7912a2dc92c 100644 --- a/TAO/IIOP/test/Orbix/tpr/tpr.h +++ b/TAO/IIOP/test/Orbix/tpr/tpr.h @@ -2,11 +2,16 @@ #include "cubit.h" #include "ace/Service_Config.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + #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&); + virtual int inRequestPreMarshal(CORBA::Request &, CORBA::Environment&); }; |