diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1998-04-14 19:09:33 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1998-04-14 19:09:33 +0000 |
commit | 44dbcae7fbbc45d362e9a108952846f2f95de935 (patch) | |
tree | 2cb384ef4a293f6a7a2cdbefc86fb2f99d48c8a2 | |
parent | dc91dcc9c80369d1a005b95336c6baefc83b6032 (diff) | |
download | ATCD-44dbcae7fbbc45d362e9a108952846f2f95de935.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tao/Any.cpp | 120 | ||||
-rw-r--r-- | TAO/tao/Any.h | 2 | ||||
-rw-r--r-- | TAO/tao/CDR.h | 32 | ||||
-rw-r--r-- | TAO/tao/CDR.i | 111 | ||||
-rw-r--r-- | TAO/tao/Makefile | 178 | ||||
-rw-r--r-- | TAO/tao/Marshal.h | 70 | ||||
-rw-r--r-- | TAO/tao/ORB.h | 28 | ||||
-rw-r--r-- | TAO/tao/PolicyC.cpp | 225 | ||||
-rw-r--r-- | TAO/tao/PolicyC.h | 220 | ||||
-rw-r--r-- | TAO/tao/PolicyC.i | 381 | ||||
-rw-r--r-- | TAO/tao/PolicyS.cpp | 275 | ||||
-rw-r--r-- | TAO/tao/PolicyS.h | 114 | ||||
-rw-r--r-- | TAO/tao/PolicyS.i | 10 | ||||
-rw-r--r-- | TAO/tao/corba.h | 2 | ||||
-rw-r--r-- | TAO/tao/decode.cpp | 103 | ||||
-rw-r--r-- | TAO/tao/skip.cpp | 751 |
16 files changed, 2492 insertions, 130 deletions
diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index 215a18e486b..b9b35548fbe 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -72,11 +72,33 @@ CORBA_Any::CORBA_Any (CORBA::TypeCode_ptr tc, void *value, CORBA::Boolean any_owns_data) : type_ (tc), - value_ (value), any_owns_data_ (any_owns_data), refcount_ (1) { tc->AddRef (); + // if the Any owns the data, we encode the "value" into a CDR stream and + // store it. We also destroy the "value" since we own it. + if (this->any_owns_data_) + { + CORBA::Environment env; + TAO_OutputCDR stream; + + stream.encode (tc, value, 0, env); + // retrieve the start of the message block chain and duplicate it + this->value_ = ACE_Message_Block::duplicate ((ACE_Message_Block *) + stream.start ()); + + // we own the data. So first do a deep free and then deallocate it. + DEEP_FREE (tc, value, 0, env); + // @@ - address the following + // delete this->value_; + + } + else + { + // we don't own it. Maintain a pointer to the value + this->value_ = value; + } } // Copy constructor for "Any". @@ -86,17 +108,25 @@ CORBA_Any::CORBA_Any (const CORBA_Any &src) refcount_ (1) { CORBA::Environment env; - size_t size; this->type_->AddRef (); - size = this->type_->size (env); + // does the source own its data? If not, then it is not in the message block + // form and must be encoded. Else we must simply duplicate the message block + if (src.any_owns_data_) + { + this->value_ = ACE_Message_Block::duplicate ((ACE_Message_Block *) + src.value_); + } + else + { + TAO_OutputCDR stream; - // allocate sufficient memory and deep copy the data - // @@ - the following allocation to be addressed by our memory management - // scheme - this->value_ = (char *) ACE_OS::calloc (1, size); - (void) DEEP_COPY (this->type_, src.value_, this->value_, env); + stream.encode (this->type_, src.value_, 0, env); + // retrieve the start of the message block chain and duplicate it + this->value_ = ACE_Message_Block::duplicate ((ACE_Message_Block *) + stream.start ()); + } } // assignment operator @@ -116,26 +146,34 @@ CORBA_Any::operator= (const CORBA_Any &src) // if we own any previous data, deallocate it if (this->any_owns_data_) { - DEEP_FREE (this->type_, this->value_, 0, env); - // @@: The following needs to be addressed properly. We need to make - // sure if we use "delete" or "free" - // delete this->value_; + // decrement the refcount on the Message_Block we hold + ACE_Message_Block::release ((ACE_Message_Block *) this->value_); + if (this->type_) + this->type_->Release (); } // Now copy the contents of the source to ourselves. this->type_ = (src.type_) != 0 ? src.type_ : CORBA::_tc_null; - this->any_owns_data_ = CORBA::B_TRUE; this->refcount_ = 1; - this->type_->AddRef (); - size = this->type_->size (env); + // does the source own its data? If not, then it is not in the message block + // form and must be encoded. Else we must simply duplicate the message block + if (src.any_owns_data_) + { + this->value_ = ACE_Message_Block::duplicate ((ACE_Message_Block *) + src.value_); + } + else + { + TAO_OutputCDR stream; - // allocate sufficient storage and deep copy the data - // @@ - address the following - this->value_ = (char *) ACE_OS::calloc (1, size); - (void) DEEP_COPY (this->type_, src.value_, this->value_, env); + stream.encode (this->type_, src.value_, 0, env); + // retrieve the start of the message block chain and duplicate it + this->value_ = ACE_Message_Block::duplicate ((ACE_Message_Block *) + stream.start ()); + } return *this; } @@ -156,10 +194,8 @@ CORBA_Any::~CORBA_Any (void) if (this->any_owns_data_) { - // we own the data. So first do a deep free and then deallocate it. - DEEP_FREE (this->type_, this->value_, 0, env); - // @@ - address the following - // delete this->value_; + // decrement the refcount on the Message_Block we hold + ACE_Message_Block::release ((ACE_Message_Block *) this->value_); } if (this->type_) @@ -170,30 +206,44 @@ CORBA_Any::~CORBA_Any (void) void CORBA_Any::replace (CORBA::TypeCode_ptr tc, - const void *v, + const void *value, CORBA::Boolean any_owns_data, CORBA::Environment &env) { if (this->any_owns_data_) { - if (this->value_) - { - DEEP_FREE (this->type_, this->value_, 0, env); - // @@ - to be addressed - // delete this->value_; - } + // decrement the refcount on the Message_Block we hold + ACE_Message_Block::release ((ACE_Message_Block *) this->value_); } - - if (env.exception ()) - return; - if (this->type_ != 0) this->type_->Release (); this->type_ = tc; tc->AddRef (); - this->value_ = (void *) v; this->any_owns_data_ = any_owns_data; + // if the Any owns the data, we encode the "value" into a CDR stream and + // store it. We also destroy the "value" since we own it. + if (this->any_owns_data_) + { + CORBA::Environment env; + TAO_OutputCDR stream; + + stream.encode (tc, value, 0, env); + // retrieve the start of the message block chain and duplicate it + this->value_ = ACE_Message_Block::duplicate ((ACE_Message_Block *) + stream.start ()); + + // we own the data. So first do a deep free and then deallocate it. + DEEP_FREE (tc, value, 0, env); + // @@ - address the following + // delete this->value_; + + } + else + { + // we don't own it. Maintain a pointer to the value + this->value_ = (void *)value; + } } // insertion of from_string diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index 85601218be0..99b6092f33c 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -288,6 +288,8 @@ private: // 94-9-14 hides unsigned char insert/extract void operator<<= (unsigned char); CORBA::Boolean operator>>= (unsigned char&) const; + + friend class TAO_Marshal_Any; }; class TAO_Export CORBA_Any_var diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h index ca62b832890..5710ec02cd6 100644 --- a/TAO/tao/CDR.h +++ b/TAO/tao/CDR.h @@ -108,7 +108,7 @@ public: static void mb_align (ACE_Message_Block* mb); static int grow (ACE_Message_Block*& mb, size_t minsize); - // Increase the capacity of mb to contain at least <minsize> bytes. + // Increase the capacity of mb to contain at least <minsize> bytes. // If <minsze> is zero the size is increased by an amount at least // large enough to contain any of the basic IDL types. // Return -1 on failure, 0 on success. @@ -405,7 +405,7 @@ public: CORBA::ULong length); // = TAO specific methods. - + CORBA::TypeCode::traverse_status decode (CORBA::TypeCode_ptr tc, const void *data, const void *, @@ -413,6 +413,22 @@ public: // Demarshall the contents of the CDR stream into <data> as // described by <tc>; returning any errors in <env>. + // = We have one method per basic IDL type.... + // They return CORBA::B_FALSE on failure and CORBA::B_TRUE on success. + CORBA_Boolean skip_boolean (void); + CORBA_Boolean skip_char (void); + CORBA_Boolean skip_wchar (void); + CORBA_Boolean skip_octet (void); + CORBA_Boolean skip_short (void); + CORBA_Boolean skip_ushort (void); + CORBA_Boolean skip_long (void); + CORBA_Boolean skip_ulong (void); + CORBA_Boolean skip_longlong (void); + CORBA_Boolean skip_ulonglong (void); + CORBA_Boolean skip_float (void); + CORBA_Boolean skip_double (void); + CORBA_Boolean skip_longdouble (void); + CORBA_Boolean skip_wstring (void); CORBA_Boolean skip_string (void); // The next field must be a string, this method skips it. It is // useful in parsing a TypeCode. @@ -422,9 +438,19 @@ public: // Skip <n> bytes in the CDR stream. // Return CORBA::B_FALSE on failure and CORBA::B_TRUE on success. + CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + CORBA::Environment &env); + // Skip the contents of the CDR stream based on information + // described by <tc>; returning any errors in <env>. + int good_bit (void) const; // returns zero if a problem has been detected. + const ACE_Message_Block* start (void) const; + // Return the start of the message block chain for this CDR stream. + // NOTE: In the current implementation the chain has length 1, but + // we are planning to change that. + char* rd_ptr (void); // Returns the current position for the rd_ptr.... @@ -435,7 +461,7 @@ private: void rd_ptr (size_t offset); char* end (void); // short cuts for the underlying message block. - + int adjust (size_t size, char*& buf); // Returns (in <buf>) the next position in the buffer aligned to // <size>, it advances the Message_Block rd_ptr past the data diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i index d327f829004..eccd836baca 100644 --- a/TAO/tao/CDR.i +++ b/TAO/tao/CDR.i @@ -463,6 +463,98 @@ TAO_InputCDR::read_longdouble_array (CORBA::LongDouble* x, length); } +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_char (void) +{ + CORBA::Char x; + return this->read_1 (ACE_reinterpret_cast(CORBA::Octet*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_wchar (void) +{ + CORBA::WChar x; + return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_octet (void) +{ + CORBA::Octet x; + return this->read_1 (&x); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_boolean (void) +{ + CORBA::Octet tmp; + this->read_octet (tmp); + return this->good_bit_; +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_short (void) +{ + CORBA::Short x; + return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_ushort (void) +{ + CORBA::UShort x; + return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_long (void) +{ + CORBA::Long x; + return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_ulong (void) +{ + CORBA::ULong x; + return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_longlong (void) +{ + CORBA::LongLong x; + return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_ulonglong (void) +{ + CORBA::ULongLong x; + return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_float (void) +{ + CORBA::Float x; + return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_double (void) +{ + CORBA::Double x; + return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x)); +} + +ACE_INLINE CORBA_Boolean +TAO_InputCDR::skip_longdouble (void) +{ + CORBA::LongDouble x; + return this->read_16 (ACE_reinterpret_cast(CORBA::LongDouble*,&x)); +} + ACE_INLINE int TAO_InputCDR::good_bit (void) const { @@ -483,12 +575,30 @@ TAO_InputCDR::decode (CORBA::TypeCode_ptr tc, return CORBA::TypeCode::TRAVERSE_STOP; } +ACE_INLINE CORBA::TypeCode::traverse_status +TAO_InputCDR::skip (CORBA::TypeCode_ptr tc, + CORBA::Environment &env) +{ + TAO_Marshal_Object *mobj = + this->factory_->make_marshal_object (tc, env); + + if (env.exception() == 0 && mobj != 0) + return mobj->skip (tc, this, env); + return CORBA::TypeCode::TRAVERSE_STOP; +} + ACE_INLINE size_t TAO_InputCDR::length (void) const { return this->start_->length (); } +ACE_INLINE const ACE_Message_Block* +TAO_InputCDR::start (void) const +{ + return this->start_; +} + ACE_INLINE char* TAO_InputCDR::rd_ptr (void) { @@ -657,4 +767,3 @@ operator>> (TAO_InputCDR& cdr, CORBA::Char &x) return cdr; } #endif /* 0 */ - diff --git a/TAO/tao/Makefile b/TAO/tao/Makefile index 8274738a453..1e0bf817d02 100644 --- a/TAO/tao/Makefile +++ b/TAO/tao/Makefile @@ -25,6 +25,8 @@ ORBCORE_SRCS = \ POA \ POAC \ POAS \ + PolicyC \ + PolicyS \ Principal \ Request \ Sequence \ @@ -54,6 +56,7 @@ ORBCORE_SRCS = \ params \ Server_Strategy_Factory \ Servant_Base \ + skip \ TAO_Internal \ Typecode_Constants \ TAO \ @@ -6481,6 +6484,181 @@ LDFLAGS += $(RLDFLAGS) $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/singletons.h +.obj/skip.o .obj/skip.so .shobj/skip.o .shobj/skip.so: skip.cpp $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/Version.h \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i \ + $(ACE_ROOT)/ace/SOCK_Stream.h \ + $(ACE_ROOT)/ace/SOCK_IO.h \ + $(ACE_ROOT)/ace/SOCK.h \ + $(ACE_ROOT)/ace/Addr.h \ + $(ACE_ROOT)/ace/Addr.i \ + $(ACE_ROOT)/ace/IPC_SAP.h \ + $(ACE_ROOT)/ace/IPC_SAP.i \ + $(ACE_ROOT)/ace/SOCK.i \ + $(ACE_ROOT)/ace/SOCK_IO.i \ + $(ACE_ROOT)/ace/INET_Addr.h \ + $(ACE_ROOT)/ace/INET_Addr.i \ + $(ACE_ROOT)/ace/SOCK_Stream.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/SOCK_Acceptor.h \ + $(ACE_ROOT)/ace/Time_Value.h \ + $(ACE_ROOT)/ace/SOCK_Acceptor.i \ + $(ACE_ROOT)/ace/SOCK_Connector.h \ + $(ACE_ROOT)/ace/SOCK_Connector.i \ + $(ACE_ROOT)/ace/Strategies.h \ + $(ACE_ROOT)/ace/Strategies_T.h \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(ACE_ROOT)/ace/Synch_Options.h \ + $(ACE_ROOT)/ace/Connector.h \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Svc_Handler.h \ + $(ACE_ROOT)/ace/Task.h \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(ACE_ROOT)/ace/Task.i \ + $(ACE_ROOT)/ace/Task_T.h \ + $(ACE_ROOT)/ace/Message_Queue.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ + $(ACE_ROOT)/ace/Message_Queue.i \ + $(ACE_ROOT)/ace/Task_T.i \ + $(ACE_ROOT)/ace/Dynamic.h \ + $(ACE_ROOT)/ace/Dynamic.i \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Svc_Handler.i \ + $(ACE_ROOT)/ace/Connector.i \ + $(ACE_ROOT)/ace/Acceptor.h \ + $(ACE_ROOT)/ace/Acceptor.i \ + $(TAO_ROOT)/tao/compat/objbase.h \ + $(TAO_ROOT)/tao/compat/initguid.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(TAO_ROOT)/tao/Align.h \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/Exception.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ + $(TAO_ROOT)/tao/Server_Strategy_Factory.h \ + $(TAO_ROOT)/tao/default_client.h \ + $(TAO_ROOT)/tao/default_client.i \ + $(TAO_ROOT)/tao/default_server.h \ + $(TAO_ROOT)/tao/ORB_Strategies_T.h \ + $(TAO_ROOT)/tao/ORB_Strategies_T.i \ + $(TAO_ROOT)/tao/default_server.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Request.h \ + $(TAO_ROOT)/tao/Request.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Server_Request.h \ + $(TAO_ROOT)/tao/Server_Request.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Marshal.h \ + $(TAO_ROOT)/tao/Marshal.i \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/POA.h \ + $(TAO_ROOT)/tao/POAC.h \ + $(TAO_ROOT)/tao/POAC.i \ + $(TAO_ROOT)/tao/Servant_Base.h \ + $(TAO_ROOT)/tao/POAS.h \ + $(TAO_ROOT)/tao/POAS.i \ + $(TAO_ROOT)/tao/Object_Table.h \ + $(TAO_ROOT)/tao/Connect.h \ + $(TAO_ROOT)/tao/Connect.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(ACE_ROOT)/ace/Dynamic_Service.h \ + $(TAO_ROOT)/tao/Operation_Table.h \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/IIOP_Object.h \ + $(TAO_ROOT)/tao/IIOP_Object.i \ + $(TAO_ROOT)/tao/IIOP_ORB.h \ + $(TAO_ROOT)/tao/IIOP_ORB.i \ + $(TAO_ROOT)/tao/IIOP_Interpreter.h \ + $(TAO_ROOT)/tao/GIOP.h \ + $(TAO_ROOT)/tao/GIOP.i \ + $(TAO_ROOT)/tao/singletons.h .obj/TAO_Internal.o .obj/TAO_Internal.so .shobj/TAO_Internal.o .shobj/TAO_Internal.so: TAO_Internal.cpp \ $(ACE_ROOT)/ace/Service_Config.h \ $(ACE_ROOT)/ace/Service_Object.h \ diff --git a/TAO/tao/Marshal.h b/TAO/tao/Marshal.h index ca932a6662e..a30e3d500b7 100644 --- a/TAO/tao/Marshal.h +++ b/TAO/tao/Marshal.h @@ -112,6 +112,11 @@ public: CORBA::Environment &env) = 0; // decoding operation + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) = 0; + // skip operation + TAO_Marshal_Object (void); // constructor @@ -148,6 +153,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Any: public TAO_Marshal_Object @@ -179,6 +189,11 @@ public: const void *source, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_TypeCode: public TAO_Marshal_Object @@ -210,6 +225,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Principal: public TAO_Marshal_Object @@ -241,6 +261,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_ObjRef: public TAO_Marshal_Object @@ -272,6 +297,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Struct: public TAO_Marshal_Object @@ -303,6 +333,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Union: public TAO_Marshal_Object @@ -334,6 +369,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_String: public TAO_Marshal_Object @@ -365,6 +405,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Sequence: public TAO_Marshal_Object @@ -396,6 +441,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Array: public TAO_Marshal_Object @@ -427,6 +477,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Alias: public TAO_Marshal_Object @@ -458,6 +513,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_Except: public TAO_Marshal_Object @@ -488,6 +548,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; class TAO_Export TAO_Marshal_WString : public TAO_Marshal_Object @@ -518,6 +583,11 @@ public: const void *data, const void *, CORBA::Environment &env); + virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env); + // skip operation + }; #if defined (__ACE_INLINE__) diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index ac7defa2b24..45da9400157 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -107,6 +107,13 @@ class CORBA_Principal; class CORBA_SystemException; class CORBA_UserException; +class CORBA_Policy; +class CORBA_Policy_var; +class CORBA_Policy_out; + +class CORBA_PolicyList; +class CORBA_PolicyList_var; +class CORBA_PolicyList_out; // forward declarations of system exceptions #define TAO_SYSTEM_EXCEPTION(name) class CORBA_ ## name @@ -506,8 +513,7 @@ public: typedef CORBA_ServerRequest ServerRequest; typedef ServerRequest *ServerRequest_ptr; - typedef CORBA_SystemException - SystemException; + typedef CORBA_SystemException SystemException; typedef CORBA_TypeCode TypeCode; typedef TypeCode *TypeCode_ptr; @@ -523,6 +529,16 @@ public: typedef class CORBA_InterfaceDef *InterfaceDef_ptr; + + typedef CORBA_Policy Policy; + typedef CORBA_Policy *Policy_ptr; + typedef CORBA_Policy_var Policy_var; + typedef CORBA_Policy_out Policy_out; + + typedef CORBA_PolicyList PolicyList; + typedef CORBA_PolicyList_var PolicyList_var; + typedef CORBA_PolicyList_out PolicyList_out; + // enum values defined in nvlist.hh, bitwise ORed. typedef u_int Flags; @@ -729,6 +745,14 @@ public: IN_COPY_VALUE = 0x08, OUT_LIST_MEMORY = 0x10 }; + + static CORBA::TypeCode_ptr _tc_Policy; + static CORBA::TypeCode_ptr _tc_PolicyList; + + typedef CORBA::ULong PolicyType; + typedef CORBA::ULong_out PolicyType_out; + static CORBA::TypeCode_ptr _tc_PolicyType; + }; // end of class (namespace) CORBA #include "tao/Sequence.h" diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp new file mode 100644 index 00000000000..010811c2f10 --- /dev/null +++ b/TAO/tao/PolicyC.cpp @@ -0,0 +1,225 @@ +// $Id$ + +/* -*- C++ -*- */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO ORB and the TAO IDL Compiler have been developed by Washington +// University Computer Science's Distributed Object Computing Group. +// +// Information on TAO is available at +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "PolicyC.h" +#include "PolicyS.h" + +#if !defined (__ACE_INLINE__) +#include "PolicyC.i" +#endif /* !defined INLINE */ + +static const CORBA::Long _oc_CORBA_PolicyType[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 25, 0x49444c3a, 0x434f5242, 0x412f506f, 0x6c696379, 0x54797065, 0x3a312e30, 0x0, // repository ID = IDL:CORBA/PolicyType:1.0 + 11, 0x506f6c69, 0x63795479, 0x70650000, // name = PolicyType + CORBA::tk_ulong, + +}; +static CORBA::TypeCode _tc__tc_CORBA_PolicyType (CORBA::tk_alias, sizeof (_oc_CORBA_PolicyType), (char *) &_oc_CORBA_PolicyType, CORBA::B_FALSE); +CORBA::TypeCode_ptr CORBA::_tc_PolicyType = &_tc__tc_CORBA_PolicyType; + +CORBA_Policy_ptr CORBA_Policy::_duplicate (CORBA_Policy_ptr obj) +{ + if (!CORBA::is_nil (obj)) + obj->AddRef (); + + return obj; +} // end of _duplicate + +CORBA_Policy_ptr CORBA_Policy::_narrow ( + CORBA::Object_ptr obj, + CORBA::Environment &env + ) +{ + if (CORBA::is_nil (obj)) + return CORBA_Policy::_nil (); + if (!obj->_is_a ("IDL:CORBA/Policy:1.0", env)) + return CORBA_Policy::_nil (); + if (!obj->_is_collocated () + || !obj->_servant() + || obj->_servant()->_downcast ("IDL:CORBA/Policy:1.0") == 0 + ) + { + CORBA_Policy_ptr new_obj = new CORBA_Policy(obj->_get_parent ()); + return new_obj; + } // end of if + STUB_Object *stub = obj->_servant ()->_create_stub (env); + if (env.exception () != 0) + return CORBA_Policy::_nil (); + void* servant = obj->_servant ()->_downcast ("IDL:CORBA/Policy:1.0"); + return new POA_CORBA::_tao_collocated_Policy( + ACE_reinterpret_cast(POA_CORBA::Policy_ptr, servant), + stub + ); +} + +CORBA_Policy_ptr CORBA_Policy::_nil (void) +{ + return (CORBA_Policy_ptr)NULL; +} // end of _nil + +static const TAO_Param_Data _get_CORBA_Policy_policy_type_paramdata [] = +{ + {CORBA::_tc_PolicyType, PARAM_RETURN, 0} +}; // CORBA_Policy_policy_type_paramdata + +static const TAO_Call_Data _get_CORBA_Policy_policy_type_calldata = +{"_get_policy_type", 1, 1, _get_CORBA_Policy_policy_type_paramdata, 0, 0}; + +CORBA::PolicyType CORBA_Policy::policy_type ( + CORBA::Environment &_tao_environment + ) +{ + CORBA::PolicyType _tao_retval = 0; + STUB_Object *istub = this->stubobj (_tao_environment); + if (istub) + { + istub->do_static_call ( + _tao_environment, + &_get_CORBA_Policy_policy_type_calldata, + &_tao_retval + ); + } // end of if (istub) + return _tao_retval; +} + +static const TAO_Param_Data CORBA_Policy_copy_paramdata [] = +{ + {CORBA::_tc_Policy, PARAM_RETURN, 0} +}; // CORBA_Policy_copy_paramdata + +static const TAO_Call_Data CORBA_Policy_copy_calldata = +{"copy", 1, 1, CORBA_Policy_copy_paramdata, 0, 0}; + +CORBA_Policy_ptr CORBA_Policy::copy ( + CORBA::Environment &_tao_environment + ) +{ + CORBA_Policy_ptr _tao_retval = CORBA_Policy::_nil (); + STUB_Object *istub = this->stubobj (_tao_environment); + if (istub) + { + CORBA::Object_ptr _tao_base_retval = CORBA::Object::_nil (); + istub->do_static_call ( + _tao_environment, + &CORBA_Policy_copy_calldata, + &_tao_base_retval + ); + _tao_retval = CORBA_Policy::_narrow (_tao_base_retval, _tao_environment); + CORBA::release (_tao_base_retval); + } // end of if (istub) + return _tao_retval; +} + +static const TAO_Param_Data CORBA_Policy_destroy_paramdata [] = +{ + {CORBA::_tc_void, PARAM_RETURN, 0} +}; // CORBA_Policy_destroy_paramdata + +static const TAO_Call_Data CORBA_Policy_destroy_calldata = +{"destroy", 1, 1, CORBA_Policy_destroy_paramdata, 0, 0}; + +void CORBA_Policy::destroy ( + CORBA::Environment &_tao_environment + ) +{ + STUB_Object *istub = this->stubobj (_tao_environment); + if (istub) + { + istub->do_static_call ( + _tao_environment, + &CORBA_Policy_destroy_calldata, + 0 + ); + } // end of if (istub) + return; +} + +CORBA::Boolean CORBA_Policy::_is_a (const CORBA::Char *value, CORBA::Environment &env) +{ + if ( + (!ACE_OS::strcmp ((char *)value, "IDL:CORBA/Policy:1.0")) || + (!ACE_OS::strcmp ((char *)value, CORBA::_tc_Object->id (env)))) + return 1; // success using local knowledge + else + return this->CORBA_Object::_is_a (value, env); // remote call +} + +const char* CORBA_Policy::_interface_repository_id (void) const +{ + return "IDL:CORBA/Policy:1.0"; +} + +static const CORBA::Long _oc_CORBA_Policy[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 21, 0x49444c3a, 0x434f5242, 0x412f506f, 0x6c696379, 0x3a312e30, 0x0, // repository ID = IDL:CORBA/Policy:1.0 + 7, 0x506f6c69, 0x63790000, // name = Policy, +}; +static CORBA::TypeCode _tc__tc_CORBA_Policy (CORBA::tk_objref, sizeof (_oc_CORBA_Policy), (char *) &_oc_CORBA_Policy, CORBA::B_FALSE); +CORBA::TypeCode_ptr CORBA::_tc_Policy = &_tc__tc_CORBA_Policy; + + +#if !defined (_CORBA_POLICYLIST_CS_) +#define _CORBA_POLICYLIST_CS_ + +// ************************************************************* +// CORBA_PolicyList +// ************************************************************* + +CORBA_PolicyList::CORBA_PolicyList (void) +{} +CORBA_PolicyList::CORBA_PolicyList (CORBA::ULong max) // uses max size + : TAO_Unbounded_Object_Sequence<CORBA_Policy> (max) +{} +CORBA_PolicyList::CORBA_PolicyList (CORBA::ULong max, CORBA::ULong length, CORBA_Policy_ptr *buffer, CORBA::Boolean release) + : TAO_Unbounded_Object_Sequence<CORBA_Policy> (max, length, buffer, release) +{} +CORBA_PolicyList::CORBA_PolicyList (const CORBA::PolicyList &seq) // copy ctor + : TAO_Unbounded_Object_Sequence<CORBA_Policy> (seq) +{} +CORBA_PolicyList::~CORBA_PolicyList (void) // dtor +{} + +static const CORBA::Long _oc_CORBA_PolicyList_seq[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + CORBA::tk_objref, // typecode kind + 52, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 21, 0x49444c3a, 0x434f5242, 0x412f506f, 0x6c696379, 0x3a312e30, 0x0, // repository ID = IDL:CORBA/Policy:1.0 + 7, 0x506f6c69, 0x63790000, // name = Policy, + 0, +}; +static CORBA::TypeCode _tc__tc_CORBA_PolicyList_seq (CORBA::tk_sequence, sizeof (_oc_CORBA_PolicyList_seq), (char *) &_oc_CORBA_PolicyList_seq, CORBA::B_FALSE); +CORBA::TypeCode_ptr _tc_CORBA_PolicyList_seq = &_tc__tc_CORBA_PolicyList_seq; + + +#endif /* end #if !defined */ + +static const CORBA::Long _oc_CORBA_PolicyList[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 25, 0x49444c3a, 0x434f5242, 0x412f506f, 0x6c696379, 0x4c697374, 0x3a312e30, 0x0, // repository ID = IDL:CORBA/PolicyList:1.0 + 11, 0x506f6c69, 0x63794c69, 0x73740000, // name = PolicyList + CORBA::tk_sequence, // typecode kind + 60, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + CORBA::tk_objref, // typecode kind + 52, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 21, 0x49444c3a, 0x434f5242, 0x412f506f, 0x6c696379, 0x3a312e30, 0x0, // repository ID = IDL:CORBA/Policy:1.0 + 7, 0x506f6c69, 0x63790000, // name = Policy, + 0, +}; +static CORBA::TypeCode _tc__tc_CORBA_PolicyList (CORBA::tk_alias, sizeof (_oc_CORBA_PolicyList), (char *) &_oc_CORBA_PolicyList, CORBA::B_FALSE); +CORBA::TypeCode_ptr CORBA::_tc_PolicyList = &_tc__tc_CORBA_PolicyList; diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h new file mode 100644 index 00000000000..c981670cad5 --- /dev/null +++ b/TAO/tao/PolicyC.h @@ -0,0 +1,220 @@ +// $Id$ + +/* -*- C++ -*- */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO ORB and the TAO IDL Compiler have been developed by Washington +// University Computer Science's Distributed Object Computing Group. +// +// Information on TAO is available at +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#if !defined (_TAO_IDL_POLICYC_H_) +#define _TAO_IDL_POLICYC_H_ + +#include "tao/corba.h" + +#if !defined (_CORBA_POLICY___PTR_CH_) +#define _CORBA_POLICY___PTR_CH_ + +class CORBA_Policy; +typedef CORBA_Policy *CORBA_Policy_ptr; + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_POLICY___VAR_CH_) +#define _CORBA_POLICY___VAR_CH_ + +class CORBA_Policy_var +{ +public: + CORBA_Policy_var (void); // default constructor + CORBA_Policy_var (CORBA_Policy_ptr); + CORBA_Policy_var (const CORBA_Policy_var &); // copy constructor + ~CORBA_Policy_var (void); // destructor + + CORBA_Policy_var &operator= (CORBA_Policy_ptr); + CORBA_Policy_var &operator= (const CORBA_Policy_var &); + CORBA_Policy_ptr operator-> (void) const; + + operator const CORBA_Policy_ptr &() const; + operator CORBA_Policy_ptr &(); + // in, inout, out, _retn + CORBA_Policy_ptr in (void) const; + CORBA_Policy_ptr &inout (void); + CORBA_Policy_ptr &out (void); + CORBA_Policy_ptr _retn (void); + CORBA_Policy_ptr ptr (void) const; + +private: + CORBA_Policy_ptr ptr_; +}; + + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_POLICY___OUT_CH_) +#define _CORBA_POLICY___OUT_CH_ + +class CORBA_Policy_out +{ +public: + CORBA_Policy_out (CORBA_Policy_ptr &); + CORBA_Policy_out (CORBA_Policy_var &); + CORBA_Policy_out (CORBA_Policy_out &); + CORBA_Policy_out &operator= (CORBA_Policy_out &); + CORBA_Policy_out &operator= (const CORBA_Policy_var &); + CORBA_Policy_out &operator= (CORBA_Policy_ptr); + operator CORBA_Policy_ptr &(); + CORBA_Policy_ptr &ptr (void); + CORBA_Policy_ptr operator-> (void); + +private: + CORBA_Policy_ptr &ptr_; +}; + + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_POLICY_CH_) +#define _CORBA_POLICY_CH_ + +class CORBA_Policy : public virtual CORBA::Object +{ +public: + // the static operations + static CORBA_Policy_ptr _duplicate (CORBA_Policy_ptr obj); + static CORBA_Policy_ptr _narrow (CORBA::Object_ptr obj, CORBA::Environment &env); + static CORBA_Policy_ptr _nil (void); + + virtual CORBA::PolicyType policy_type ( + CORBA::Environment &_tao_environment + ); + virtual CORBA_Policy_ptr copy ( + CORBA::Environment &_tao_environment + ); + virtual void destroy ( + CORBA::Environment &_tao_environment + ); + virtual CORBA::Boolean _is_a (const CORBA::Char *type_id, + CORBA::Environment &env + ); + virtual const char* _interface_repository_id (void) const; +protected: + CORBA_Policy (void); // default constructor + CORBA_Policy (STUB_Object *objref, + TAO_ServantBase *_tao_servant = 0, + CORBA::Boolean _tao_collocated = 0 + ); + virtual ~CORBA_Policy (void); +private: + CORBA_Policy (const CORBA_Policy &); + void operator= (const CORBA_Policy &); +}; + + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_POLICYLIST_CH_) +#define _CORBA_POLICYLIST_CH_ + +// ************************************************************* +// CORBA_PolicyList +// ************************************************************* + +class CORBA_PolicyList : public TAO_Unbounded_Object_Sequence<CORBA_Policy> +{ +public: + CORBA_PolicyList (void); // default ctor + CORBA_PolicyList (CORBA::ULong max); // uses max size + CORBA_PolicyList ( + CORBA::ULong max, + CORBA::ULong length, + CORBA_Policy_ptr *buffer, + CORBA::Boolean release=0 + ); + CORBA_PolicyList (const CORBA_PolicyList &); // copy ctor + ~CORBA_PolicyList (void); // dtor +}; +typedef CORBA_PolicyList *CORBA_PolicyList_ptr; +static CORBA::TypeCode_ptr _tc_PolicyList_seq; + + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_POLICYLIST___VAR_CH_) +#define _CORBA_POLICYLIST___VAR_CH_ + +// ************************************************************* +// class CORBA::PolicyList_var +// ************************************************************* + +class CORBA_PolicyList_var +{ +public: + CORBA_PolicyList_var (void); // default constructor + CORBA_PolicyList_var (CORBA_PolicyList *); + CORBA_PolicyList_var (const CORBA_PolicyList_var &); // copy constructor + ~CORBA_PolicyList_var (void); // destructor + + CORBA_PolicyList_var &operator= (CORBA_PolicyList *); + CORBA_PolicyList_var &operator= (const CORBA_PolicyList_var &); + CORBA_PolicyList *operator-> (void); + const CORBA_PolicyList *operator-> (void) const; + + operator const CORBA_PolicyList &() const; + operator CORBA_PolicyList &(); + operator CORBA_PolicyList &() const; + TAO_Object_Manager <CORBA_Policy > operator[] (CORBA::ULong index); + // in, inout, out, _retn + const CORBA_PolicyList &in (void) const; + CORBA_PolicyList &inout (void); + CORBA_PolicyList *&out (void); + CORBA_PolicyList *_retn (void); + CORBA_PolicyList *ptr (void) const; + +private: + CORBA_PolicyList *ptr_; +}; + + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_POLICYLIST___OUT_CH_) +#define _CORBA_POLICYLIST___OUT_CH_ + +class CORBA_PolicyList_out +{ +public: + CORBA_PolicyList_out (CORBA_PolicyList *&); + CORBA_PolicyList_out (CORBA_PolicyList_var &); + CORBA_PolicyList_out (CORBA_PolicyList_out &); + CORBA_PolicyList_out &operator= (CORBA_PolicyList_out &); + CORBA_PolicyList_out &operator= (CORBA_PolicyList *); + operator CORBA_PolicyList *&(); + CORBA_PolicyList *&ptr (void); + CORBA_PolicyList *operator-> (void); + TAO_Object_Manager <CORBA_Policy > operator[] (CORBA::ULong index); + +private: + CORBA_PolicyList *&ptr_; + // assignment from T_var not allowed + void operator= (const CORBA_PolicyList_var &); +}; + + +#endif /* end #if !defined */ + + +#if defined (__ACE_INLINE__) +#include "PolicyC.i" +#endif /* defined INLINE */ + + +#endif /* if !defined */ diff --git a/TAO/tao/PolicyC.i b/TAO/tao/PolicyC.i new file mode 100644 index 00000000000..e9efc734932 --- /dev/null +++ b/TAO/tao/PolicyC.i @@ -0,0 +1,381 @@ +// $Id$ + +/* -*- C++ -*- */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO ORB and the TAO IDL Compiler have been developed by Washington +// University Computer Science's Distributed Object Computing Group. +// +// Information on TAO is available at +// http://www.cs.wustl.edu/~schmidt/TAO.html + +ACE_INLINE +CORBA_Policy::CORBA_Policy (void) // default constructor +{} + +ACE_INLINE +CORBA_Policy::CORBA_Policy (STUB_Object *objref, + TAO_ServantBase *_tao_servant, + CORBA::Boolean _tao_collocated) + : CORBA_Object (objref, _tao_servant, _tao_collocated) +{} + +ACE_INLINE +CORBA_Policy::~CORBA_Policy (void) // destructor +{} + + +#if !defined (_CORBA_Policy___VAR_CI_) +#define _CORBA_Policy___VAR_CI_ + +// ************************************************************* +// Inline operations for class CORBA_Policy_var +// ************************************************************* + +ACE_INLINE +CORBA_Policy_var::CORBA_Policy_var (void) // default constructor + : ptr_ (CORBA_Policy::_nil ()) +{} + +ACE_INLINE +CORBA_Policy_var::CORBA_Policy_var (CORBA_Policy_ptr p) + : ptr_ (p) +{} + +ACE_INLINE CORBA_Policy_ptr +CORBA_Policy_var::ptr (void) const +{ + return this->ptr_; +} + +// copy constructor +ACE_INLINE +CORBA_Policy_var::CORBA_Policy_var (const CORBA_Policy_var &p) + : ptr_ (CORBA_Policy::_duplicate (p.ptr ())) +{} + +ACE_INLINE +CORBA_Policy_var::~CORBA_Policy_var (void) +{ + CORBA::release (this->ptr_); +} + +ACE_INLINE CORBA_Policy_var & +CORBA_Policy_var::operator= (CORBA_Policy_ptr p) +{ + CORBA::release (this->ptr_); + this->ptr_ = p; + return *this; +} + +ACE_INLINE CORBA_Policy_var & +CORBA_Policy_var::operator= (const CORBA_Policy_var &p) +{ + if (this != &p) + { + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Policy::_duplicate (p.ptr ()); + } + return *this; +} + +ACE_INLINE +CORBA_Policy_var::operator const CORBA_Policy_ptr &() const // cast +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_Policy_var::operator CORBA_Policy_ptr &() // cast +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr +CORBA_Policy_var::operator-> (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr +CORBA_Policy_var::in (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr & +CORBA_Policy_var::inout (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr & +CORBA_Policy_var::out (void) +{ + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Policy::_nil (); + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr +CORBA_Policy_var::_retn (void) +{ + // yield ownership of managed obj reference + CORBA_Policy_ptr val = this->ptr_; + this->ptr_ = CORBA_Policy::_nil (); + return val; +} + + +#endif /* end #if !defined */ + + +#if !defined (_CORBA_Policy___OUT_CI_) +#define _CORBA_Policy___OUT_CI_ + +// ************************************************************* +// Inline operations for class CORBA_Policy_out +// ************************************************************* + +ACE_INLINE +CORBA_Policy_out::CORBA_Policy_out (CORBA_Policy_ptr &p) + : ptr_ (p) +{ + this->ptr_ = CORBA_Policy::_nil (); +} + +ACE_INLINE +CORBA_Policy_out::CORBA_Policy_out (CORBA_Policy_var &p) // constructor from _var + : ptr_ (p.out ()) +{ + CORBA::release (this->ptr_); + this->ptr_ = CORBA_Policy::_nil (); +} + +ACE_INLINE +CORBA_Policy_out::CORBA_Policy_out (CORBA_Policy_out &p) // copy constructor + : ptr_ (p.ptr_) +{} + +ACE_INLINE CORBA_Policy_out & +CORBA_Policy_out::operator= (CORBA_Policy_out &p) +{ + this->ptr_ = p.ptr_; + return *this; +} + +ACE_INLINE CORBA_Policy_out & +CORBA_Policy_out::operator= (const CORBA_Policy_var &p) +{ + this->ptr_ = CORBA_Policy::_duplicate (p.ptr ()); + return *this; +} + +ACE_INLINE CORBA_Policy_out & +CORBA_Policy_out::operator= (CORBA_Policy_ptr p) +{ + this->ptr_ = p; + return *this; +} + +ACE_INLINE +CORBA_Policy_out::operator CORBA_Policy_ptr &() // cast +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr & +CORBA_Policy_out::ptr (void) // ptr +{ + return this->ptr_; +} + +ACE_INLINE CORBA_Policy_ptr +CORBA_Policy_out::operator-> (void) +{ + return this->ptr_; +} + + +#endif /* end #if !defined */ + +// ************************************************************* +// Inline operations for class CORBA_PolicyList_var +// ************************************************************* + +ACE_INLINE +CORBA_PolicyList_var::CORBA_PolicyList_var (void) // default constructor + : ptr_ (0) +{} + +ACE_INLINE +CORBA_PolicyList_var::CORBA_PolicyList_var (CORBA_PolicyList *p) + : ptr_ (p) +{} + +ACE_INLINE +CORBA_PolicyList_var::CORBA_PolicyList_var (const CORBA_PolicyList_var &p) // copy constructor +{ + if (p.ptr_) + this->ptr_ = new CORBA_PolicyList(*p.ptr_); + else + this->ptr_ = 0; +} + +ACE_INLINE +CORBA_PolicyList_var::~CORBA_PolicyList_var (void) // destructor +{ + delete this->ptr_; +} + +ACE_INLINE CORBA_PolicyList_var & +CORBA_PolicyList_var::operator= (CORBA_PolicyList *p) +{ + delete this->ptr_; + this->ptr_ = p; + return *this; +} + +ACE_INLINE CORBA_PolicyList_var & +CORBA_PolicyList_var::operator= (const CORBA_PolicyList_var &p) // deep copy +{ + if (this != &p) + { + delete this->ptr_; + this->ptr_ = new CORBA_PolicyList (*p.ptr_); + } + return *this; +} + +ACE_INLINE const CORBA_PolicyList * +CORBA_PolicyList_var::operator-> (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA_PolicyList * +CORBA_PolicyList_var::operator-> (void) +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_PolicyList_var::operator const CORBA_PolicyList &() const // cast +{ + return *this->ptr_; +} + +ACE_INLINE +CORBA_PolicyList_var::operator CORBA_PolicyList &() // cast +{ + return *this->ptr_; +} + +ACE_INLINE +CORBA_PolicyList_var::operator CORBA_PolicyList &() const// cast +{ + return *this->ptr_; +} + +ACE_INLINE TAO_Object_Manager <CORBA_Policy > +CORBA_PolicyList_var::operator[] (CORBA::ULong index) +{ + return this->ptr_->operator[] (index); +} + +ACE_INLINE const CORBA_PolicyList & +CORBA_PolicyList_var::in (void) const +{ + return *this->ptr_; +} + +ACE_INLINE CORBA_PolicyList & +CORBA_PolicyList_var::inout (void) +{ + return *this->ptr_; +} + +// mapping for variable size +ACE_INLINE CORBA_PolicyList *& +CORBA_PolicyList_var::out (void) +{ + delete this->ptr_; + this->ptr_ = 0; + return this->ptr_; +} + +ACE_INLINE CORBA_PolicyList * +CORBA_PolicyList_var::_retn (void) +{ + CORBA_PolicyList *tmp = this->ptr_; + this->ptr_ = 0; + return tmp; +} + +ACE_INLINE CORBA_PolicyList * +CORBA_PolicyList_var::ptr (void) const +{ + return this->ptr_; +} + +// ************************************************************* +// Inline operations for class CORBA_PolicyList_out +// ************************************************************* + +ACE_INLINE +CORBA_PolicyList_out::CORBA_PolicyList_out (CORBA_PolicyList *&p) + : ptr_ (p) +{ + this->ptr_ = 0; +} + +ACE_INLINE +CORBA_PolicyList_out::CORBA_PolicyList_out (CORBA_PolicyList_var &p) // constructor from _var + : ptr_ (p.out ()) +{ + delete this->ptr_; + this->ptr_ = 0; +} + +ACE_INLINE +CORBA_PolicyList_out::CORBA_PolicyList_out (CORBA_PolicyList_out &p) // copy constructor + : ptr_ (p.ptr_) +{} + +ACE_INLINE CORBA_PolicyList_out & +CORBA_PolicyList_out::operator= (CORBA_PolicyList_out &p) +{ + this->ptr_ = p.ptr_; + return *this; +} + +ACE_INLINE CORBA_PolicyList_out & +CORBA_PolicyList_out::operator= (CORBA_PolicyList *p) +{ + this->ptr_ = p; + return *this; +} + +ACE_INLINE +CORBA_PolicyList_out::operator CORBA_PolicyList *&() // cast +{ + return this->ptr_; +} + +ACE_INLINE CORBA_PolicyList *& +CORBA_PolicyList_out::ptr (void) // ptr +{ + return this->ptr_; +} + +ACE_INLINE CORBA_PolicyList * +CORBA_PolicyList_out::operator-> (void) +{ + return this->ptr_; +} + +ACE_INLINE TAO_Object_Manager <CORBA_Policy > +CORBA_PolicyList_out::operator[] (CORBA::ULong index) +{ + return this->ptr_->operator[] (index); +} diff --git a/TAO/tao/PolicyS.cpp b/TAO/tao/PolicyS.cpp new file mode 100644 index 00000000000..9976a0d112d --- /dev/null +++ b/TAO/tao/PolicyS.cpp @@ -0,0 +1,275 @@ +// $Id$ + +/* -*- C++ -*- */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO ORB and the TAO IDL Compiler have been developed by Washington +// University Computer Science's Distributed Object Computing Group. +// +// Information on TAO is available at +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "PolicyS.h" + +#if !defined (__ACE_INLINE__) +#include "PolicyS.i" +#endif /* !defined INLINE */ + +static const TAO_operation_db_entry CORBA_Policy_operations [] = { + {"_get_policy_type", &POA_CORBA::Policy::_get_policy_type_skel}, + {"copy", &POA_CORBA::Policy::copy_skel}, + {"destroy", &POA_CORBA::Policy::destroy_skel}, + {"_is_a", &POA_CORBA::Policy::_is_a_skel} +}; + +static const CORBA::Long _tao_CORBA_Policy_optable_size = sizeof (ACE_Hash_Map_Entry<const char *, TAO_Skeleton>) * (12); +static char _tao_CORBA_Policy_optable_pool [_tao_CORBA_Policy_optable_size]; +static ACE_Static_Allocator_Base _tao_CORBA_Policy_allocator (_tao_CORBA_Policy_optable_pool, _tao_CORBA_Policy_optable_size); +TAO_Dynamic_Hash_OpTable tao_CORBA_Policy_optable (CORBA_Policy_operations, 4, 8, &_tao_CORBA_Policy_allocator); +// skeleton constructor +POA_CORBA::Policy::Policy (void) +{ + this->optable_ = &tao_CORBA_Policy_optable; +} + +// skeleton destructor +POA_CORBA::Policy::~Policy (void) +{ +} +static const TAO_Param_Data_Skel _get_CORBA_Policy_policy_type_paramdata [] = +{ + {CORBA::_tc_PolicyType, 0, 0} +}; // CORBA_Policy_policy_type_paramdata + +static const TAO_Call_Data_Skel _get_CORBA_Policy_policy_type_calldata = +{"_get_policy_type", 1, 1, _get_CORBA_Policy_policy_type_paramdata}; + +void POA_CORBA::Policy::_get_policy_type_skel ( + CORBA::ServerRequest &_tao_server_request, + void *_tao_object_reference, + void * /* context */, + CORBA::Environment &_tao_environment +) +{ + POA_CORBA::Policy *_tao_impl = (POA_CORBA::Policy *)_tao_object_reference; + CORBA::PolicyType _tao_retval = 0; + _tao_server_request.demarshal ( + _tao_environment, + &_get_CORBA_Policy_policy_type_calldata, + &_tao_retval + ); + if (_tao_environment.exception ()) return; + _tao_retval = _tao_impl->policy_type ( + _tao_environment + ); + _tao_server_request.marshal ( + _tao_environment, + &_get_CORBA_Policy_policy_type_calldata, + &_tao_retval + ); +} + +static const TAO_Param_Data_Skel CORBA_Policy_copy_paramdata [] = +{ + {CORBA::_tc_Policy, 0, 0} +}; // CORBA_Policy_copy_paramdata + +static const TAO_Call_Data_Skel CORBA_Policy_copy_calldata = +{"copy", 1, 1, CORBA_Policy_copy_paramdata}; + +void POA_CORBA::Policy::copy_skel ( + CORBA::ServerRequest &_tao_server_request, + void *_tao_object_reference, + void * /* context */, + CORBA::Environment &_tao_environment +) +{ + POA_CORBA::Policy *_tao_impl = (POA_CORBA::Policy *)_tao_object_reference; + CORBA::Object_ptr _tao_retval = CORBA::Object::_nil (); + _tao_server_request.demarshal ( + _tao_environment, + &CORBA_Policy_copy_calldata, + &_tao_retval + ); + if (_tao_environment.exception ()) return; + _tao_retval = _tao_impl->copy ( + _tao_environment + ); + _tao_server_request.marshal ( + _tao_environment, + &CORBA_Policy_copy_calldata, + &_tao_retval + ); +} + +static const TAO_Param_Data_Skel CORBA_Policy_destroy_paramdata [] = +{ + {CORBA::_tc_void, 0, 0} +}; // CORBA_Policy_destroy_paramdata + +static const TAO_Call_Data_Skel CORBA_Policy_destroy_calldata = +{"destroy", 1, 1, CORBA_Policy_destroy_paramdata}; + +void POA_CORBA::Policy::destroy_skel ( + CORBA::ServerRequest &_tao_server_request, + void *_tao_object_reference, + void * /* context */, + CORBA::Environment &_tao_environment +) +{ + POA_CORBA::Policy *_tao_impl = (POA_CORBA::Policy *)_tao_object_reference; + _tao_server_request.demarshal ( + _tao_environment, + &CORBA_Policy_destroy_calldata, + 0 + ); + if (_tao_environment.exception ()) return; + _tao_impl->destroy ( + _tao_environment + ); + _tao_server_request.marshal ( + _tao_environment, + &CORBA_Policy_destroy_calldata, + 0 + ); +} + +static const TAO_Param_Data_Skel CORBA_Policy_is_a_paramdata [] = +{ + {CORBA::_tc_boolean, 0, 0}, + {CORBA::_tc_string, CORBA::ARG_IN, 0} +}; +static const TAO_Call_Data_Skel CORBA_Policy_is_a_calldata = +{"_is_a", 1, 2, CORBA_Policy_is_a_paramdata}; +void POA_CORBA::Policy::_is_a_skel ( + CORBA::ServerRequest &_tao_server_request, + void * _tao_object_reference, + void * /*context*/, + CORBA::Environment &_tao_environment + ) +{ + POA_CORBA::Policy_ptr _tao_impl = (POA_CORBA::Policy_ptr) _tao_object_reference; + CORBA::Boolean _tao_retval; + char *_tao_value = 0; + _tao_server_request.demarshal ( + _tao_environment, + &CORBA_Policy_is_a_calldata, + &_tao_retval, + &_tao_value + ); + if (_tao_environment.exception () != 0) return; + _tao_retval = _tao_impl->_is_a (_tao_value, _tao_environment); + _tao_server_request.marshal ( + _tao_environment, + &CORBA_Policy_is_a_calldata, + &_tao_retval, + &_tao_value + ); + CORBA::string_free (_tao_value); +} + +CORBA::Boolean POA_CORBA::Policy::_is_a ( + const char* value, + CORBA::Environment &_tao_environment + ) +{ + if ( + (!ACE_OS::strcmp ((char *)value, "IDL:CORBA/Policy:1.0")) || + (!ACE_OS::strcmp ((char *)value, CORBA::_tc_Object->id (_tao_environment)))) + return CORBA::B_TRUE; + else + return CORBA::B_FALSE; +} + +void* POA_CORBA::Policy::_downcast ( + const char* logical_type_id + ) +{ + if (ACE_OS::strcmp (logical_type_id, "IDL:CORBA/Policy:1.0") == 0) + return ACE_static_cast (POA_CORBA::Policy_ptr, this); + if (ACE_OS::strcmp (logical_type_id, "IDL:omg.org/CORBA/Object:1.0") == 0) + return ACE_static_cast(PortableServer::Servant, this); + return 0; +} + +void POA_CORBA::Policy::_dispatch (CORBA::ServerRequest &req, void *context, CORBA::Environment &env) +{ + TAO_Skeleton skel; // pointer to skeleton for operation + const char *opname = req.operation (); // retrieve operation name + // find the skeleton corresponding to this opname + if (this->_find (opname, skel) == -1) + { + env.exception (new CORBA_BAD_OPERATION (CORBA::COMPLETED_NO)); + ACE_ERROR ((LM_ERROR, "Bad operation <%s>\n", opname)); + } +else + skel (req, this, context, env); +} + +const char* POA_CORBA::Policy::_interface_repository_id (void) const +{ + return "IDL:CORBA/Policy:1.0"; +} + +POA_CORBA::_tao_collocated_Policy::_tao_collocated_Policy ( + POA_CORBA::Policy_ptr servant, + STUB_Object *stub + ) + : CORBA::Policy (stub, servant, CORBA::B_TRUE), + CORBA_Object (stub, servant, CORBA::B_TRUE), + servant_ (servant) +{ +} + +POA_CORBA::Policy_ptr POA_CORBA::_tao_collocated_Policy::_get_servant (void) const +{ + return this->servant_; +} + +CORBA::Boolean POA_CORBA::_tao_collocated_Policy::_is_a ( + const char* logical_type_id, + CORBA::Environment &_tao_environment + ) +{ + return this->servant_->_is_a ( + logical_type_id, + _tao_environment + ); +} + +CORBA::PolicyType POA_CORBA::_tao_collocated_Policy::policy_type ( + CORBA::Environment &_tao_environment + ) +{ + return this->servant_->policy_type ( + _tao_environment + ); +} + +CORBA::Policy_ptr POA_CORBA::_tao_collocated_Policy::copy ( + CORBA::Environment &_tao_environment + ) +{ + return this->servant_->copy ( + _tao_environment + ); +} + +void POA_CORBA::_tao_collocated_Policy::destroy ( + CORBA::Environment &_tao_environment + ) +{ + this->servant_->destroy ( + _tao_environment + ); +} + + +CORBA::Policy* +POA_CORBA::Policy::_this (CORBA_Environment &_env) +{ + STUB_Object *stub = this->_create_stub (_env); + if (_env.exception () != 0) + return 0; + return new POA_CORBA::_tao_collocated_Policy (this, stub); +} diff --git a/TAO/tao/PolicyS.h b/TAO/tao/PolicyS.h new file mode 100644 index 00000000000..d3fbb385bb7 --- /dev/null +++ b/TAO/tao/PolicyS.h @@ -0,0 +1,114 @@ +// $Id$ + +/* -*- C++ -*- */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO ORB and the TAO IDL Compiler have been developed by Washington +// University Computer Science's Distributed Object Computing Group. +// +// Information on TAO is available at +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#if !defined (_TAO_IDL_POLICYS_H_) +#define _TAO_IDL_POLICYS_H_ + +#include "PolicyC.h" + +class POA_CORBA +{ +public: + class Policy; + typedef Policy *Policy_ptr; + class Policy : public virtual PortableServer::ServantBase + { + protected: + Policy (void); + public: + virtual ~Policy (void); + virtual CORBA::Boolean _is_a ( + const char* logical_type_id, + CORBA::Environment &_tao_environment); + virtual void* _downcast ( + const char* logical_type_id + ); + virtual CORBA::PolicyType policy_type ( + CORBA::Environment &_tao_environment + ) = 0; + static void _get_policy_type_skel ( + CORBA::ServerRequest &_tao_req, + void *_tao_obj, + void *_tao_context, + CORBA::Environment &_tao_env + ); + + virtual CORBA::Policy_ptr copy ( + CORBA::Environment &_tao_environment + ) = 0; + static void copy_skel ( + CORBA::ServerRequest &_tao_req, + void *_tao_obj, + void *_tao_context, + CORBA::Environment &_tao_env + ); + + virtual void destroy ( + CORBA::Environment &_tao_environment + ) = 0; + static void destroy_skel ( + CORBA::ServerRequest &_tao_req, + void *_tao_obj, + void *_tao_context, + CORBA::Environment &_tao_env + ); + + static void _is_a_skel (CORBA::ServerRequest &req, void *obj, void *context, CORBA::Environment &_tao_enviroment); + + virtual void _dispatch (CORBA::ServerRequest &_tao_req, void *_tao_context, CORBA::Environment &_tao_env); + + CORBA::Policy *_this (CORBA::Environment &_tao_environment); + virtual const char* _interface_repository_id (void) const; + }; + + +#if !defined (_CORBA_POLICY___COLLOCATED_SH_) +#define _CORBA_POLICY___COLLOCATED_SH_ + + class _tao_collocated_Policy : public virtual CORBA::Policy + { + public: + _tao_collocated_Policy ( + Policy_ptr servant, + STUB_Object *stub + ); + Policy_ptr _get_servant (void) const; + virtual CORBA::Boolean _is_a ( + const char *logical_type_id, + CORBA::Environment &_tao_environment + ); + virtual CORBA::PolicyType policy_type ( + CORBA::Environment &_tao_environment + ); + virtual CORBA::Policy_ptr copy ( + CORBA::Environment &_tao_environment + ); + virtual void destroy ( + CORBA::Environment &_tao_environment + ); + + private: + Policy_ptr servant_; + }; + + +#endif /* end #if !defined */ + + +}; + + +#if defined (__ACE_INLINE__) +#include "PolicyS.i" +#endif /* defined INLINE */ + + +#endif /* if !defined */ diff --git a/TAO/tao/PolicyS.i b/TAO/tao/PolicyS.i new file mode 100644 index 00000000000..db8bcb15a54 --- /dev/null +++ b/TAO/tao/PolicyS.i @@ -0,0 +1,10 @@ +// $Id$ + +/* -*- C++ -*- */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO ORB and the TAO IDL Compiler have been developed by Washington +// University Computer Science's Distributed Object Computing Group. +// +// Information on TAO is available at +// http://www.cs.wustl.edu/~schmidt/TAO.html diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h index c821b4025d6..321cb5c23ba 100644 --- a/TAO/tao/corba.h +++ b/TAO/tao/corba.h @@ -179,6 +179,8 @@ extern CORBA::TypeCode TC_opaque; #include "tao/Server_Request.h" #include "tao/Typecode.h" +#include "tao/PolicyC.h" + // Marshaling #include "tao/Marshal.h" #include "tao/CDR.h" diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp index 60ec193d582..b35e6821e34 100644 --- a/TAO/tao/decode.cpp +++ b/TAO/tao/decode.cpp @@ -156,10 +156,6 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr, // Typecode of the element that makes the Any. CORBA::TypeCode_ptr elem_tc; - // Value maintained by the Any. - void *value = 0; - CORBA::Boolean continue_decoding = CORBA::B_TRUE; - // Context is the CDR stream. TAO_InputCDR *stream = (TAO_InputCDR *) context; @@ -168,98 +164,27 @@ TAO_Marshal_Any::decode (CORBA::TypeCode_ptr, CORBA::TypeCode::TRAVERSE_CONTINUE; // Decode the typecode description for the element. - if (stream->decode (CORBA::_tc_TypeCode, - &elem_tc, - 0, - env) == CORBA::TypeCode::TRAVERSE_CONTINUE) + if ((retval = stream->decode (CORBA::_tc_TypeCode, + &elem_tc, + 0, + env)) + == CORBA::TypeCode::TRAVERSE_CONTINUE) { - ACE_NEW_RETURN (value, - CORBA::Octet[elem_tc->size (env)], - CORBA::TypeCode::TRAVERSE_STOP); - - if (env.exception () == 0) - { - // Switch on the data type and handle the cases for - // primitives here for efficiency rather than calling. - switch (elem_tc->kind_) - { - case CORBA::tk_null: - case CORBA::tk_void: - break; - case CORBA::tk_short: - case CORBA::tk_ushort: - continue_decoding = - stream->read_short (*(CORBA::Short *) value); - break; - case CORBA::tk_long: - case CORBA::tk_ulong: - case CORBA::tk_float: - case CORBA::tk_enum: - continue_decoding = - stream->read_long (*(CORBA::Long *) value); - break; - case CORBA::tk_double: - case CORBA::tk_longlong: - case CORBA::tk_ulonglong: - continue_decoding = - stream->read_longlong (*(CORBA::LongLong *) value); - break; - case CORBA::tk_boolean: - continue_decoding = - stream->read_boolean (*(CORBA::Boolean *) value); - break; - case CORBA::tk_char: - case CORBA::tk_octet: - continue_decoding = - stream->read_char (*(CORBA::Char *) value); - break; - case CORBA::tk_longdouble: - continue_decoding = - stream->read_longdouble (*(CORBA::LongDouble *) value); - break; - case CORBA::tk_wchar: - continue_decoding = - stream->read_wchar (*(CORBA::WChar *) value); - break; - case CORBA::tk_any: - case CORBA::tk_TypeCode: - case CORBA::tk_Principal: - case CORBA::tk_objref: - case CORBA::tk_struct: - case CORBA::tk_union: - case CORBA::tk_string: - case CORBA::tk_sequence: - case CORBA::tk_array: - case CORBA::tk_alias: - case CORBA::tk_except: - case CORBA::tk_wstring: - retval = stream->decode (elem_tc, value, 0, env); - break; - default: - // Anything else is an error. - retval = CORBA::TypeCode::TRAVERSE_STOP; - } - } - else - retval = CORBA::TypeCode::TRAVERSE_STOP; + // Let the Any maintain a pointer to the CDR stream + any->value_ = (ACE_Message_Block *) stream->start (); + any->any_owns_data_ = 1; + elem_tc->AddRef (); + any->type_ = elem_tc; + // now skip the value + retval = stream->skip (elem_tc, env); } - if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE - && continue_decoding == CORBA::B_TRUE) - { - // Allocate an Any and populate it with the value and - // typecode. This eventually appears as "data" - (void) new (any) CORBA::Any (elem_tc, value, CORBA::B_TRUE); - return CORBA::TypeCode::TRAVERSE_CONTINUE; - } - else + if (retval != CORBA::TypeCode::TRAVERSE_CONTINUE) { - // Free the allocated storage and release the typecode. - delete [] value; CORBA::release (elem_tc); env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); dmsg ("TAO_Marshal_Any::decode detected error"); - return CORBA::TypeCode::TRAVERSE_STOP; } + return retval; } CORBA::TypeCode::traverse_status diff --git a/TAO/tao/skip.cpp b/TAO/tao/skip.cpp new file mode 100644 index 00000000000..7bd33e93642 --- /dev/null +++ b/TAO/tao/skip.cpp @@ -0,0 +1,751 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// skip.cpp +// +// = DESCRIPTION +// Code for skipping different data types +// +// Data types encoded as CDR streams need to be skipped when they are part of +// an Any. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "tao/corba.h" + +CORBA::TypeCode::traverse_status +TAO_Marshal_Primitive::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + TAO_InputCDR *stream = (TAO_InputCDR *) context; + // status of skip operation + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + + switch (tc->kind_) + { + case CORBA::tk_null: + case CORBA::tk_void: + break; + case CORBA::tk_short: + case CORBA::tk_ushort: + continue_decoding = stream->skip_short (); + break; + case CORBA::tk_long: + case CORBA::tk_ulong: + case CORBA::tk_float: + case CORBA::tk_enum: + continue_decoding = stream->skip_long (); + break; + case CORBA::tk_double: + case CORBA::tk_longlong: + case CORBA::tk_ulonglong: + continue_decoding = stream->skip_longlong (); + break; + case CORBA::tk_boolean: + continue_decoding = stream->skip_boolean (); + break; + case CORBA::tk_char: + case CORBA::tk_octet: + continue_decoding = stream->skip_char (); + break; + case CORBA::tk_longdouble: + continue_decoding = stream->skip_longdouble (); + break; + case CORBA::tk_wchar: + continue_decoding = stream->skip_wchar (); + break; + default: + retval = CORBA::TypeCode::TRAVERSE_STOP; + // we are not a primitive type + } + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE + && continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_Primitive::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +CORBA::TypeCode::traverse_status +TAO_Marshal_Any::skip (CORBA::TypeCode_ptr, + void *context, + CORBA::Environment &env) +{ + // Typecode of the element that makes the Any. + CORBA::TypeCode_ptr elem_tc; + + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + // Status of encode operation. + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + + // first retrieve the TypeCode for the element so that we can skip the value + // based on this typecode + if (stream->decode (CORBA::_tc_TypeCode, + &elem_tc, + 0, + env) == CORBA::TypeCode::TRAVERSE_CONTINUE) + { + if (env.exception () == 0) + retval = stream->skip (elem_tc, env); + else + retval = CORBA::TypeCode::TRAVERSE_STOP; + } + return retval; +} + +CORBA::TypeCode::traverse_status +TAO_Marshal_TypeCode::skip (CORBA::TypeCode_ptr, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + // Typecode to be decoded. + CORBA::TypeCode_ptr *tcp; + + // Typecode kind. + CORBA::ULong kind; + + // Decode the "kind" field of the typecode from the stream + continue_decoding = stream->read_ulong (kind); + + if (continue_decoding == CORBA::B_TRUE) + { + // Typecodes with empty parameter lists all have preallocated + // constants. We use those to reduce memory consumption and + // heap access ... also, to speed things up! + if ((kind < CORBA::TC_KIND_COUNT) || + (kind == ~(CORBA::ULong)0)) + { + // Either a non-constant typecode or an indirected typecode. + switch (kind) + { + // Need special handling for all kinds of typecodes that + // have nonempty parameter lists ... + default: + // simple typecodes, nothing to do + break; + case CORBA::tk_string: + case CORBA::tk_wstring: + { + // skip the bounds + continue_decoding = stream->skip_ulong (); + } + break; + + // Indirected typecodes, illegal at "top level". + case ~0: + { + // skip the long indicating the encapsulation offset, + continue_decoding = stream->skip_long (); + } + break; + + // The rest have "complex" parameter lists that are + // encoded as bulk octets ... + case CORBA::tk_objref: + case CORBA::tk_struct: + case CORBA::tk_union: + case CORBA::tk_enum: + case CORBA::tk_sequence: + case CORBA::tk_array: + case CORBA::tk_alias: + case CORBA::tk_except: + { + CORBA::ULong length; + + // get the encapsulation length + continue_decoding = stream->read_ulong (length); + if (!continue_decoding) + break; + // skip the encapsulation + continue_decoding = stream->skip_bytes (length); + } + } // end of switch + } + else // bad kind_ value to be decoded + { + env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO)); + dmsg ("TAO_Marshal_TypeCode: Bad kind_ value in CDR stream"); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + + if (continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_TypeCode::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// Encode Principal. + +CORBA::TypeCode::traverse_status +TAO_Marshal_Principal::skip (CORBA::TypeCode_ptr, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + // specifies the number of bytes in the Principal + CORBA::ULong len; + + continue_decoding = stream->read_ulong (len); + if (len > 0 && continue_decoding) + { + continue_decoding = stream->skip_bytes (len); + } + + if (continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_Principal::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +CORBA::TypeCode::traverse_status +TAO_Marshal_ObjRef::skip (CORBA::TypeCode_ptr, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + // return status + CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE; + + // First, skip the type hint. This will be the type_id encoded in an + // object reference. + stream->skip_string (); + + // Read the profiles, discarding all until an IIOP profile comes by. + // Once we see an IIOP profile, ignore any further ones. + // + // XXX this will need to change someday to let different protocol + // code be accessed, not just IIOP. Protocol modules will be + // dynamically loaded from shared libraries via ORB_init (), and we + // just need to be able to access such preloaded libraries here as + // we unmarshal objrefs. + CORBA::ULong profiles = 0; + + // get the count of profiles that follow + continue_decoding = stream->read_ulong (profiles); + + while (profiles-- != 0 && continue_decoding) + { + CORBA::ULong tag; + + // get the profile ID tag + if ( (continue_decoding = stream->read_ulong (tag)) == CORBA::B_FALSE) + continue; + + if (tag != TAO_IOP_TAG_INTERNET_IOP) + { + continue_decoding = stream->skip_string (); + continue; + } + + // OK, we've got an IIOP profile. It's going to be + // encapsulated ProfileData. Create a new decoding stream and + // context for it, and tell the "parent" stream that this data + // isn't part of it any more. + + CORBA::ULong encap_len; + // ProfileData is encoded as a sequence of octet. So first get + // the length of the sequence. + // Create the decoding stream from the encapsulation in the + // buffer, and skip the encapsulation. + if ( (continue_decoding = stream->read_ulong (encap_len)) == CORBA::B_FALSE) + continue; + + TAO_InputCDR str (*stream, encap_len); + + continue_decoding = + str.good_bit () + && stream->skip_bytes (encap_len); + + if (!continue_decoding) + continue; + + // Read and verify major, minor versions, ignoring IIOP + // profiles whose versions we don't understand. + // + // XXX this doesn't actually go back and skip the whole + // encapsulation... + if (!(str.skip_octet () + && str.skip_octet ())) + continue; + + // skip host and port + if (!str.skip_string () + || !str.skip_ushort ()) + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("error decoding IIOP host/port"); + return CORBA::TypeCode::TRAVERSE_STOP; + } + + // ... and object key. + if (str.skip (&TC_opaque, + env) != CORBA::TypeCode::TRAVERSE_CONTINUE) + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE + && continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + ACE_DEBUG ((LM_DEBUG, "marshaling decode_objref detected error")); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// Decode structs. +CORBA::TypeCode::traverse_status +TAO_Marshal_Struct::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + TAO_InputCDR *stream = (TAO_InputCDR *) context; + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + CORBA::TypeCode_ptr param; + + // Number of fields in the struct. + int member_count = tc->member_count (env); + + if (env.exception () == 0) + for (int i = 0; i < member_count + && retval == CORBA::TypeCode::TRAVERSE_CONTINUE; + i++) + { + param = tc->member_type (i, env); + if (env.exception () == 0) + { + retval = stream->skip (param, env); + } + else + return CORBA::TypeCode::TRAVERSE_STOP; + } + else + return CORBA::TypeCode::TRAVERSE_STOP; + + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("marshaling encode_struct detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// Encode unions. +CORBA::TypeCode::traverse_status +TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + + CORBA::TypeCode_ptr discrim_tc; + CORBA::TypeCode_ptr member_tc; + CORBA::Any_ptr member_label; + CORBA::Long discrim_val; + CORBA::ULong member_count; + CORBA::Long default_index; + CORBA::ULong i; + CORBA::TypeCode_ptr default_tc = 0; + CORBA::Boolean discrim_matched = CORBA::B_FALSE; + + // get the discriminator type which will enable us to skip the discriminator + // value + discrim_tc = tc->discriminator_type (env); + + if (env.exception () == 0) + { + // decode the discriminator value + retval = stream->decode (discrim_tc, &discrim_val, 0, env); + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) + { + // now get ready to skip the actual union value + default_index = tc->default_index (env); + + if (env.exception () == 0) + { + member_count = tc->member_count (env); + if (env.exception () == 0) + { + // check which label value matches with the discriminator + // value. Accordingly, marshal the corresponding + // member_type. If none match, check if default exists + // and marshal accordingly. Otherwise it is an error. + + for (i = 0; i < member_count; i++) + { + member_label = tc->member_label (i, env); + if (env.exception () == 0) + { + // do the matching + switch (member_label->type ()->kind (env)) + { + case CORBA::tk_short: + case CORBA::tk_ushort: + if (*(CORBA::Short *) member_label->value () == + *(CORBA::Short *) discrim_val) + discrim_matched = CORBA::B_TRUE; + break; + case CORBA::tk_long: + case CORBA::tk_ulong: + case CORBA::tk_enum: + if (*(CORBA::ULong *) member_label->value () == + *(CORBA::ULong *) discrim_val) + discrim_matched = CORBA::B_TRUE; + break; + case CORBA::tk_char: + if (*(CORBA::Char *) member_label->value () == + *(CORBA::Char *) discrim_val) + discrim_matched = CORBA::B_TRUE; + break; + case CORBA::tk_wchar: + if (*(CORBA::WChar *) member_label->value () == + *(CORBA::WChar *) discrim_val) + discrim_matched = CORBA::B_TRUE; + break; + case CORBA::tk_boolean: + if (*(CORBA::Boolean *) member_label->value () == + *(CORBA::Boolean *) discrim_val) + discrim_matched = CORBA::B_TRUE; + break; + default: + env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO)); + return CORBA::TypeCode::TRAVERSE_STOP; + }// end of switch + + // get the member typecode + member_tc = tc->member_type (i, env); + if (env.exception () == 0) + { + if (default_index >= 0 && default_index-- == 0) + // have we reached the default label?, if so, + // save a handle to the typecode for the default + default_tc = member_tc; + if (discrim_matched) + // marshal according to the matched typecode + return stream->skip (member_tc, env); + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } // end of for loop + // we are here only if there was no match + if (default_tc) + return stream->skip (default_tc, env); + else + return CORBA::TypeCode::TRAVERSE_CONTINUE; + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// decode string +CORBA::TypeCode::traverse_status +TAO_Marshal_String::skip (CORBA::TypeCode_ptr, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + + // On decode, omit the check against specified string bounds, and + // cope with illegal "zero length" strings (all lengths on the wire + // must include a NUL). + // + // This is on the principle of being gracious in what we accept; we + // don't generate messages that fail to comply with protocol specs, + // but we will accept them when it's clear how to do so. + + continue_decoding = stream->skip_string (); + if (continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_TypeCode::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// Decode sequence. + +CORBA::TypeCode::traverse_status +TAO_Marshal_Sequence::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + TAO_InputCDR *stream = (TAO_InputCDR *) context; + // Return status. + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + // Typecode of the element. + CORBA::TypeCode_ptr tc2; + // Size of element. + CORBA::ULong bounds; + + // First unmarshal the sequence length ... we trust it to be right + // here, on the "be gracious in what you accept" principle. We + // don't generate illegal sequences (i.e. length > bounds). + + continue_decoding = stream->read_ulong (bounds); + + if (continue_decoding) + { + // No point decoding an empty sequence. + if (bounds > 0) + { + // Get element typecode. + tc2 = tc->content_type (env); + + if (env.exception () == 0) + { + while (bounds-- && continue_decoding == CORBA::B_TRUE) + { + continue_decoding = stream->skip (tc2, env); + } + } // no exception computing content type + } // length is > 0 + else + return CORBA::TypeCode::TRAVERSE_CONTINUE; + } + // error exit + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_NO)); + dmsg ("marshaling TAO_Marshal_Sequence::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; +} + +// Decode array. + +CORBA::TypeCode::traverse_status +TAO_Marshal_Array::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + // Return status. + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + + // Typecode of the element. + CORBA::TypeCode_ptr tc2; + + CORBA::ULong bounds; + + // retrieve the bounds of the array + bounds = tc->length (env); + if (env.exception () == 0) + { + // get element typecode + tc2 = tc->content_type (env); + if (env.exception () == 0) + { + while (bounds-- && continue_decoding == CORBA::B_TRUE) + { + continue_decoding = stream->skip (tc2, env); + } + } // no exception computing content type + } // no exception computing bounds + // error exit + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_NO)); + dmsg ("marshaling TAO_Marshal_Sequence::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; +} + +// Decode alias. +CORBA::TypeCode::traverse_status +TAO_Marshal_Alias::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + // Typecode of the aliased type. + CORBA::TypeCode_ptr tc2; + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + + // Context is the CDR stream. + TAO_InputCDR *stream = (TAO_InputCDR *) context; + + // Status of decode operation. + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + + tc2 = tc->content_type (env); + if (env.exception () == 0) + { + retval = stream->skip (tc2, env); + } + // tc2->Release (); + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE + && continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_Alias::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// Decode exception For exceptions, the "hidden" type ID near the +// front of the on-wire representation was previously unmarshaled and +// mapped to the "tc" typcode we're using to traverse the memory ... +// at the same time its vtable, refcount, and other state was +// established. +// +// NOTE: This is asymmetric with respect to encoding exceptions. +CORBA::TypeCode::traverse_status +TAO_Marshal_Except::skip (CORBA::TypeCode_ptr tc, + void *context, + CORBA::Environment &env) +{ + TAO_InputCDR *stream = (TAO_InputCDR *) context; + CORBA::TypeCode::traverse_status retval = + CORBA::TypeCode::TRAVERSE_CONTINUE; + CORBA::TypeCode_ptr param; + + // Number of fields in the exception + int member_count = tc->member_count (env); + if (env.exception () == 0) + { + for (int i = 0; i < member_count + && retval == CORBA::TypeCode::TRAVERSE_CONTINUE; + i++) + { + param = tc->member_type (i, env); + if (env.exception () == 0) + { + retval = stream->skip (param, env); + } + else + return CORBA::TypeCode::TRAVERSE_STOP; + } + } + else + return CORBA::TypeCode::TRAVERSE_STOP; + + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_Except detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} + +// decode wstring +CORBA::TypeCode::traverse_status +TAO_Marshal_WString::skip (CORBA::TypeCode_ptr, + void *context, + CORBA::Environment &env) +{ + CORBA::Boolean continue_decoding = CORBA::B_TRUE; + TAO_InputCDR *stream = (TAO_InputCDR *) context; + CORBA::ULong len; + + // On decode, omit the check against specified wstring bounds, and + // cope with illegal "zero length" strings (all lengths on the wire + // must include a NUL). + // + // This is on the principle of being gracious in what we accept; we + // don't generate messages that fail to comply with protocol specs, + // but we will accept them when it's clear how to do so. + + continue_decoding = stream->read_ulong (len); + + if (len != 0) + while (continue_decoding != CORBA::B_FALSE && len--) + { + continue_decoding = stream->skip_wchar (); + } + + if (continue_decoding == CORBA::B_TRUE) + return CORBA::TypeCode::TRAVERSE_CONTINUE; + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + dmsg ("TAO_Marshal_TypeCode::skip detected error"); + return CORBA::TypeCode::TRAVERSE_STOP; + } +} |