diff options
author | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-05-17 13:42:03 +0000 |
---|---|---|
committer | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-05-17 13:42:03 +0000 |
commit | 9c5ededb46e910392b60f66ad52feee13030687b (patch) | |
tree | 1597696f10b6f24049db12b71264c5c07e61d772 | |
parent | 84316c4a5916ab2610aaab0ad9cc8e2cbe0af5e8 (diff) | |
download | ATCD-9c5ededb46e910392b60f66ad52feee13030687b.tar.gz |
Fri May 17 13:40:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com> Fix for Buzilla 1391
33 files changed, 680 insertions, 325 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index a3e2e0aeef6..6b794b98b6b 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,50 @@ +Fri May 17 13:40:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com> + + * NEWS: + * TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp: + * TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp: + * TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp: + * TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp: + * TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h: + * tao/Valuetype/ValueBase.cpp: + * tao/Valuetype/ValueBase.h: + + Fix for Buzilla 1391. Valuetypes now generate a _copy_value() + method where appliciable. This is now treated as a pure + virtual function (as per the CORBA spec). Build TAO with + #define TAO_VALUETYPE_COPY_VALUE_IS_NOT_PURE in effect to + return to the previous "not required" behaviour. + + * tao/ObjRefTemplate/ObjectReferenceTemplate_i.h: + * tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp: + * tao/DynamicInterface/AMH_DSI_Response_Handler.cpp: + * tao/DynamicInterface/AMH_DSI_Response_Handler.h: + * orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h: + * orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp: + * DevGuideExamples/ValueTypes/Messenger/Message_i.h: + * DevGuideExamples/ValueTypes/Messenger/Message_i.cpp: + * DevGuideExamples/ValueTypes/Bank/client.cpp: + * DevGuideExamples/ValueTypes/Bank/server.cpp: + * tests/OBV/Forward/TreeController.idl: + * tests/OBV/Truncatable/client.cpp: + * tests/OBV/Indirection/Factory.cpp: + * tests/OBV/Collocated/Forward/TreeController.idl: + * tests/ORT/ObjectReferenceFactory.cpp: + * tests/ORT/ObjectReferenceFactory.h: + * tests/Bug_2791_Regression/Message_i.h: + * tests/Bug_2791_Regression/Message_i.cpp: + * examples/OBV/Typed_Events/Event_Types_impl.cpp: + * examples/OBV/Typed_Events/Event_Types_impl.h: + * orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h: + * orbsvcs/examples/ORT/Gateway_ObjRef_Factory.cpp: + * orbsvcs/examples/ORT/Gateway_ObjRef_Factory.h: + + Add _copy_value() implimentation where necessary in the examples + and ensure all Valuetypes are HEAP allocated, (as all valuetypes + are reference counted, they are required to be deletable, not + STACK based). + Fri May 17 10:11:00 UTC 2013 Simon Massey <simon dot massey at prismtech dot com> * orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Connection_Handler.cpp: diff --git a/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp b/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp index b4f91848e8b..22345636352 100644 --- a/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp +++ b/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp @@ -49,6 +49,21 @@ public: name(n); balance(bal); } + + ::CORBA::ValueBase *_copy_value () + { + ::CORBA::ValueBase *ret_val = 0; + ACE_NEW_THROW_EX ( + ret_val, + Person_i ( + name (), + balance () + ), + ::CORBA::NO_MEMORY () + ); + return ret_val; + } + private: void debit(CORBA::Long) { diff --git a/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp b/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp index 5eb0169c880..ca6f1e731a7 100644 --- a/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp +++ b/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp @@ -44,6 +44,17 @@ class Person_i , public virtual CORBA::DefaultValueRefCountBase { public: + ::CORBA::ValueBase *_copy_value () + { + ::CORBA::ValueBase *ret_val = 0; + ACE_NEW_THROW_EX ( + ret_val, + Person_i (), + ::CORBA::NO_MEMORY () + ); + return ret_val; + } + void debit(CORBA::Long amt) { CORBA::Long tmp = balance(); diff --git a/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp b/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp index 35529dbf768..40cfdd6bfbb 100644 --- a/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp +++ b/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp @@ -17,6 +17,15 @@ MessageImpl::~MessageImpl() } MessageImpl::MessageImpl +(Message::AddrList &address, + const char* user, + const char* subject, + const char* txt + ) : OBV_Message(address, user, subject, txt) +{ +} + +MessageImpl::MessageImpl (const char* address, const char* user, const char* subject, @@ -26,6 +35,23 @@ MessageImpl::MessageImpl addAddress(address); } +::CORBA::ValueBase * +MessageImpl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + ACE_NEW_THROW_EX ( + ret_val, + MessageImpl ( + addrs_ (), + user (), + subject (), + text () + ), + ::CORBA::NO_MEMORY () + ); + return ret_val; +} + Message::AddrList* MessageImpl::getAddresses() { return new AddrList(addrs_()); } @@ -59,7 +85,6 @@ void MessageImpl::text(const char* s) { } void MessageImpl::print() { - std::cout << "Message from : " << user_() << std::endl; AddrList& addrs = addrs_(); @@ -91,5 +116,3 @@ MessageFactory::create_for_unmarshal() { return new MessageImpl; } - - diff --git a/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.h b/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.h index f4dac3f034d..704482c22d8 100644 --- a/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.h +++ b/TAO/DevGuideExamples/ValueTypes/Messenger/Message_i.h @@ -20,6 +20,15 @@ public: const char* txt ); + MessageImpl( + ::Message::AddrList &address, + const char* user, + const char* subject, + const char* txt + ); + + virtual ::CORBA::ValueBase *_copy_value (void); + virtual ::Message::AddrList* getAddresses(); virtual void addAddress(const char*); @@ -33,6 +42,7 @@ public: virtual void text(const char*); virtual void print(); + protected: virtual ~MessageImpl(); }; @@ -42,6 +52,7 @@ class MessageFactory { public: static void register_new_factory(CORBA::ORB& orb); + private: virtual CORBA::ValueBase* create_for_unmarshal(); }; @@ -8,6 +8,48 @@ USER VISIBLE CHANGES BETWEEN TAO-2.1.8 and TAO-2.1.9 Repository Locator has been reimplemented using AMI/AMH to avoid the problem of nested upcalls under heavy load. +. Added the new -ORBListenerInterface UIPMC option to provide detailed control + over which IP interfaces are to be listened on for which mutlicast addresses. + This works in a similar way to the existing -ORBPreferredInterfaces + ORB_init command line option but for UDP server listeners instead of client + senders. See the TAO_UIPMC_Protocol_Factory section in the + docs/release/TAO/Options.html document for details. This option allows + UIPMC/MIOP to control which interfaces are used by the server to listen + for broadcast messages instead of only using the "default" interface. + + If TAO is built with the #define TAO_ALLOW_UNICAST_MIOP in effect, the + normal error checking on joins is short circuited, such that MIOP can + be used to send to a unicast address instead of a broadcast group. In general + I would not recommend building TAO with this option set, end users should + concider using the DIOP protocol instead. + +. Fix for long standing Valuetype non-conformance (Bugzilla_1391): + + tao_idl generated ValueType OBV_* classes now also provide a + _copy_value() method where this class is supposed to be the final + "most derived" class. It is still left to the end user to provide + such a method in their own most derived class when this is not + the case (as only the final implimentation of the Valuetype will + know how this duplication is performed). + + TAO can be built specifically to treat _copy_value() as a pure virtual + function (as per the standard, and now the default behaviour) or, + if #define TAO_VALUETYPE_COPY_VALUE_IS_NOT_PURE is defined during the + building of TAO, a non-pure virtual function (in which TAO does not + require an implimentation to provide the _copy_value() function as per + the previous TAO implimentations). + + TAO doesn't normally use the _copy_value() fuction itself, but if + #define TAO_VALUETYPE_COPYING_ANY_INSERTION_USES_COPY_VALUE + is in effect during the build, valuetypes "copy" inserted into an any + will call _copy_value() instead of increasing the reference count of the + actual valuetype being "copied". In such cases obviosuly the _copy_value() + method is required to be implemented. There are problems taking this + general approach however, as the automatically generated _copy_value() is + not capable of duplicating cyclic graphs held in valuetypes, which + realistially require the reference counting insertions to be utalised + and/or knowledge of the actual use of the valuetype itself. This setting + is not recommended. USER VISIBLE CHANGES BETWEEN TAO-2.1.7 and TAO-2.1.8 ==================================================== diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp index 2f5510ca27b..bf1741629ae 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp @@ -99,8 +99,16 @@ be_visitor_valuetype_any_op_cs::visit_valuetype (be_valuetype *node) << node->local_name () << " *_tao_elem" << be_uidt_nl << ")" << be_uidt_nl << "{" << be_idt_nl + << "#ifdef TAO_VALUETYPE_COPYING_ANY_INSERTION_USES_COPY_VALUE" << be_idt_nl + << node->local_name () << " *_tao_copy =" << be_idt_nl + << "_tao_elem ?" << be_idt_nl + << node->local_name () << "::_downcast (_tao_elem->_copy_value ())" << be_nl + << ": 0;" << be_uidt << be_uidt_nl + << "_tao_any <<= &_tao_copy;" << be_uidt_nl + << "#else" << be_idt_nl << "::CORBA::add_ref (_tao_elem);" << be_nl << "_tao_any <<= &_tao_elem;" << be_uidt_nl + << "#endif" << be_uidt_nl << "}" << be_nl_2; *os << "// Non-copying insertion." << be_nl @@ -151,8 +159,16 @@ be_visitor_valuetype_any_op_cs::visit_valuetype (be_valuetype *node) << node->full_name () << " *_tao_elem" << be_uidt_nl << ")" << be_uidt_nl << "{" << be_idt_nl + << "#ifdef TAO_VALUETYPE_COPYING_ANY_INSERTION_USES_COPY_VALUE" << be_idt_nl + << node->full_name () << " *_tao_copy =" << be_idt_nl + << "_tao_elem ?" << be_idt_nl + << node->full_name () << "::_downcast (_tao_elem->_copy_value ())" << be_nl + << ": 0;" << be_uidt << be_uidt_nl + << "_tao_any <<= &_tao_copy;" << be_uidt_nl + << "#else" << be_idt_nl << "::CORBA::add_ref (_tao_elem);" << be_nl << "_tao_any <<= &_tao_elem;" << be_uidt_nl + << "#endif" << be_uidt_nl << "}" << be_nl_2; *os << "// Non-copying insertion." << be_nl @@ -203,4 +219,3 @@ be_visitor_valuetype_any_op_cs::visit_eventtype (be_eventtype *node) { return this->visit_valuetype (node); } - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp index ade75a3d827..c2214fe3152 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp @@ -174,12 +174,13 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) if (is_an_amh_exception_holder) { - // Generate the constructor and destructor. + // Generate the constructor and destructor and _copy_value. *os << be_nl_2 << node->local_name () << " ( ::CORBA::Exception *ex)" << be_idt_nl << ": exception (ex)" << be_uidt_nl << "{}" << be_nl_2 - << "virtual ~" << node->local_name () << " (void);"; + << "virtual ~" << node->local_name () << " (void);" << be_nl + << "virtual ::CORBA::ValueBase *_copy_value (void);"; } *os << be_nl_2 diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp index 550795007de..cb36b372b20 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp @@ -244,6 +244,19 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) // g++ >= 4.0 RTTI support when the // "-fvisibility-inlines-hidden" command line option is used. + // The virtual _copy_value method. + *os << "::CORBA::ValueBase *" << be_nl + << node->name () << "::_copy_value (void)" << be_nl + << "{" << be_idt_nl + << "::CORBA::ValueBase *ret_val = 0;" << be_nl + << "ACE_NEW_THROW_EX (" << be_idt_nl + << "ret_val," << be_nl + << node->local_name () << " ()," << be_nl + << "::CORBA::NO_MEMORY ()" << be_uidt_nl + << ");" << be_nl + << "return ret_val;" << be_uidt_nl + << "}" << be_nl_2; + // The virtual _tao_marshal_v method. *os << "::CORBA::Boolean" << be_nl << node->name () << "::_tao_marshal_v (TAO_OutputCDR &) const" diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp index 85acd5721f8..453b1f24afc 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp @@ -33,7 +33,6 @@ be_visitor_valuetype_obv_ch::~be_visitor_valuetype_obv_ch (void) { } - // OBV_ class must be in OBV_ namespace. int be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) @@ -64,7 +63,7 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) else { *os << be_nl_2 << "// OBV_ class" << be_nl; - *os << "class " << be_global->stub_export_macro() << " ";; + *os << "class " << be_global->stub_export_macro() << " "; if (!node->is_nested()) { @@ -195,14 +194,25 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) // Virtual destructor. *os << be_nl << "virtual ~"; - if (! node->is_nested ()) { *os << "OBV_"; } - *os << node->local_name () << " (void);"; + // Virtual _copy_value() only provided in OBV_* class when + // ::CORBA::DefaultValueRefCountBase has been included. + // The OBV_ class is concrete in this case and so requires + // a _copy_value definition. + // Otherwise, the end user derives from this abstract + // OBV_* class and it is up to them to provide the correct + // implimentation of the _copy_value() there. + if (this->obv_need_ref_counter (node)) + { + *os << be_uidt_nl << be_nl << "public:" << be_idt_nl + << "virtual ::CORBA::ValueBase *_copy_value (void);"; + } + // Map fields to private data. if (!node->opt_accessor ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp index bf9fb016a7e..eb13c32afa5 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp @@ -1,5 +1,3 @@ - - //============================================================================= /** * @file valuetype_obv_cs.cpp @@ -33,7 +31,6 @@ be_visitor_valuetype_obv_cs::~be_visitor_valuetype_obv_cs (void) { } - // OBV_ class must be in OBV_ namespace int be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) @@ -88,15 +85,47 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) // Destructor. *os << node->full_obv_skel_name () << "::~"; - if (! node->is_nested ()) { *os << "OBV_"; } - *os << node->local_name () << " (void)" << be_nl << "{}"; + // Virtual _copy_value() only provided in OBV_* class when + // ::CORBA::DefaultValueRefCountBase has been included. + // The OBV_ class is concrete in this case and so requires + // a _copy_value definition. + // Otherwise, the end user must derive from this abstract + // OBV_* class and it is up to them to provide the correct + // implimentation of the _copy_value() there. + if (this->obv_need_ref_counter (node)) + { + *os << be_nl_2 + << "::CORBA::ValueBase *" << be_nl + << node->full_obv_skel_name () << "::_copy_value (void)" << be_nl + << "{" << be_idt_nl + << "::CORBA::ValueBase *ret_val = 0;" << be_nl + << "ACE_NEW_THROW_EX (" << be_idt_nl + << "ret_val," << be_nl; + if (! node->is_nested ()) + { + *os << "OBV_"; + } + *os << node->local_name () << " ("; + if (node->has_member ()) + { + unsigned long index = 0ul; + *os << be_idt; + gen_obv_call_base_constructor_args (node, index); + *os << be_uidt_nl; + } + *os << ")," << be_nl + << "::CORBA::NO_MEMORY ()" << be_uidt_nl + << ");" << be_nl + << "return ret_val;" << be_uidt_nl + << "}"; + } // OBV_ class has no accessors or modifiers if we are optimizing // or the valuetype is abstract. @@ -250,3 +279,54 @@ be_visitor_valuetype_obv_cs::gen_obv_init_constructor_inits ( << ");"; } } + +void +be_visitor_valuetype_obv_cs::gen_obv_call_base_constructor_args ( + be_valuetype *node, + unsigned long &index + ) +{ + TAO_OutStream *os = this->ctx_->stream (); + + // Generate for inherited members first. + AST_Type *parent = node->inherits_concrete (); + if (parent != 0) + { + be_valuetype *be_parent = + be_valuetype::narrow_from_decl (parent); + this->gen_obv_call_base_constructor_args (be_parent, index); + } + + // Now generate for each "derived" added members + for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); + !si.is_done (); + si.next()) + { + // be_attribute inherits from be_field + // so we have to also screen out attributes + be_field *f = be_field::narrow_from_decl (si.item ()); + if (f && !be_attribute::narrow_from_decl (si.item ())) + { + if (index++) // comma before 2nd onwards + *os << ","; + + // output each accessor on new line + *os << be_nl; + + // Check the member type for nested valuetypes + be_type *t = be_type::narrow_from_decl (f->field_type ()); + if (be_valuetype_fwd::narrow_from_decl (t) || + be_valuetype::narrow_from_decl (t) || + be_valuebox::narrow_from_decl (t) ) + { + // Nested valuetypes/boxes need to be deep copied also + *os << "(" << f->local_name () << " () ?" << be_idt_nl + << t->full_name () << "::_downcast (" << f->local_name () + << " ()->_copy_value ())" << be_nl + << ": 0)" << be_uidt; + } + else // Simple non-nested type + *os << f->local_name () << " ()"; + } + } +} diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h index 0ebfb1a088f..3b2bc32c25e 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_obv_cs.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VALUETYPE_VALUETYPE_OBV_CS_H_ #define _BE_VALUETYPE_VALUETYPE_OBV_CS_H_ @@ -47,7 +46,11 @@ private: /// Called by method above to generate base class constructor call. void gen_obv_init_base_constructor_args (be_valuetype *node, unsigned long &index); + + /// Called to generate the initalizing constructor call for the + /// generated _copy_value method. + void gen_obv_call_base_constructor_args (be_valuetype *node, + unsigned long &index); }; #endif /* _BE_VALUETYPE_VALUETYPE_OBV_CS_H_ */ - diff --git a/TAO/examples/OBV/Typed_Events/Event_Types_impl.cpp b/TAO/examples/OBV/Typed_Events/Event_Types_impl.cpp index 60ab9e7e57f..89beb8bc74f 100644 --- a/TAO/examples/OBV/Typed_Events/Event_Types_impl.cpp +++ b/TAO/examples/OBV/Typed_Events/Event_Types_impl.cpp @@ -18,6 +18,14 @@ Event_impl::~Event_impl () { } +::CORBA::ValueBase * +Event_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + void Event_impl::do_print (void) { @@ -26,7 +34,6 @@ Event_impl::do_print (void) (CORBA::ULong) this->origin_id_() )); } - /* Not defined, see header Event_factory::~Event_factory () { @@ -54,6 +61,14 @@ Temperature_impl::~Temperature_impl () { } +::CORBA::ValueBase * +Temperature_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + void Temperature_impl::do_print (void) { @@ -73,7 +88,6 @@ Temperature_factory::create_for_unmarshal (void) return new Temperature_impl; } - // Position implementation ====================================== Position_impl::Position_impl () @@ -90,6 +104,14 @@ Position_impl::~Position_impl () { } +::CORBA::ValueBase * +Position_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + void Position_impl::do_print (void) { @@ -136,7 +158,6 @@ void Position_impl::z (CORBA::Float z) this->xyz()[2] = z; } - Position_factory::~Position_factory () { } @@ -147,7 +168,6 @@ Position_factory::create_for_unmarshal (void) return new Position_impl; } - // Log_Msg implementation =================================== Log_Msg_impl::Log_Msg_impl () @@ -164,6 +184,14 @@ Log_Msg_impl::~Log_Msg_impl () { } +::CORBA::ValueBase * +Log_Msg_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + void Log_Msg_impl::do_print (void) { @@ -190,8 +218,6 @@ Log_Msg_factory::create_for_unmarshal (void) return new Log_Msg_impl; } - - // Event_List_Link implementation =================================== Event_List_Link_impl::Event_List_Link_impl () @@ -215,6 +241,14 @@ Event_List_Link_impl::~Event_List_Link_impl () // the held event resp. the next links. } +::CORBA::ValueBase * +Event_List_Link_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + Event* Event_List_Link_impl::get_event (void) { @@ -243,7 +277,6 @@ Event_List_Link_factory::create_for_unmarshal (void) return new Event_List_Link_impl; } - // Event_List implementation =================================== Event_List_impl::Event_List_impl (void) @@ -257,6 +290,14 @@ Event_List_impl::~Event_List_impl (void) // Destructor does nothing explicit, because the _var types do care. } +::CORBA::ValueBase * +Event_List_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + void Event_List_impl::store_event (Event* e) { @@ -275,7 +316,6 @@ Event_List_impl::store_event (Event* e) // From pointer to _var the reference count of the pointed to never // increased, but the modifier does. - if (this->last_link_cache_ == 0) { // Search the end. @@ -287,7 +327,6 @@ Event_List_impl::store_event (Event* e) } } - // If still null then the list is empty. if (this->last_link_cache_ == 0) { @@ -310,7 +349,6 @@ Event_List_factory::create_for_unmarshal (void) return new Event_List_impl; } - Event_List_Iterator::Event_List_Iterator (Event_List *list) { this->init (list); @@ -326,7 +364,6 @@ Event_List_Iterator::~Event_List_Iterator (void) // nothing } - void Event_List_Iterator::init (Event_List *list) { @@ -335,7 +372,6 @@ Event_List_Iterator::init (Event_List *list) current_ = tmp; } - CORBA::Boolean Event_List_Iterator::next (Event_var &next) { @@ -373,15 +409,10 @@ Event_List_Iterator::advance () } } - - // Checkpoint server side -------------------------------------------- - // Criterion classes implementation ---------------------------------- - - Temperature_Criterion_impl::Temperature_Criterion_impl () { } @@ -398,6 +429,13 @@ Temperature_Criterion_impl::~Temperature_Criterion_impl () { } +::CORBA::ValueBase * +Temperature_Criterion_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} CORBA::Boolean Temperature_Criterion_impl::is_critical (Event* e) @@ -415,7 +453,6 @@ Temperature_Criterion_impl::is_critical (Event* e) return 0; } - void Temperature_Criterion_impl::do_print (void) { @@ -424,7 +461,6 @@ Temperature_Criterion_impl::do_print (void) this->meltingpoint ()->do_print(); } - Temperature_Criterion_factory::~Temperature_Criterion_factory () { } @@ -435,8 +471,6 @@ Temperature_Criterion_factory::create_for_unmarshal (void) return new Temperature_Criterion_impl; } - - Position_Criterion_impl::Position_Criterion_impl () { } @@ -454,6 +488,13 @@ Position_Criterion_impl::~Position_Criterion_impl () { } +::CORBA::ValueBase * +Position_Criterion_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} CORBA::Boolean Position_Criterion_impl::is_critical (Event* e) @@ -475,7 +516,6 @@ Position_Criterion_impl::is_critical (Event* e) return 0; } - void Position_Criterion_impl::do_print ( ) { @@ -496,17 +536,21 @@ Position_Criterion_factory::create_for_unmarshal (void) return new Position_Criterion_impl; } - - Log_Msg_Criterion_impl::Log_Msg_Criterion_impl () { } - Log_Msg_Criterion_impl::~Log_Msg_Criterion_impl () { } +::CORBA::ValueBase * +Log_Msg_Criterion_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} CORBA::Boolean Log_Msg_Criterion_impl::is_critical (Event* e) @@ -521,7 +565,6 @@ Log_Msg_Criterion_impl::is_critical (Event* e) return 0; } - void Log_Msg_Criterion_impl::do_print (void) { @@ -539,8 +582,6 @@ Log_Msg_Criterion_factory::create_for_unmarshal (void) return new Log_Msg_Criterion_impl; } - - Criterion_List_impl::Criterion_List_impl () { this->my_list (0); @@ -556,6 +597,14 @@ Criterion_List_impl::~Criterion_List_impl () { } +::CORBA::ValueBase * +Criterion_List_impl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + void Criterion_List_impl::store_criterion (Criterion *c) { @@ -597,7 +646,6 @@ Criterion_List_impl::is_critical (Event *e) return 0; } - Criterion_List_Iterator::Criterion_List_Iterator (Criterion_List *list) { this->init (list); @@ -608,14 +656,12 @@ Criterion_List_Iterator::~Criterion_List_Iterator () // nothing } - void Criterion_List_Iterator::init (Criterion_List *list) { iterator_.init (list->my_list()); } - Criterion * Criterion_List_Iterator::next () { diff --git a/TAO/examples/OBV/Typed_Events/Event_Types_impl.h b/TAO/examples/OBV/Typed_Events/Event_Types_impl.h index 12893631c4e..b39e70b0a22 100644 --- a/TAO/examples/OBV/Typed_Events/Event_Types_impl.h +++ b/TAO/examples/OBV/Typed_Events/Event_Types_impl.h @@ -50,6 +50,7 @@ class Event_impl : public virtual OBV_Event, public: Event_impl (); virtual ~Event_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); virtual void do_print (void); // Implementation of the do_print () operation the valuetype should have. @@ -80,20 +81,16 @@ class Event_impl : public virtual OBV_Event, class Event_factory : public CORBA::ValueFactoryBase { public: - // create (...) would go here protected: - virtual ~Event_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Event) create_for_unmarshal (void); }; #endif /* is not defined */ - // The procedure to register your instance is currently not much like // OBV specs says. This implementation has currently one // process-wide map for the registered factories. The specs want one @@ -105,7 +102,6 @@ private: // for first experiments. // Exceptions are not yet implemented in this area. - // Temperature implementation classes =================================== // The Temperature_impl should inherit its own OBV_Temperature and @@ -113,7 +109,6 @@ private: // inheritance, I guess.) Its yet there, but purists // can additionally inherit public virtual from the CORBA::DefaultVal... - class Temperature_impl : public virtual OBV_Temperature, public virtual Event_impl { @@ -126,6 +121,7 @@ public: // But it is more simple to do so here. virtual ~Temperature_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); virtual void do_print (void); // Overrides Event_impl::do_print (). Note that a new declaration @@ -135,20 +131,17 @@ public: class Temperature_factory : public CORBA::ValueFactoryBase { friend class Temperature; -public: +public: // create (...) would go here protected: - virtual ~Temperature_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Temperature) create_for_unmarshal (void); }; - // Position implementation classes ===================================== class Position_impl : public virtual OBV_Position, @@ -158,6 +151,7 @@ public: Position_impl (); Position_impl (Point &p); virtual ~Position_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); virtual CORBA::Float x (void); virtual void x (CORBA::Float); @@ -173,19 +167,17 @@ public: class Position_factory : public CORBA::ValueFactoryBase { friend class Position; -public: +public: // create (...) would go here -protected: +protected: virtual ~Position_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Position) create_for_unmarshal (void); }; - // Log_Msg implementation classes ===================================== class Log_Msg_impl : public virtual OBV_Log_Msg, @@ -195,6 +187,7 @@ public: Log_Msg_impl (); Log_Msg_impl (CORBA::Short urgency_p, const char *message_p); virtual ~Log_Msg_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); virtual void do_print (void); }; @@ -202,19 +195,17 @@ public: class Log_Msg_factory : public CORBA::ValueFactoryBase { friend class Log_Msg; -public: +public: // create (...) would go here protected: virtual ~Log_Msg_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Log_Msg) create_for_unmarshal (void); }; - // Event_List_Link implementation classes ===================================== class Event_List_Link_factory; @@ -231,6 +222,7 @@ class Event_List_Link_impl : public virtual OBV_Event_List_Link, Event_List_Link_impl (); Event_List_Link_impl (Event *e); virtual ~Event_List_Link_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); Event *get_event (void); @@ -241,30 +233,28 @@ class Event_List_Link_impl : public virtual OBV_Event_List_Link, // Attach a chain at the end. }; - class Event_List_Link_factory : public CORBA::ValueFactoryBase { friend class Event_List_Link; protected: - virtual ~Event_List_Link_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Event_List_Link) create_for_unmarshal (void); }; - // The event list itself. ---------------------------------- class Event_List_impl : public virtual OBV_Event_List, public virtual CORBA::DefaultValueRefCountBase { friend class Event_List_Iterator; + public: Event_List_impl (); virtual ~Event_List_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); void store_event (Event* e); @@ -284,21 +274,17 @@ class Event_List_impl : public virtual OBV_Event_List, // of the last list link at the receiving end of an invocation. }; - class Event_List_factory : public CORBA::ValueFactoryBase { friend class Event_List; -protected: +protected: virtual ~Event_List_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Event_List) create_for_unmarshal (void); - }; - class Event_List_Iterator { public: @@ -325,19 +311,15 @@ class Event_List_Iterator Event_List_Link_var current_; }; - // Checkpoint server side -------------------------------------------- - // Criterion classes ------------------------------------------------- - // Criterion itself has no implementation since it is abstract. // It is necessary to inherit from OBV_Event (or an Event implementation) // for implementing the state members of Event. - class Temperature_Criterion_impl : public virtual OBV_Temperature_Criterion, public virtual OBV_Event, @@ -348,6 +330,7 @@ public: Temperature_Criterion_impl (CORBA::ULong origin_id, CORBA::Float temp); virtual ~Temperature_Criterion_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); CORBA::Boolean is_critical (Event* e); @@ -357,13 +340,12 @@ public: class Temperature_Criterion_factory : public CORBA::ValueFactoryBase { friend class Temperature; + private: virtual ~Temperature_Criterion_factory (); TAO_OBV_CREATE_RETURN_TYPE (Temperature_Criterion) create_for_unmarshal (void); }; - - class Position_Criterion_impl : public virtual OBV_Position_Criterion, public virtual OBV_Event, @@ -375,6 +357,7 @@ public: Position *lb, Position *tr); virtual ~Position_Criterion_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); CORBA::Boolean is_critical (Event* e); @@ -384,17 +367,14 @@ public: class Position_Criterion_factory : public CORBA::ValueFactoryBase { friend class Position; -protected: +protected: virtual ~Position_Criterion_factory (); private: - TAO_OBV_CREATE_RETURN_TYPE (Position_Criterion) create_for_unmarshal (void); }; - - class Log_Msg_Criterion_impl : public virtual OBV_Log_Msg_Criterion, public virtual OBV_Event, public virtual CORBA::DefaultValueRefCountBase @@ -402,6 +382,7 @@ class Log_Msg_Criterion_impl : public virtual OBV_Log_Msg_Criterion, public: Log_Msg_Criterion_impl (); virtual ~Log_Msg_Criterion_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); CORBA::Boolean is_critical (Event* e); @@ -411,27 +392,26 @@ public: class Log_Msg_Criterion_factory : public CORBA::ValueFactoryBase { friend class Log_Msg; -protected: +protected: virtual ~Log_Msg_Criterion_factory (); private: TAO_OBV_CREATE_RETURN_TYPE (Log_Msg_Criterion) create_for_unmarshal (void); }; - class Criterion_List_impl : public virtual OBV_Criterion_List, public virtual CORBA::DefaultValueRefCountBase { public: Criterion_List_impl (); virtual ~Criterion_List_impl (); + virtual ::CORBA::ValueBase *_copy_value (void); void store_criterion (Criterion *c); CORBA::Boolean is_critical (Event *e); }; - // This is just a wrapper and it uses the Event_List_Iterator on // the underlaying Event_List. Better would be a template for all the // iterators. @@ -456,7 +436,6 @@ class Criterion_List_Iterator Event_List_Iterator iterator_; }; - // Some origin_id's #define KITCHEN 1001 diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h index a767bd47a5b..c2cb67e1f49 100644 --- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h +++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h @@ -23,6 +23,20 @@ public: kind(k); } + virtual ::CORBA::ValueBase *_copy_value (void) + { + ::CORBA::ValueBase *ret_val = 0; + ACE_NEW_THROW_EX ( + ret_val, + MyEvent_i ( + name (), + kind () + ), + ::CORBA::NO_MEMORY () + ); + return ret_val; + } + virtual void dump () { CORBA::LongSeq& pl = payload(); @@ -52,7 +66,6 @@ class MyEventFactory : public virtual CORBA::ValueFactoryBase { public: - virtual CORBA::ValueBase * create_for_unmarshal () { // It doesn't matter what values we construct it with @@ -61,6 +74,4 @@ public: } }; - #endif /* EVENT_H_ */ - diff --git a/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.cpp b/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.cpp index 446ed61ebf5..da6f545cdd7 100644 --- a/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.cpp +++ b/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.cpp @@ -12,6 +12,22 @@ Gateway_ObjRef_Factory ( CORBA::add_ref (old_factory); } +::CORBA::ValueBase * +Gateway_ObjRef_Factory::_copy_value (void) +{ + Gateway_ObjRef_Factory *ret_val= 0; + ACE_NEW_THROW_EX ( + ret_val, + Gateway_ObjRef_Factory ( + gateway_object_factory_, + old_factory_ + ), + ::CORBA::NO_MEMORY () + ); + + return ret_val; +} + CORBA::Object_ptr Gateway_ObjRef_Factory:: make_object (const char *interface_repository_id, diff --git a/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.h b/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.h index 431db81c3d0..eb850120dea 100644 --- a/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.h +++ b/TAO/orbsvcs/examples/ORT/Gateway_ObjRef_Factory.h @@ -8,12 +8,10 @@ #include "ObjectReferenceFactoryC.h" #include "GatewayC.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - class Gateway_ObjRef_Factory : public CORBA::DefaultValueRefCountBase, public virtual OBV_ORT::ObjectReferenceFactory @@ -24,12 +22,13 @@ public: Gateway::Object_Factory_ptr gateway_object_factory, PortableInterceptor::ObjectReferenceFactory *old_factory); + virtual ::CORBA::ValueBase *_copy_value (void); + virtual CORBA::Object_ptr make_object ( const char *repository_id, const PortableInterceptor::ObjectId &id); private: - Gateway::Object_Factory_var gateway_object_factory_; PortableInterceptor::ObjectReferenceFactory_var old_factory_; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp index 5e7b3430caa..393133e667b 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp @@ -48,6 +48,14 @@ TAO_LB_ObjectReferenceFactory::TAO_LB_ObjectReferenceFactory ( len * sizeof (CORBA::Boolean)); } +::CORBA::ValueBase * +TAO_LB_ObjectReferenceFactory::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + // Not implimented + return ret_val; +} + TAO_LB_ObjectReferenceFactory::~TAO_LB_ObjectReferenceFactory (void) { // No need to call CORBA::remove_ref() on this->old_orf_. It is a @@ -226,5 +234,4 @@ TAO_LB_ObjectReferenceFactory::load_managed_object (const char * repository_id, return false; } - TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h index 583e0674000..7bde61ebbb8 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h @@ -51,7 +51,6 @@ class TAO_LB_ObjectReferenceFactory , public virtual OBV_TAO_LB::ObjectReferenceFactory { public: - /// Constructor TAO_LB_ObjectReferenceFactory ( PortableInterceptor::ObjectReferenceFactory * old_orf, @@ -61,6 +60,8 @@ class TAO_LB_ObjectReferenceFactory CORBA::ORB_ptr orb, CosLoadBalancing::LoadManager_ptr lm); + virtual ::CORBA::ValueBase *_copy_value (void); + /** * @name PortableInterceptor::ObjectReferenceFactory Methods * @@ -73,7 +74,6 @@ class TAO_LB_ObjectReferenceFactory const PortableInterceptor::ObjectId & id); //@} - typedef ACE_Hash_Map_Manager_Ex< ACE_CString, PortableGroup::ObjectGroup_var, @@ -85,7 +85,6 @@ class TAO_LB_ObjectReferenceFactory PortableGroup::GenericFactory::FactoryCreationId_var> fcid_list; protected: - /// Destructor /** * Protected destructor to enforce proper memory management via @@ -102,9 +101,7 @@ protected: /// Determine if object with given RepositoryId is load managed. CORBA::Boolean load_managed_object (const char * repository_id, CORBA::ULong & i); - private: - /// The old ObjectReferenceFactory used to create object references. /** * This ObjectReferenceFactory will be used when creating object @@ -112,7 +109,6 @@ private: */ PortableInterceptor::ObjectReferenceFactory_var old_orf_; - /// List of stringified object group references. /** * All stringified object groups in this sequence have a one-to-one @@ -161,12 +157,10 @@ private: * which can be costly. */ CORBA::Boolean * registered_members_; - }; TAO_END_VERSIONED_NAMESPACE_DECL - #if defined (_MSC_VER) #pragma warning(pop) #endif /* _MSC_VER */ diff --git a/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp b/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp index 85634b6c6e1..03091f7919c 100644 --- a/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp +++ b/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.cpp @@ -35,6 +35,20 @@ TAO_AMH_DSI_Exception_Holder::~TAO_AMH_DSI_Exception_Holder () { } +::CORBA::ValueBase * +TAO_AMH_DSI_Exception_Holder::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + ACE_NEW_THROW_EX ( + ret_val, + TAO_AMH_DSI_Exception_Holder ( + exception_ + ), + ::CORBA::NO_MEMORY () + ); + return ret_val; +} + void tao_TAO_AMH_DSI_Exception_Holder_add_ref (TAO_AMH_DSI_Exception_Holder * p) { diff --git a/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.h b/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.h index 943d42afebd..6e277495e37 100644 --- a/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.h +++ b/TAO/tao/DynamicInterface/AMH_DSI_Response_Handler.h @@ -151,6 +151,7 @@ public: TAO_AMH_DSI_Exception_Holder (CORBA::Exception *ex); virtual ~TAO_AMH_DSI_Exception_Holder (void); + virtual ::CORBA::ValueBase *_copy_value (void); static TAO_AMH_DSI_Exception_Holder* _downcast ( CORBA::ValueBase* ); @@ -241,7 +242,6 @@ public: static TAO_AMH_DSI_Response_Handler* _unchecked_narrow (CORBA::Object_ptr); protected: - /// Return 0. Should never be used. virtual const char *_interface_repository_id (void) const; diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp index b39847e2161..f41d376c0db 100644 --- a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp +++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp @@ -26,6 +26,23 @@ namespace TAO { } + ::CORBA::ValueBase * + ObjectReferenceTemplate::_copy_value (void) + { + ::CORBA::ValueBase *ret_val= 0; + ACE_NEW_THROW_EX ( + ret_val, + ObjectReferenceTemplate ( + server_id_, + orb_id_, + adapter_name_, + poa_ + ), + ::CORBA::NO_MEMORY () + ); + return ret_val; + } + char * ObjectReferenceTemplate::server_id (void) { diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h index e97ac59a3b0..c1574e73a20 100644 --- a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h +++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h @@ -60,6 +60,7 @@ namespace TAO const char *orb_id, PortableInterceptor::AdapterName *adapter_name, PortableServer::POA_ptr poa); + ::CORBA::ValueBase *_copy_value (void); /** * @name PortableInterceptor::ObjectReferenceTemplate Methods @@ -88,7 +89,6 @@ namespace TAO //@} protected: - /// Destructor /** * Protected destructor to enforce proper memory management via diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp index 6fe76a84f62..7ba306f73dd 100644 --- a/TAO/tao/Valuetype/ValueBase.cpp +++ b/TAO/tao/Valuetype/ValueBase.cpp @@ -55,6 +55,25 @@ TAO_ChunkInfo::TAO_ChunkInfo (CORBA::Boolean do_chunking, { } +CORBA::ValueBase * +CORBA::ValueBase::_copy_value (void) +{ + // Note that TAO traditionally has not enforced this functions PURE + // virtual nature, thus the end user didn't have to provide an + // implimentaion of _copy_value in their top level valuetype class + // that deriveds from the tao_idl generated OBV_* class. If they do + // not use _copy_value() then there was no requirement to impliment it. + // However as an option TAO can now be built to use _copy_value when + // inserting a copy of the valuetype into an any, instead of increasing + // it's referance count. It is now possiable that older code may end up + // here in error due to the lack of a user's override. + ACE_VERSIONED_NAMESPACE_NAME::__ace_assert ( + __FILE__, + __LINE__, + ACE_TEXT_CHAR_TO_TCHAR ("Valuetype's _copy_value() should be implimented in user's most derived class")); + return 0; +} + CORBA::ValueBase::ValueBase (void) : is_truncatable_(0), chunking_(0) @@ -102,7 +121,6 @@ CORBA::ValueBase::_tao_any_destructor (void *x) // %! yet much to do ... look for +++ ! - // 1. Is 'this' yet marshalled ? (->1a) // If not then mark 'this' as marshalled. (->2) +++ // Or is it null ? (write null_ref and return ok) @@ -148,7 +166,6 @@ CORBA::ValueBase::_tao_marshal (TAO_OutputCDR &strm, return 1; } - CORBA::Boolean CORBA::ValueBase::_tao_unmarshal (TAO_InputCDR &strm, CORBA::ValueBase *&new_object) @@ -450,7 +467,6 @@ CORBA::ValueBase::_tao_unmarshal_post (TAO_InputCDR &) return true; } - CORBA::Boolean CORBA::ValueBase::_tao_validate_box_type (TAO_InputCDR &strm, TAO_InputCDR &indirected_strm, @@ -599,7 +615,6 @@ CORBA::ValueBase::_tao_unmarshal_value_indirection (TAO_InputCDR &strm, return true; } - CORBA::Boolean CORBA::ValueBase::_tao_unmarshal_repo_id_indirection (TAO_InputCDR &strm, ACE_CString& id) @@ -651,9 +666,7 @@ CORBA::ValueBase::_tao_unmarshal_codebase_url_indirection (TAO_InputCDR &strm, return 1; } - #if defined (GEN_OSTREAM_OPS) - std::ostream & CORBA::ValueBase::_tao_stream (std::ostream &strm, const CORBA::ValueBase *value) @@ -666,12 +679,10 @@ CORBA::ValueBase::_tao_stream_v (std::ostream &strm) const { return strm << "CORBA::ValueBase"; } - #endif /* GEN_OSTREAM_OPS */ // =================== methods for chunking ==================== - CORBA::Boolean CORBA::ValueBase::_tao_write_special_value (TAO_OutputCDR &strm, const CORBA::ValueBase *value) @@ -739,7 +750,6 @@ CORBA::ValueBase::_tao_write_special_value (TAO_OutputCDR &strm, } } - CORBA::Boolean CORBA::ValueBase::_tao_write_value (TAO_OutputCDR &strm, const CORBA::ValueBase * value, @@ -758,7 +768,6 @@ CORBA::ValueBase::_tao_write_value (TAO_OutputCDR &strm, return true; } - CORBA::Boolean CORBA::ValueBase::_tao_write_value_header (TAO_OutputCDR &strm, ptrdiff_t formal_type_id) const @@ -838,7 +847,6 @@ CORBA::ValueBase::_tao_write_value_header (TAO_OutputCDR &strm, return true; } - CORBA::Boolean CORBA::ValueBase::_tao_write_repository_id (TAO_OutputCDR &strm, ACE_CString& id) @@ -943,7 +951,6 @@ TAO_ChunkInfo::end_chunk(TAO_OutputCDR &strm) return true; } - CORBA::Boolean TAO_ChunkInfo::write_previous_chunk_size(TAO_OutputCDR &strm) { @@ -976,7 +983,6 @@ TAO_ChunkInfo::write_previous_chunk_size(TAO_OutputCDR &strm) return true; } - CORBA::Boolean TAO_ChunkInfo::reserve_chunk_size(TAO_OutputCDR &strm) { @@ -1088,7 +1094,6 @@ TAO_ChunkInfo::handle_chunking (TAO_InputCDR &strm) return 1; } - CORBA::Boolean TAO_ChunkInfo::skip_chunks (TAO_InputCDR &strm) { @@ -1241,7 +1246,6 @@ CORBA::ValueBase::_tao_read_repository_id (TAO_InputCDR& strm, return 1; } - CORBA::Boolean CORBA::ValueBase::_tao_read_codebase_url (TAO_InputCDR& strm, ACE_CString& codebase_url) @@ -1320,14 +1324,12 @@ CORBA::ValueBase::_tao_read_codebase_url (TAO_InputCDR& strm, return 1; } - void CORBA::ValueBase::truncation_hook () { throw ::CORBA::INTERNAL (); } - // ================== Typecode initializations ================== namespace TAO @@ -1400,7 +1402,6 @@ CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase (void) { } - // Copy constructor CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase (const DefaultValueRefCountBase& rhs) @@ -1410,7 +1411,6 @@ CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase { } - void CORBA::DefaultValueRefCountBase::_tao_add_ref (void) { @@ -1453,14 +1453,12 @@ operator>> (TAO_InputCDR &strm, } #if defined (GEN_OSTREAM_OPS) - std::ostream& operator<< (std::ostream &strm, CORBA::ValueBase *_tao_valuetype) { return CORBA::ValueBase::_tao_stream (strm, _tao_valuetype); } - #endif /* GEN_OSTREAM_OPS */ // =============== Template Specializations ===================== diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h index 2da58404e5e..cef4aa02a21 100644 --- a/TAO/tao/Valuetype/ValueBase.h +++ b/TAO/tao/Valuetype/ValueBase.h @@ -52,6 +52,15 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL strm.set_##MAPNAME (handle); \ } else do {} while (0) +/////////////// + +#undef TAO_local_COPY_VALUE_IS_PURE +#if defined(TAO_VALUETYPE_COPYING_ANY_INSERTION_USES_COPY_VALUE) || !defined(TAO_VALUETYPE_COPY_VALUE_IS_NOT_PURE) +#define TAO_local_COPY_VALUE_IS_PURE =0 +#else +#define TAO_local_COPY_VALUE_IS_PURE +#endif + class TAO_Valuetype_Export TAO_ChunkInfo { public: @@ -141,21 +150,7 @@ namespace CORBA typedef ACE_Vector < ACE_CString > Repository_Id_List; - // This is only temporary, it is _not_ the Right Thing To Do. - // Currently nothing should break, as TAO neither uses - // _copy_value() nor generates code which uses _copy_value(), and - // any user code which depends on the declaration of - // _copy_value() must override it anyway, so it should never get - // called. - // N.B. - see bugzilla #1391 / TAO#84. Fix is pending. - virtual CORBA::ValueBase* _copy_value (void) - { - ACE_VERSIONED_NAMESPACE_NAME::__ace_assert ( - __FILE__, - __LINE__, - ACE_TEXT_CHAR_TO_TCHAR ("CORBA::ValueBase::_copy_value() Not implimented see bugzilla #1391")); - return 0; - }; + virtual CORBA::ValueBase* _copy_value (void) TAO_local_COPY_VALUE_IS_PURE; // Reference counting. virtual void _add_ref (void) = 0; @@ -224,18 +219,14 @@ namespace CORBA const char * const repo_id_expected, CORBA::Boolean & null_object, CORBA::Boolean & is_indirected); - #if defined (GEN_OSTREAM_OPS) - /// Used by optionally generated ostream operators for valuetypes /// to output the state of the actual type for debugging. static std::ostream& _tao_stream (std::ostream &strm, const ValueBase *value); virtual std::ostream& _tao_stream_v (std::ostream &strm) const; - #endif /* GEN_OSTREAM_OPS */ public: // otherwise these cannot be called from a static function - /// During marshal jump to the most derived part virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const = 0; @@ -320,8 +311,6 @@ namespace CORBA /// accounting for indirection. static CORBA::Boolean _tao_read_codebase_url (TAO_InputCDR& strm, ACE_CString& codebase_url); - - private: ValueBase & operator= (const ValueBase &); }; // ValueBase @@ -442,6 +431,7 @@ namespace TAO }; } +#undef TAO_local_COPY_VALUE_IS_PURE TAO_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) diff --git a/TAO/tests/Bug_2791_Regression/Message_i.cpp b/TAO/tests/Bug_2791_Regression/Message_i.cpp index c66bffc6d72..cfd2c57b632 100755 --- a/TAO/tests/Bug_2791_Regression/Message_i.cpp +++ b/TAO/tests/Bug_2791_Regression/Message_i.cpp @@ -2,12 +2,10 @@ #include "Message_i.h" - MessageImpl::MessageImpl () { } - MessageImpl::MessageImpl (const char *user, const char *subject, const char *text) { user_ (user); @@ -15,6 +13,21 @@ MessageImpl::MessageImpl (const char *user, const char *subject, const char *tex text_ (text); } +::CORBA::ValueBase * +MessageImpl::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + ACE_NEW_THROW_EX ( + ret_val, + MessageImpl ( + user_ (), + subject_ (), + text_ () + ), + ::CORBA::NO_MEMORY () + ); + return ret_val; +} char * MessageImpl::user () @@ -22,42 +35,36 @@ MessageImpl::user () return CORBA::string_dup (user_ ()); } - void MessageImpl::user (const char *s) { user_ (s); } - char * MessageImpl::subject () { return CORBA::string_dup (subject_ ()); } - void MessageImpl::subject (const char *s) { subject_ (s); } - char * MessageImpl::text () { return CORBA::string_dup (text_ ()); } - void MessageImpl::text (const char *s) { text_ (s); } - void MessageImpl::print () { diff --git a/TAO/tests/Bug_2791_Regression/Message_i.h b/TAO/tests/Bug_2791_Regression/Message_i.h index fd5c3c4d61a..6b4c1b744e7 100755 --- a/TAO/tests/Bug_2791_Regression/Message_i.h +++ b/TAO/tests/Bug_2791_Regression/Message_i.h @@ -3,13 +3,13 @@ #include "MessageC.h" #include "tao/corba.h" - class MessageImpl : public virtual OBV_Message, public virtual CORBA::DefaultValueRefCountBase { public: MessageImpl (); MessageImpl (const char *user, const char *subject, const char *text); + virtual ::CORBA::ValueBase *_copy_value (void); virtual char *user (); virtual void user (const char *); diff --git a/TAO/tests/OBV/Collocated/Forward/TreeController.idl b/TAO/tests/OBV/Collocated/Forward/TreeController.idl index 11665da53fe..cdeffe9830b 100644 --- a/TAO/tests/OBV/Collocated/Forward/TreeController.idl +++ b/TAO/tests/OBV/Collocated/Forward/TreeController.idl @@ -19,3 +19,10 @@ interface Test // Shutdown the romote ORB oneway void shutdown (); }; + +// HOWEVER it is illegal to not include the full definition of the +// forward declared BaseNode by the end of the compilation unit. +// (The code generation of the _copy_value() function for TreeController +// requires to know how to downcast the "root" member to it's corresponding +// "BaseNode" type; this requires full knowledge of the enclosed type.) +#include <TreeBase.idl> diff --git a/TAO/tests/OBV/Forward/TreeController.idl b/TAO/tests/OBV/Forward/TreeController.idl index 11665da53fe..cdeffe9830b 100644 --- a/TAO/tests/OBV/Forward/TreeController.idl +++ b/TAO/tests/OBV/Forward/TreeController.idl @@ -19,3 +19,10 @@ interface Test // Shutdown the romote ORB oneway void shutdown (); }; + +// HOWEVER it is illegal to not include the full definition of the +// forward declared BaseNode by the end of the compilation unit. +// (The code generation of the _copy_value() function for TreeController +// requires to know how to downcast the "root" member to it's corresponding +// "BaseNode" type; this requires full knowledge of the enclosed type.) +#include <TreeBase.idl> diff --git a/TAO/tests/OBV/Indirection/Factory.cpp b/TAO/tests/OBV/Indirection/Factory.cpp index 48abf2ca124..4fecc7e5a81 100755 --- a/TAO/tests/OBV/Indirection/Factory.cpp +++ b/TAO/tests/OBV/Indirection/Factory.cpp @@ -2,16 +2,15 @@ #include "Factory.h" #include "tao/AnyTypeCode/TypeCode.h" - void -NodeFactory::register_new_factory(CORBA::ORB& orb) { +NodeFactory::register_new_factory (CORBA::ORB& orb) { CORBA::ValueFactoryBase_var mf = new NodeFactory; - CORBA::String_var id = ::demo::value::idl::_tc_Node->id(); - orb.register_value_factory(id.in(), mf.in()); + CORBA::String_var id = ::demo::value::idl::_tc_Node->id (); + orb.register_value_factory (id.in (), mf.in ()); } CORBA::ValueBase* -NodeFactory::create_for_unmarshal(void) +NodeFactory::create_for_unmarshal (void) { ::CORBA::ValueBase *ret_val = 0; ACE_NEW_THROW_EX ( @@ -22,17 +21,16 @@ NodeFactory::create_for_unmarshal(void) return ret_val; } - void -BoxedValueFactory::register_new_factory(CORBA::ORB& orb) { +BoxedValueFactory::register_new_factory (CORBA::ORB& orb) { CORBA::ValueFactoryBase_var mf = new BoxedValueFactory; - OBV_demo::value::idl::boxedValue bv; - CORBA::String_var id = bv._tao_type()->id ();; - orb.register_value_factory(id.in(), mf.in()); + demo::value::idl::boxedValue_var bv (new OBV_demo::value::idl::boxedValue); + CORBA::String_var id = bv->_tao_type ()->id ();; + orb.register_value_factory (id.in (), mf.in ()); } CORBA::ValueBase* -BoxedValueFactory::create_for_unmarshal(void) +BoxedValueFactory::create_for_unmarshal (void) { ::CORBA::ValueBase *ret_val = 0; ACE_NEW_THROW_EX ( @@ -43,17 +41,16 @@ BoxedValueFactory::create_for_unmarshal(void) return ret_val; } - void -BaseValueFactory::register_new_factory(CORBA::ORB& orb) { +BaseValueFactory::register_new_factory (CORBA::ORB& orb) { CORBA::ValueFactoryBase_var mf = new BaseValueFactory; - OBV_demo::value::idl::BaseValue bv; - CORBA::String_var id = bv._tao_type()->id ();; - orb.register_value_factory(id.in(), mf.in()); + demo::value::idl::BaseValue_var bv (new OBV_demo::value::idl::BaseValue); + CORBA::String_var id = bv->_tao_type ()->id (); + orb.register_value_factory (id.in (), mf.in ()); } CORBA::ValueBase* -BaseValueFactory::create_for_unmarshal(void) +BaseValueFactory::create_for_unmarshal (void) { ::CORBA::ValueBase *ret_val = 0; ACE_NEW_THROW_EX ( @@ -64,17 +61,16 @@ BaseValueFactory::create_for_unmarshal(void) return ret_val; } - void -TValueFactory::register_new_factory(CORBA::ORB& orb) { +TValueFactory::register_new_factory (CORBA::ORB& orb) { CORBA::ValueFactoryBase_var mf = new TValueFactory; - OBV_demo::value::idl::TValue bv; - CORBA::String_var id = bv._tao_type()->id ();; - orb.register_value_factory(id.in(), mf.in()); + demo::value::idl::TValue_var bv (new OBV_demo::value::idl::TValue); + CORBA::String_var id = bv->_tao_type ()->id (); + orb.register_value_factory (id.in (), mf.in ()); } CORBA::ValueBase* -TValueFactory::create_for_unmarshal(void) +TValueFactory::create_for_unmarshal (void) { ::CORBA::ValueBase *ret_val = 0; ACE_NEW_THROW_EX ( @@ -86,15 +82,15 @@ TValueFactory::create_for_unmarshal(void) } void -ConfigValueFactory::register_new_factory(CORBA::ORB& orb) { +ConfigValueFactory::register_new_factory (CORBA::ORB& orb) { CORBA::ValueFactoryBase_var mf = new ConfigValueFactory; - OBV_demo::value::idl::ConfigValue bv; - CORBA::String_var id = bv._tao_type()->id ();; - orb.register_value_factory(id.in(), mf.in()); + demo::value::idl::ConfigValue_var bv (new OBV_demo::value::idl::ConfigValue); + CORBA::String_var id = bv->_tao_type ()->id (); + orb.register_value_factory (id.in (), mf.in ()); } CORBA::ValueBase* -ConfigValueFactory::create_for_unmarshal(void) +ConfigValueFactory::create_for_unmarshal (void) { ::CORBA::ValueBase *ret_val = 0; ACE_NEW_THROW_EX ( @@ -105,7 +101,6 @@ ConfigValueFactory::create_for_unmarshal(void) return ret_val; } - ConfigValueImpl::ConfigValueImpl (const char* name, const char* value) { this->name (name); diff --git a/TAO/tests/OBV/Truncatable/client.cpp b/TAO/tests/OBV/Truncatable/client.cpp index 4527a992e32..c185a386dc7 100644 --- a/TAO/tests/OBV/Truncatable/client.cpp +++ b/TAO/tests/OBV/Truncatable/client.cpp @@ -4,7 +4,7 @@ #include "ExtraC.h" #include "ace/Get_Opt.h" -const ACE_TCHAR *ior = ACE_TEXT("file://test.ior"); +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); int fail = 0; int pretest = 0; @@ -20,14 +20,14 @@ int verbose = 0; { \ fail++; \ if (!verbose) \ - ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) client - Failure at line %l\n"))); \ + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client - Failure at line %l\n"))); \ } \ } int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:v")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("k:v")); int c; while ((c = get_opts ()) != -1) @@ -53,7 +53,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) } int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { @@ -74,8 +74,6 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) base_factory); base_factory->_remove_ref (); // release ownership - - OBV_TruncatableTest::TValue1_init *value1_factory = 0; ACE_NEW_RETURN (value1_factory, OBV_TruncatableTest::TValue1_init, @@ -85,8 +83,6 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) value1_factory); value1_factory->_remove_ref (); - - OBV_TruncatableTest::TValue2_init *value2_factory = 0; ACE_NEW_RETURN (value2_factory, OBV_TruncatableTest::TValue2_init, @@ -96,7 +92,6 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) value2_factory); value2_factory->_remove_ref (); - OBV_TruncatableTest::TValue3_init *value3_factory = 0; ACE_NEW_RETURN (value3_factory, OBV_TruncatableTest::TValue3_init, @@ -138,7 +133,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) orb->string_to_object(ior); OBV_TruncatableTest::Test_var test = - OBV_TruncatableTest::Test::_narrow(tmp.in ()); + OBV_TruncatableTest::Test::_narrow (tmp.in ()); if (CORBA::is_nil (test.in ())) { @@ -148,51 +143,51 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) 1); } - CORBA::String_var desc;; + CORBA::String_var desc; { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::TValue1 v1; - v1.basic_data (9); - v1.data1 (99); + OBV_TruncatableTest::TValue1_var v1 (new OBV_OBV_TruncatableTest::TValue1); + v1->basic_data (9); + v1->data1 (99); OBV_TruncatableTest::BaseValue_var ov1; desc = CORBA::string_dup ("A<-tB, truncate B to A"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 1: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 1: %C: "), + desc.in ())); pretest = fail; - test->op1 ("case1", &v1, ov1.out (), desc.inout ()); + test->op1 ("case1", v1.in (), ov1.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case1: A<-tB, truncate B to A")); - VERIFY (v1.basic_data () == ov1->basic_data ()); + VERIFY (v1->basic_data () == ov1->basic_data ()); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::TValue2 v2; + OBV_TruncatableTest::TValue2_var v2 (new OBV_OBV_TruncatableTest::TValue2); - v2.basic_data (9); - v2.data1 (99); - v2.data2 (99 * 2); + v2->basic_data (9); + v2->data1 (99); + v2->data2 (99 * 2); OBV_TruncatableTest::BaseValue_var ov2; desc = CORBA::string_dup ("A<-tB<-tC, truncate C to A"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 2: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 2: %C: "), + desc.in ())); pretest = fail; - test->op1 ("case2", &v2, ov2.out (), desc.inout ()); + test->op1 ("case2", v2.in (), ov2.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case2: A<-tB<-tC, truncate C to A")); - VERIFY (v2.basic_data () == ov2->basic_data ()); + VERIFY (v2->basic_data () == ov2->basic_data ()); if (verbose) ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), (pretest == fail) ? @@ -201,51 +196,51 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) OBV_TruncatableTest::TValue1_var otv1; desc = CORBA::string_dup ("A<-tB<-tC, truncate C to B"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 3: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Case 3: %C: "), + desc.in ())); pretest = fail; - test->op2 (&v2, "case3", otv1.out (), desc.inout ()); + test->op2 (v2.in (), "case3", otv1.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case3: A<-tB<-tC, truncate C to B")); - VERIFY (v2.basic_data () == otv1->basic_data ()); - VERIFY (v2.data1 () == otv1->data1 ()); + VERIFY (v2->basic_data () == otv1->basic_data ()); + VERIFY (v2->data1 () == otv1->data1 ()); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::TValue1 itv1b; + OBV_TruncatableTest::TValue1_var itv1b (new OBV_OBV_TruncatableTest::TValue1); - itv1b.basic_data(7); - itv1b.data1(8); + itv1b->basic_data(7); + itv1b->data1(8); OBV_TruncatableTest::TValue1_var otv1b; desc = CORBA::string_dup ("A<-tB, truncatable but no truncation"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 3b: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 3b: %C: "), + desc.in ())); pretest = fail; - test->op2 (&itv1b, "case3b", otv1b.out (), desc.inout ()); + test->op2 (itv1b.in (), "case3b", otv1b.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case3b: A<-tB, truncatable but no truncation")); - VERIFY (itv1b.basic_data () == otv1b->basic_data ()); - VERIFY (itv1b.data1 () == otv1b->data1 ()); + VERIFY (itv1b->basic_data () == otv1b->basic_data ()); + VERIFY (itv1b->data1 () == otv1b->data1 ()); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::TValue3 v3; - v3.basic_data (9); - v3.data1 (99); - v3.data3 (99 * 3); + OBV_TruncatableTest::TValue3_var v3 (new OBV_OBV_TruncatableTest::TValue3); + v3->basic_data (9); + v3->data1 (99); + v3->data3 (99 * 3); bool caught_expected_exception = false; try @@ -254,14 +249,14 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) desc = CORBA::string_dup ("A<-tB<-C, try truncate C to A, MARSHAL exception"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 4: %C: "), - desc.in())); - test->op1 ("case4", &v3, ov3.out (), desc.inout ()); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 4: %C: "), + desc.in ())); + test->op1 ("case4", v3.in (), ov3.out (), desc.inout ()); } catch (const CORBA::MARSHAL&) { if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("passed\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("passed\n"))); caught_expected_exception = true; } @@ -269,36 +264,36 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { fail++; if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("faileded\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("faileded\n"))); } } //end marshaling exception test. { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::NestedValue nv; - nv.data (2); + OBV_TruncatableTest::NestedValue_var nv (new OBV_OBV_TruncatableTest::NestedValue); + nv->data (2); - OBV_OBV_TruncatableTest::TValue5 v5; + OBV_TruncatableTest::TValue5_var v5 (new OBV_OBV_TruncatableTest::TValue5); - v5.basic_data (9); - v5.nv4 (&nv); - v5.data4 (99 * 4); - v5.str1 (CORBA::string_dup ("str1")); - v5.data5 (99 * 5); - v5.nv5 (&nv); - v5.str2 (CORBA::string_dup ("str2")); + v5->basic_data (9); + v5->nv4 (nv.in ()); + v5->data4 (99 * 4); + v5->str1 (CORBA::string_dup ("str1")); + v5->data5 (99 * 5); + v5->nv5 (nv.in ()); + v5->str2 (CORBA::string_dup ("str2")); OBV_TruncatableTest::BaseValue_var ov5; desc = CORBA::string_dup ("A<-tB<-tC, B & C have nested value type, truncate C to A"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 5: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 5: %C: "), + desc.in ())); pretest = fail; - test->op1 ("case5", &v5, ov5.out (), desc.inout ()); + test->op1 ("case5", v5.in (), ov5.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case5: A<-tB<-tC, B & C have nested value type, truncate C to A")); - VERIFY (v5.basic_data () == ov5->basic_data ()); + VERIFY (v5->basic_data () == ov5->basic_data ()); if (verbose) ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), (pretest == fail) ? @@ -308,81 +303,81 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) desc = CORBA::string_dup ("A<-tB<-tC, B & C have nested value type, truncate C to B"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 6: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 6: %C: "), + desc.in ())); pretest = fail; - test->op3 ("case6", &v5, otv4.out (), desc.inout ()); + test->op3 ("case6", v5.in (), otv4.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case6: A<-tB<-tC, B & C have nested value type, truncate C to B")); - VERIFY (v5.basic_data () == otv4->basic_data ()); - VERIFY (v5.nv4 ()->data () == otv4->nv4 ()->data ()); - VERIFY (v5.data4 () == otv4->data4 ()); + VERIFY (v5->basic_data () == otv4->basic_data ()); + VERIFY (v5->nv4 ()->data () == otv4->nv4 ()->data ()); + VERIFY (v5->data4 () == otv4->data4 ()); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::TValue6 iv; - iv.basic_data (9); + OBV_TruncatableTest::TValue6_var iv (new OBV_OBV_TruncatableTest::TValue6); + iv->basic_data (9); OBV_TruncatableTest::BaseValue_var ov; desc = CORBA::string_dup ("A<-tB, B has no data, truncate B to A"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 7: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 7: %C: "), + desc.in ())); pretest = fail; - test->op1 ("case7", &iv, ov.out (), desc.inout ()); + test->op1 ("case7", iv.in (), ov.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case7: A<-tB, B has no data, truncate B to A")); - VERIFY (iv.basic_data () == ov->basic_data ()); + VERIFY (iv->basic_data () == ov->basic_data ()); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } { //isolate the scope of objects to avoid using wrong values - OBV_OBV_TruncatableTest::TValue1 v1; - v1.basic_data (8); - v1.data1 (88); + OBV_TruncatableTest::TValue1_var v1 (new OBV_OBV_TruncatableTest::TValue1); + v1->basic_data (8); + v1->data1 (88); - OBV_OBV_TruncatableTest::TValue1 v4; - v4.basic_data (9); - v4.data1 (99); + OBV_TruncatableTest::TValue1_var v4 (new OBV_OBV_TruncatableTest::TValue1); + v4->basic_data (9); + v4->data1 (99); - OBV_OBV_TruncatableTest::NestedValue nv; - nv.data (2); + OBV_TruncatableTest::NestedValue_var nv (new OBV_OBV_TruncatableTest::NestedValue); + nv->data (2); - OBV_OBV_TruncatableTest::TValue4 v2; + OBV_TruncatableTest::TValue4_var v2 (new OBV_OBV_TruncatableTest::TValue4); - v2.basic_data (7); - v2.nv4 (&nv); - v2.data4 (77); + v2->basic_data (7); + v2->nv4 (nv.in ()); + v2->data4 (77); - OBV_OBV_TruncatableTest::TValue4 v3; - v3.basic_data (6); - v3.nv4 (&nv); - v3.data4 (66); + OBV_TruncatableTest::TValue4_var v3 (new OBV_OBV_TruncatableTest::TValue4); + v3->basic_data (6); + v3->nv4 (nv.in ()); + v3->data4 (66); desc = CORBA::string_dup ("multiple IN truncatable valuetype parameters" " and return truncatable valuetype"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 8: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 8: %C: "), + desc.in ())); pretest = fail; OBV_TruncatableTest::BaseValue_var ov - = test->op4 ("case8", &v1, 5, &v2, &v3, &v4, desc.inout ()); + = test->op4 ("case8", v1.in (), 5, v2.in (), v3.in (), v4.in (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case8: multiple IN truncatable valuetype parameters" " and return truncatable valuetype")); - CORBA::ULong total = 5 * (v1.basic_data () + v2.basic_data () + - v3.basic_data () + v4.basic_data ()); + CORBA::ULong total = 5 * (v1->basic_data () + v2->basic_data () + + v3->basic_data () + v4->basic_data ()); VERIFY (ov->basic_data () == total); if (verbose) ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), @@ -391,54 +386,51 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } { - OBV_OBV_TruncatableTest::Extra1 v1; - v1.basic_data (9); - v1.data1 (99); - v1.edata1 (1234); + OBV_TruncatableTest::Extra1_var v1 (new OBV_OBV_TruncatableTest::Extra1); + v1->basic_data (9); + v1->data1 (99); + v1->edata1 (1234); OBV_TruncatableTest::TValue1_var ov1; desc = CORBA::string_dup ("A<-tB, truncate unknown B to A"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 9: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 9: %C: "), + desc.in ())); pretest = fail; - test->op2 (&v1, "case9", ov1.out (), desc.inout ()); - + test->op2 (v1.in (), "case9", ov1.out (), desc.inout ()); VERIFY (! ACE_OS::strcmp (desc.in (), "case9: A<-tB, truncate unknown B to A")); - VERIFY (v1.basic_data () == ov1->basic_data () - && v1.data1() == ov1->data1()); + VERIFY (v1->basic_data () == ov1->basic_data () + && v1->data1() == ov1->data1()); if (verbose) ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } - { - OBV_OBV_TruncatableTest::TValue1 v1; - v1.basic_data (9); - v1.data1 (99); + OBV_TruncatableTest::TValue1_var v1 (new OBV_OBV_TruncatableTest::TValue1); + v1->basic_data (9); + v1->data1 (99); OBV_TruncatableTest::TValue1_var ov1; CORBA::Any a; - a <<= &v1; + a <<= &v1.inout (); desc = CORBA::string_dup ("A<-tB, known truncatable via Any"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 10: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 10: %C: "), + desc.in ())); pretest = fail; test->op5 (a, "case10", ov1.out (), desc.inout ()); - VERIFY (! ACE_OS::strcmp (desc.in (), "case10: A<-tB, known truncatable via Any")); - VERIFY (v1.basic_data () == ov1->basic_data () - && v1.data1() == ov1->data1()); + VERIFY (v1->basic_data () == ov1->basic_data () + && v1->data1() == ov1->data1()); if (verbose) ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), (pretest == fail) ? @@ -446,18 +438,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } { - OBV_OBV_TruncatableTest::Extra1 v1; - v1.basic_data (9); - v1.data1 (99); - v1.edata1 (1234); + OBV_TruncatableTest::Extra1_var v1 (new OBV_OBV_TruncatableTest::Extra1); + v1->basic_data (9); + v1->data1 (99); + v1->edata1 (1234); OBV_TruncatableTest::TValue1_var ov1; CORBA::Any a; - a <<= &v1; + a <<= &v1.inout (); desc = CORBA::string_dup ("A<-tB, unknown truncatable via Any"); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 11: %C: "), - desc.in())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Case 11: %C: "), + desc.in ())); pretest = fail; test->op5 (a, "case11", ov1.out (), desc.inout ()); @@ -465,17 +457,16 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) VERIFY (! ACE_OS::strcmp (desc.in (), "case11: A<-tB, unknown truncatable via Any")); - VERIFY (v1.basic_data () == ov1->basic_data () - && v1.data1() == ov1->data1()); + VERIFY (v1->basic_data () == ov1->basic_data () + && v1->data1() == ov1->data1()); if (verbose) - ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s\n"), (pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed"))); } ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - shutdown orb\n")); - test->shutdown (); orb->destroy (); @@ -486,7 +477,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; } else - ACE_DEBUG((LM_DEBUG, "(%P|%t) client: test passed\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) client: test passed\n")); } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/ORT/ObjectReferenceFactory.cpp b/TAO/tests/ORT/ObjectReferenceFactory.cpp index cee5cdf81fa..846a745b131 100644 --- a/TAO/tests/ORT/ObjectReferenceFactory.cpp +++ b/TAO/tests/ORT/ObjectReferenceFactory.cpp @@ -3,7 +3,6 @@ #include "ObjectReferenceFactory.h" #include "tao/debug.h" - ObjectReferenceFactory::ObjectReferenceFactory ( PortableInterceptor::ObjectReferenceFactory * old_orf) : old_orf_ (old_orf) @@ -12,6 +11,18 @@ ObjectReferenceFactory::ObjectReferenceFactory ( CORBA::add_ref (old_orf); } +::CORBA::ValueBase * +ObjectReferenceFactory::_copy_value (void) +{ + ::CORBA::ValueBase *ret_val= 0; + ACE_NEW_THROW_EX ( + ret_val, + ObjectReferenceFactory (old_orf_.inout ()), + ::CORBA::NO_MEMORY () + ); + return ret_val; +} + ObjectReferenceFactory::~ObjectReferenceFactory (void) { // No need to call CORBA::remove_ref() on this->old_orf_. It is a diff --git a/TAO/tests/ORT/ObjectReferenceFactory.h b/TAO/tests/ORT/ObjectReferenceFactory.h index 354a7b38a0f..afa4449f7b5 100644 --- a/TAO/tests/ORT/ObjectReferenceFactory.h +++ b/TAO/tests/ORT/ObjectReferenceFactory.h @@ -10,7 +10,6 @@ */ //============================================================================= - #ifndef TAO_OBJECT_REFERENCE_FACTORY_H #define TAO_OBJECT_REFERENCE_FACTORY_H @@ -25,7 +24,6 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ - /** * @class ObjectReferenceFactory * @@ -41,11 +39,12 @@ class ObjectReferenceFactory , public virtual CORBA::DefaultValueRefCountBase { public: - /// Constructor ObjectReferenceFactory ( PortableInterceptor::ObjectReferenceFactory * old_orf); + virtual ::CORBA::ValueBase *_copy_value (void); + /** * @name PortableInterceptor::ObjectReferenceFactory Methods * @@ -59,7 +58,6 @@ class ObjectReferenceFactory //@} protected: - /// Destructor /** * Protected destructor to enforce proper memory management via @@ -68,7 +66,6 @@ protected: ~ObjectReferenceFactory (void); private: - /// The old ObjectReferenceFactory used to create object references. /** * This ObjectReferenceFactory will still be used when creating @@ -76,10 +73,8 @@ private: * ObjectReferenceFactory. */ PortableInterceptor::ObjectReferenceFactory_var old_orf_; - }; - #if defined (_MSC_VER) #pragma warning(pop) #endif /* _MSC_VER */ |