diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-04-16 00:49:06 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-04-16 00:49:06 +0000 |
commit | d5c3e91779887950d9f5db14f1cd5794ccbfe8f1 (patch) | |
tree | c03ef292d4b133e298ced7a64b952f321a7cc3dc | |
parent | 11332bf38b806102b1009539d6c159fe34064462 (diff) | |
download | ATCD-d5c3e91779887950d9f5db14f1cd5794ccbfe8f1.tar.gz |
merged in revisions 84573 - 85094 from DOC/Middleware/trunk/TAO
551 files changed, 26020 insertions, 6081 deletions
diff --git a/TAO/MPC/config/bzip2compressor.mpb b/TAO/MPC/config/bzip2compressor.mpb new file mode 100644 index 00000000000..c3f7020dc70 --- /dev/null +++ b/TAO/MPC/config/bzip2compressor.mpb @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +project : taolib, compression, bzip2 { + requires += bzip2 + after += Bzip22Compressor + libs += TAO_Bzip2Compressor +} diff --git a/TAO/MPC/config/lzocompressor.mpb b/TAO/MPC/config/lzocompressor.mpb new file mode 100644 index 00000000000..778d6e25f49 --- /dev/null +++ b/TAO/MPC/config/lzocompressor.mpb @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +project : taolib, compression, lzo1 { + requires += lzo1 + after += LzoCompressor + libs += TAO_LzoCompressor +} diff --git a/TAO/MPC/config/notification_serv.mpb b/TAO/MPC/config/notification_serv.mpb index 08198cb5825..f6f65dc4345 100644 --- a/TAO/MPC/config/notification_serv.mpb +++ b/TAO/MPC/config/notification_serv.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project : orbsvcslib, svc_utils, notification_skel, etcl, dynamicany { +project : orbsvcslib, svc_utils, notification_skel, etcl, dynamicany, messaging { after += CosNotification_Serv libs += TAO_CosNotification_Serv } diff --git a/TAO/MPC/config/tao_versioning_idl_defaults.mpb b/TAO/MPC/config/tao_versioning_idl_defaults.mpb index 0d0352fa5fa..23bc1208716 100644 --- a/TAO/MPC/config/tao_versioning_idl_defaults.mpb +++ b/TAO/MPC/config/tao_versioning_idl_defaults.mpb @@ -6,8 +6,6 @@ // libraries and the orbsvcs libraries. project : taoidldefaults { - - after += TAO_IDL_EXE idlflags += -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/MPC/config/taobaseidldefaults.mpb b/TAO/MPC/config/taobaseidldefaults.mpb index 144520c6e13..5cbc7d26cfd 100644 --- a/TAO/MPC/config/taobaseidldefaults.mpb +++ b/TAO/MPC/config/taobaseidldefaults.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project { +project: build_files { // Set the idl compiler and flags as template values, except for // automake. It has it's own settings in AutomakeWorkspaceHelper.pm and // expects to see $(TAO_IDL) in the generated Makefile.am @@ -4,6 +4,25 @@ PLANNED MAJOR CHANGES "SOMETIME IN THE FUTURE" (i.e., exact beta not known) USER VISIBLE CHANGES BETWEEN TAO-1.6.8 and TAO-1.6.9 ==================================================== +. Reply Dispatchers are refactored. No deadlock occurs when an + (a)synchronous CORBA call is made during dispatching a reply. + +. Fixed IDL compiler bug that in some cases caused code generation for + inherited operations to be skipped. + +. The Transport Cache Size maximum is now a hard maximum. + +. Fixed several bugs related to the purging of transports when the cache + is almost full. + +. New TAO-specific feature of Notification service improves management + of proxies when peer goes away without disconnecting from proxy. See + orbsvcs/Notify_Service/README for details in the svc.conf section. + +. Improved Notification topology persistence, now persists filters. + +. Updated ZIOP to match the beta 1 OMG specification. + USER VISIBLE CHANGES BETWEEN TAO-1.6.7 and TAO-1.6.8 ==================================================== diff --git a/TAO/PROBLEM-REPORT-FORM b/TAO/PROBLEM-REPORT-FORM index 8458c51457f..54e56da83ca 100644 --- a/TAO/PROBLEM-REPORT-FORM +++ b/TAO/PROBLEM-REPORT-FORM @@ -43,8 +43,8 @@ To: tao-bugs@cs.wustl.edu Subject: [area]: [synopsis] - TAO VERSION: 1.6.8 - ACE VERSION: 5.6.8 + TAO VERSION: 1.6.9 + ACE VERSION: 5.6.9 HOST MACHINE and OPERATING SYSTEM: If on Windows based OS's, which version of WINSOCK do you diff --git a/TAO/Release b/TAO/Release index 6fca42f9901..f60ab9f8d44 100644 --- a/TAO/Release +++ b/TAO/Release @@ -37,7 +37,8 @@ CONTROLLED_FILES = \ TAO/MPC \ TAO/tao \ TAO/tests \ - TAO/utils + TAO/utils \ + TAO/etc RELEASE_FILES = $(addprefix ACE_wrappers/,$(CONTROLLED_FILES)) \ ACE_wrappers/TAO/TAO-INSTALL \ diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp index 8aa701b65d0..316c40a5736 100644 --- a/TAO/TAO_IDL/ast/ast_module.cpp +++ b/TAO/TAO_IDL/ast/ast_module.cpp @@ -775,12 +775,28 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i) if (i->added () == 0) { - i->set_added (1); + i->set_added (true); this->add_to_scope (i); } - - // @@ Redefinition of forward. Type check not implemented. -// i->set_full_definition (itf); // @@ Memory leak. + + // If the lookup found the full_definition member of another + // interface_fwd, don't reset this full_definition. Otherwise + // reset the member and set is_defined_ on i so it itf won't + // get destroyed twice. + if (itf->is_defined ()) + { + if (!i->is_defined ()) + { + AST_Interface *prev_fd = i->full_definition (); + prev_fd->destroy (); + // No need to delete prev_fd, the call to + // set_full_definition() below will do it. + } + + i->set_full_definition (itf); + i->set_as_defined (); + } + return i; } diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 9b3ac2fb971..bc031e8d87c 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -2543,10 +2543,7 @@ TAO_CodeGen::destroy (void) delete this->server_inline_; delete this->anyop_source_; delete this->anyop_header_; -#if !defined (linux) && !defined (__QNX__) && !defined (__GLIBC__) - // This causes a seg fault on Linux RH 5.1. Let it leak . . . delete this->gperf_input_stream_; -#endif /* ! linux */ delete [] this->gperf_input_filename_; this->curr_os_ = 0; } diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp index 7471d529168..0d1cd40065e 100644 --- a/TAO/TAO_IDL/be/be_enum.cpp +++ b/TAO/TAO_IDL/be/be_enum.cpp @@ -84,7 +84,7 @@ be_enum::gen_ostream_operator (TAO_OutStream *os) UTL_ScopedName *mname = this->value_to_name (static_cast<unsigned long> (i)); - *os << "case " << i << ": return strm << \"" + *os << "case " << mname << ": return strm << \"" << mname << "\";" << be_nl; } diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp index 2fd7dd18aab..b3307e87c49 100644 --- a/TAO/TAO_IDL/be/be_helper.cpp +++ b/TAO/TAO_IDL/be/be_helper.cpp @@ -147,7 +147,7 @@ TAO_OutStream::stream_type (void) // Return the underlying lowlevel file pointer. // indentation. -FILE * +FILE *& TAO_OutStream::file (void) { return this->fp_; diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 31eeaf19780..bd6dc2a82f9 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -1711,6 +1711,8 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) "fclose"), -1); } + // And reset file to 0 because otherwise there is a problem during destruction of stream. + tao_cg->gperf_input_stream ()->file () = 0; // Open the temp file. #if defined (ACE_OPENVMS) diff --git a/TAO/TAO_IDL/be_include/be_helper.h b/TAO/TAO_IDL/be_include/be_helper.h index 99d5b096063..e0d7253e035 100644 --- a/TAO/TAO_IDL/be_include/be_helper.h +++ b/TAO/TAO_IDL/be_include/be_helper.h @@ -127,7 +127,7 @@ public: TAO_OutStream::STREAM_TYPE stream_type (void); // return the stream type - FILE *file (void); + FILE *&file (void); // Return the underlying lowlevel file pointer. int incr_indent (unsigned short flag = 1); diff --git a/TAO/TAO_IDL/tao_idl.mpc b/TAO/TAO_IDL/tao_idl.mpc index 3a1eec7bcc0..232a217f66f 100644 --- a/TAO/TAO_IDL/tao_idl.mpc +++ b/TAO/TAO_IDL/tao_idl.mpc @@ -87,6 +87,7 @@ project(TAO_IDL_EXE) : aceexe, install, tao_output, crosscompile, mcpp, tao_idl_ libs += TAO_IDL_BE TAO_IDL_FE exeout = $(ACE_ROOT)/bin after += TAO_IDL_BE TAO_IDL_FE gperf + includes += $(TAO_ROOT) specific (automake) { includes += $(srcdir)/include $(srcdir)/be_include $(srcdir)/fe $(TAO_ROOT) @@ -131,6 +132,7 @@ project(TAO_IDL_BE) : acelib, conv_lib, tao_output, crosscompile, tao_vc8warning libs += TAO_IDL_FE dynamicflags = TAO_IDL_BE_BUILD_DLL after += TAO_IDL_FE + includes += $(TAO_ROOT) specific (automake) { includes += $(srcdir)/include $(srcdir)/be_include $(srcdir)/fe @@ -159,6 +161,7 @@ project(TAO_IDL_BE) : acelib, conv_lib, tao_output, crosscompile, tao_vc8warning project(TAO_IDL_FE) : acelib, conv_lib, tao_output, crosscompile, fe_mcpp { sharedname = TAO_IDL_FE dynamicflags = TAO_IDL_FE_BUILD_DLL + includes += $(TAO_ROOT) specific (automake) { includes += $(srcdir)/include $(srcdir)/fe diff --git a/TAO/VERSION b/TAO/VERSION index 4b2705e6601..083823b2913 100644 --- a/TAO/VERSION +++ b/TAO/VERSION @@ -1,4 +1,4 @@ -This is TAO version 1.6.8, released Mon Feb 09 12:01:28 CST 2009 +This is TAO version 1.6.9, released Tue Apr 14 10:06:19 CDT 2009 If you have any problems with or questions about TAO, please send e-mail to the TAO mailing list (tao-users@cs.wustl.edu), using the diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index 9cba579df5c..eb2ba93a4ad 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -116,7 +116,7 @@ TAO/tests/Bug_2869_Regression/run_test.pl: !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_2844_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !FIXED_BUGS_ONLY TAO/tests/Bug_2909_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/Bug_2935_Regression/run_test.pl: !LabVIEW_RT !WinCE !FUZZ -TAO/tests/Bug_2936_Regression/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS !STATIC !LabVIEW_RT !WinCE !FUZZ +TAO/tests/Bug_2936_Regression/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LynxOS !STATIC TAO/tests/Bug_2953_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_2966_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/Bug_3000_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !FIXED_BUGS_ONLY @@ -144,33 +144,40 @@ TAO/tests/Bug_3542_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_C #TAO/tests/Bug_3543_Regression/run_test.pl: !ST TAO/tests/Bug_3548_Regression/run_test.pl: TAO/tests/Bug_3552_Regression/run_test.pl: +TAO/tests/Bug_3553_Regression/run_test.pl: !CORBA_E_MICRO TAO/tests/Bug_3559_Regression/run_test.pl: TAO/tests/Bug_3558_Regression/run_test.pl: TAO/tests/Bug_3565_Regression/run_test.pl: TAO/tests/Bug_3566_Regression/run_test.pl: !FIXED_BUGS_ONLY -TAO/tests/Bug_3567_Regression/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !FIXED_BUGS_ONLY +TAO/tests/Bug_3567_Regression/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO +TAO/tests/Bug_3574_Regression/run_test.pl: +TAO/tests/Bug_3575_Regression/run_test.pl: +TAO/tests/Bug_3597_Regression/run_test.pl: +TAO/tests/Bug_3598a_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS +TAO/tests/Bug_3630_Regression/run_test.pl: !FIXED_BUGS_ONLY +TAO/tests/Bug_3636_Regression/run_test.pl: !FIXED_BUGS_ONLY TAO/tests/DIOP/run_test.pl: !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/DIOP/run_test_ipv6.pl: IPV6 !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/RTCORBA/Activate_Object_Multiple_ORBs/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST -TAO/tests/RTCORBA/Banded_Connections/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Client_Propagated/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Client_Protocol/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !IPV6 !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Collocation/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Explicit_Binding/run_test.pl: !VxWorks !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !IPV6 !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Linear_Priority/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !OpenVMS_IA64Crash !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/ORB_init/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Persistent_IOR/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Policies/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Policy_Combinations/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Priority_Inversion_With_Bands/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !OpenVMS_IA64Crash !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Private_Connection/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Profile_And_Endpoint_Selection/run_test.pl: !VxWorks !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !IPV6 !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/RTMutex/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Server_Declared/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Server_Protocol/run_test.pl: !VxWorks !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !IPV6 !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/RTCORBA/Thread_Pool/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/RTCORBA/Banded_Connections/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Client_Propagated/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Client_Protocol/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !IPV6 !ACE_FOR_TAO +TAO/tests/RTCORBA/Collocation/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Explicit_Binding/run_test.pl: !VxWorks !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !IPV6 !ACE_FOR_TAO +TAO/tests/RTCORBA/Linear_Priority/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST!LynxOS +TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !OpenVMS_IA64Crash +TAO/tests/RTCORBA/ORB_init/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO +TAO/tests/RTCORBA/Persistent_IOR/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Policies/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO!ST +TAO/tests/RTCORBA/Policy_Combinations/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Priority_Inversion_With_Bands/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !OpenVMS_IA64Crash +TAO/tests/RTCORBA/Private_Connection/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO +TAO/tests/RTCORBA/Profile_And_Endpoint_Selection/run_test.pl: !VxWorks!MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !IPV6 !ACE_FOR_TAO +TAO/tests/RTCORBA/RTMutex/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Server_Declared/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST +TAO/tests/RTCORBA/Server_Protocol/run_test.pl: !VxWorks !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !IPV6 !ACE_FOR_TAO +TAO/tests/RTCORBA/Thread_Pool/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO TAO/tests/RTScheduling/VoidData/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS TAO/tests/RTScheduling/Thread_Cancel/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ST !OpenVMS_IA64Crash TAO/tests/RTScheduling/DT_Spawn/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS @@ -258,7 +265,7 @@ TAO/tests/POA/On_Demand_Loading/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_ TAO/tests/POA/Reference_Counted_Servant/run_test.pl: !SUNCC5_1 !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO TAO/tests/POA/Loader/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !KCC_Linux !ACE_FOR_TAO TAO/tests/POA/RootPOA/run_test.pl: -TAO/tests/DiffServ/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/DiffServ/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/IORManipulation/run_test.pl: TAO/tests/IORManipulation/filter/run_test.pl: !LabVIEW_RT !WinCE !FUZZ TAO/tests/Policies/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ @@ -298,7 +305,7 @@ TAO/tests/AMI_Buffering/run_message_count.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E TAO/tests/AMI_Buffering/run_buffer_size.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/AMI_Buffering/run_timeout.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/AMI_Buffering/run_timeout_reactive.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !LabVIEW_RT !WinCE !FUZZ -TAO/tests/Big_AMI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ +TAO/tests/Big_AMI/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO TAO/tests/Big_Oneways/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/Big_Twoways/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/Big_Reply/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ @@ -306,6 +313,7 @@ TAO/tests/Big_Request_Muxing/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E TAO/tests/Oneways_Invoking_Twoways/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/Queued_Message_Test/run_test.pl: TAO/tests/DLL_ORB/run_test.pl: !ST !STATIC !LabVIEW_RT !WinCE !FUZZ +TAO/tests/IDL_Inherited_Operation/run_test.pl TAO/tests/InterOp-Naming/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/Multiple/run_test.pl: !SUNCC5_1 !LabVIEW_RT !WinCE !FUZZ TAO/tests/Exposed_Policies/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ @@ -347,8 +355,8 @@ TAO/tests/Transport_Cache_Manager/run_test.pl TAO/tests/UNKNOWN_Exception/run_test.pl: TAO/tests/Native_Exceptions/run_test.pl: TAO/tests/Servant_To_Reference_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST -TAO/tests/Sequence_Unit_Tests/run_test.pl -noboost: !LabVIEW_RT !WinCE !FUZZ -TAO/tests/Sequence_Unit_Tests/run_test.pl -boost: BOOST !LabVIEW_RT !WinCE !FUZZ +TAO/tests/Sequence_Iterators/run_test.pl: +TAO/tests/Sequence_Unit_Tests/run_test.pl: TAO/tests/Typedef_String_Array/run_test.pl: TAO/tests/GIOP_Fragments/PMB_With_Fragments/run_test.pl: !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !VxWorks_RTP TAO/tests/CodeSets/simple/run_test.pl: !GIOP10 !STATIC !LabVIEW_RT !WinCE !FUZZ @@ -387,7 +395,7 @@ TAO/tests/Parallel_Connect_Strategy/run_test.pl: !QUICK !LabVIEW_RT !WinCE !FUZZ TAO/tests/Parallel_Connect_Strategy/run_test.pl -quick : QUICK !LabVIEW_RT !WinCE !FUZZ !VxWorks55 TAO/tests/DII_Collocation_Tests/oneway/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/DII_Collocation_Tests/twoway/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ -TAO/tests/Compression/run_test.pl: ZLIB +TAO/tests/Compression/run_test.pl TAO/tests/Collocated_Forwarding/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ TAO/tests/ZIOP/run_test.pl: ZIOP ZLIB TAO/DevGuideExamples/BiDirectionalGIOP/run_test.pl: !MINIMUM !CORBA_E_MICRO diff --git a/TAO/bin/tao_other_tests.lst b/TAO/bin/tao_other_tests.lst index de5351ef051..1a1b4123baf 100644 --- a/TAO/bin/tao_other_tests.lst +++ b/TAO/bin/tao_other_tests.lst @@ -52,11 +52,11 @@ TAO/orbsvcs/tests/AVStreams/Simple_Three_Stage/run_test.pl: !MINIMUM !CORBA_E_CO TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/AVStreams/Component_Switching/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/tests/Bug_1334_Regression/run_test.pl: !ACE_FOR_TAO !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/Bug_1395_Regression/run_test.pl: !LynxOS !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_MESSAGING !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/Bug_1437_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_MESSAGING !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ -TAO/orbsvcs/tests/Bug_1630_Regression/run_test.pl: !NO_IFR !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR +TAO/orbsvcs/tests/Bug_1395_Regression/run_test.pl: !LynxOS !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_MESSAGING !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR +TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR +TAO/orbsvcs/tests/Bug_1437_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_MESSAGING !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR +TAO/orbsvcs/tests/Bug_1630_Regression/run_test.pl: !NO_IFR !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR TAO/orbsvcs/tests/Bug_2074_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !NO_MESSAGING !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Bug_2247_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Bug_2248_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ @@ -72,6 +72,7 @@ TAO/orbsvcs/tests/Bug_3215_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CO TAO/orbsvcs/tests/Bug_3216_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Bug_3418_Regression/run_test.pl: !ST SSL !STATIC !DISABLE_INTERCEPTORS !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Bug_3486_Regression/run_test.pl: !NO_MESSAGING !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !LynxOS !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/CosEvent/Basic/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/HTIOP/Hello/run_test.pl: !NO_UUID !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/tests/HTIOP/AMI/run_test.pl: !NO_UUID !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ @@ -118,7 +119,7 @@ TAO/orbsvcs/tests/ImplRepo/scale/run_test.pl -servers 5 -objects 5: !MINIMUM !CO TAO/orbsvcs/tests/ImplRepo/Bug_689_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/examples/ImR/Combined_Service/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ST !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS -TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !WCHAR TAO/orbsvcs/tests/CosEvent/Timeout/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !NO_MESSAGING !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/tests/Log/Basic_Log_Test/run_test.pl: !NO_MESSAGING !ACE_FOR_TAO !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Notify/Basic/run_test.pl notify.reactive.conf: !ST !NO_MESSAGING !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS @@ -145,6 +146,10 @@ TAO/orbsvcs/tests/Notify/Structured_Multi_Filter/run_test.pl: !ST !NO_MESSAGING TAO/orbsvcs/tests/Notify/Reconnecting/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ !LynxOS TAO/orbsvcs/tests/Notify/XML_Persistence/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/Notify/Persistent_POA/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ +TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl -p: !ST !NO_MESSAGING !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ACE_FOR_TAO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ TAO/orbsvcs/tests/EC_Mcast/run_test.pl: !NO_MCAST !NO_MESSAGING !DISABLE_ToFix_LynxOS_PPC !ACE_FOR_TAO !CORBA_E_MICRO !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ # FAILS 'TAO/orbsvcs/tests/EC_Multiple/run_test.pl !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ # NO REDIRECTION TAO/examples/Simple/echo/run_test.pl < Echo.idl !VxWorks !VxWorks_RTP !LabVIEW_RT !WinCE !FUZZ diff --git a/TAO/configure.ac b/TAO/configure.ac index 1fbc4c6a22e..0f3f8804474 100644 --- a/TAO/configure.ac +++ b/TAO/configure.ac @@ -508,6 +508,7 @@ if test $tao_build_tests = yes; then orbsvcs/tests/Notify/MC/Makefile orbsvcs/tests/Notify/MT_Dispatching/Makefile orbsvcs/tests/Notify/Ordering/Makefile + orbsvcs/tests/Notify/Persistent_Filter/Makefile orbsvcs/tests/Notify/Persistent_POA/Makefile orbsvcs/tests/Notify/PluggableTopology/Makefile orbsvcs/tests/Notify/RT_lib/Makefile @@ -523,6 +524,7 @@ if test $tao_build_tests = yes; then orbsvcs/tests/Notify/performance-tests/RedGreen/Makefile orbsvcs/tests/Notify/performance-tests/Throughput/Makefile orbsvcs/tests/Notify/Timeout/Makefile + orbsvcs/tests/Notify/Validate_Client/Makefile orbsvcs/tests/Property/Makefile orbsvcs/tests/Redundant_Naming/Makefile orbsvcs/tests/Sched/Makefile diff --git a/TAO/docs/ZIOP.pdf b/TAO/docs/ZIOP.pdf Binary files differdeleted file mode 100644 index 6104c6b67d0..00000000000 --- a/TAO/docs/ZIOP.pdf +++ /dev/null diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Admin.cpp b/TAO/docs/tutorials/Quoter/RTCORBA/Admin.cpp index c6de33c1e84..392eddde61a 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Admin.cpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Admin.cpp @@ -113,11 +113,11 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (parse_args (argc, argv) != 0) return 1; - CORBA::Object_var obj = get_distributor_reference (orb); + CORBA::Object_var obj = get_distributor_reference (orb.in ()); // Narrow the IOR to a Stock_Distributor object reference. Stock::StockDistributor_var stock_distributor = - Stock::StockDistributor::_narrow(obj); + Stock::StockDistributor::_narrow(obj.in ()); if (CORBA::is_nil (stock_distributor.in ())) ACE_ERROR_RETURN ((LM_DEBUG, diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp b/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp index 7ba921f579d..e93a1a5aaf8 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Broker.cpp @@ -137,18 +137,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Get a reference to the RootPOA. CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (obj); + PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in ()); // Activate the POAManager. PortableServer::POAManager_var mgr = poa->the_POAManager (); mgr->activate (); // Read and destringify the Stock_Distributor object's IOR. - obj = get_distributor_reference (orb); + obj = get_distributor_reference (orb.in ()); // Narrow the IOR to a Stock_Distributor object reference. Stock::StockDistributor_var stock_distributor = - Stock::StockDistributor::_narrow (obj); + Stock::StockDistributor::_narrow (obj.in ()); if (CORBA::is_nil (stock_distributor.in ())) ACE_ERROR_RETURN ((LM_DEBUG, @@ -159,7 +159,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Create an instance of the <StockBroker>. // Create the factory object. Create a <Stock::StockBroker>. - Stock_StockBrokerHome_i stock_broker_home (orb); + Stock_StockBrokerHome_i stock_broker_home (orb.in ()); Stock::StockBroker_var stock_broker = stock_broker_home.create (stock_distributor.in (), stock_name.c_str ()); @@ -176,7 +176,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Subscribe the consumer with the distributor. ::Stock::Cookie_var cookie = - stock_distributor->subscribe_notifier (consumer, priority_level); + stock_distributor->subscribe_notifier (consumer.in (), priority_level); consumer->cookie (cookie.in ()); @@ -191,7 +191,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -1); // Stash the stock_quoter object reference away for later use. - stock_broker->connect_quoter_info (stock_quoter); + stock_broker->connect_quoter_info (stock_quoter.in ()); // Run the event loop. ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Broker_i.cpp b/TAO/docs/tutorials/Quoter/RTCORBA/Broker_i.cpp index afb1f746139..a454c7be833 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Broker_i.cpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Broker_i.cpp @@ -41,12 +41,12 @@ Stock_StockBroker_i::Stock_StockBroker_i (CORBA::ORB_ptr orb, // Stock_StockNameConsumer_i will be activated under this POA. PortableServer::POA_var child_poa = poa->create_POA ("StockNameConsumer_POA", - poa_mgr, + poa_mgr. in(), consumer_policies); // Narrow the POA to a <RTPortableServer::POA>. RTPortableServer::POA_var rt_poa = - RTPortableServer::POA::_narrow (child_poa); + RTPortableServer::POA::_narrow (child_poa.in ()); // Create and activate the <consumer_>. this->consumer_ = @@ -81,7 +81,7 @@ void Stock_StockBroker_i::connect_quoter_info (::Stock::StockQuoter_ptr c) ::Stock::StockQuoter_ptr Stock_StockBroker_i::get_connection_quoter_info () { - return Stock::StockQuoter::_duplicate (this->quoter_); + return Stock::StockQuoter::_duplicate (this->quoter_.in ()); } void @@ -142,7 +142,7 @@ Stock_StockBrokerHome_i::create (Stock::StockDistributor_ptr dist, // mechanisms, we can activate it under the <default_POA>, which // is the <RootPOA>. Stock_StockBroker_i *broker = - new Stock_StockBroker_i (orb_, dist, stock_name); + new Stock_StockBroker_i (orb_.in (), dist, stock_name); PortableServer::ServantBase_var owner_transfer = broker; this->broker_ = broker->_this (); diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/StockNameConsumer_i.cpp b/TAO/docs/tutorials/Quoter/RTCORBA/StockNameConsumer_i.cpp index e64df8236c5..2d55eeffdc2 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/StockNameConsumer_i.cpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/StockNameConsumer_i.cpp @@ -23,7 +23,7 @@ void Stock_StockNameConsumer_i::push_StockName (::Stock::StockNames *the_stockna i < the_stockname->names ().length (); ++i) { - if (ACE_OS::strcmp (this->stock_name_, + if (ACE_OS::strcmp (this->stock_name_.in (), the_stockname->names ()[i]) == 0) { // Get the quoter for the connection from the <context_>. diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/StockQuoter.mpc b/TAO/docs/tutorials/Quoter/RTCORBA/StockQuoter.mpc index 4290ee0880e..53941a7d2d3 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/StockQuoter.mpc +++ b/TAO/docs/tutorials/Quoter/RTCORBA/StockQuoter.mpc @@ -35,7 +35,7 @@ project(RTCORBA_Quoter_Common): negotiate_codesets, rtportableserver, rtcorba, t } } -project(RTCORBA_Quoter_Admin): valuetype, rt_client, naming, stl { +project(RTCORBA_Quoter_Admin): valuetype, rt_server, naming, stl { after = RTCORBA_Quoter_Common libs += RTCORBA_Quoter_Common exename = admin diff --git a/TAO/etc/tao.doxygen b/TAO/etc/tao.doxygen new file mode 100644 index 00000000000..6dcab74afca --- /dev/null +++ b/TAO/etc/tao.doxygen @@ -0,0 +1,166 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao +FILE_PATTERNS = *.cpp *.h *.i *.inl *.idl *.pidl *.txt +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../ace +GENERATE_TAGFILE = html/tao/TAO.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_anytypecode.doxygen b/TAO/etc/tao_anytypecode.doxygen new file mode 100644 index 00000000000..5b0ba14cabb --- /dev/null +++ b/TAO/etc/tao_anytypecode.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_AnyTypeCode +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/AnyTypeCode +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/anytypecode +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/anytypecode/TAO_AnyTypeCode.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_av.doxygen b/TAO/etc/tao_av.doxygen new file mode 100644 index 00000000000..77d453277ff --- /dev/null +++ b/TAO/etc/tao_av.doxygen @@ -0,0 +1,171 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_AV +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/AVStreams.idl \ + TAO/orbsvcs/orbsvcs/Null_MediaCtrl.idl \ + TAO/orbsvcs/orbsvcs/sfp.idl \ + TAO/orbsvcs/orbsvcs/AV +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/av +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/av/TAO_AV.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_compression.doxygen b/TAO/etc/tao_compression.doxygen new file mode 100644 index 00000000000..42f603a7960 --- /dev/null +++ b/TAO/etc/tao_compression.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_Compression +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/Compression +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/compression +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/compression/TAO_Compression.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_cosevent.doxygen b/TAO/etc/tao_cosevent.doxygen new file mode 100644 index 00000000000..6de998f6db5 --- /dev/null +++ b/TAO/etc/tao_cosevent.doxygen @@ -0,0 +1,172 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_CosEvent +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = \ + TAO/orbsvcs/orbsvcs/CosEventComm.idl \ + TAO/orbsvcs/orbsvcs/CosEventChannelAdmin.idl \ + TAO/orbsvcs/orbsvcs/CosEvent +FILE_PATTERNS = CEC_*.cpp CEC_*.h CEC_*.inl CEC_*.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/cosevent +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver \ + html/tao/esf/TAO_ESF.tag=../esf +GENERATE_TAGFILE = html/tao/cosevent/TAO_CosEvent.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_cosnaming.doxygen b/TAO/etc/tao_cosnaming.doxygen new file mode 100644 index 00000000000..f62f4608202 --- /dev/null +++ b/TAO/etc/tao_cosnaming.doxygen @@ -0,0 +1,168 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_CosNaming +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/CosNaming.idl \ + TAO/orbsvcs/orbsvcs/Naming +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/cosnaming +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/cosnaming/TAO_CosNaming.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_cosnotification.doxygen b/TAO/etc/tao_cosnotification.doxygen new file mode 100644 index 00000000000..83339211e3a --- /dev/null +++ b/TAO/etc/tao_cosnotification.doxygen @@ -0,0 +1,178 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_CosNotification +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +INTERNAL_DOCS = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = \ + TAO/orbsvcs/orbsvcs/CosNotification.idl \ + TAO/orbsvcs/orbsvcs/CosNotifyFilter.idl \ + TAO/orbsvcs/orbsvcs/CosNotifyComm.idl \ + TAO/orbsvcs/orbsvcs/CosNotifyChannelAdmin.idl \ + TAO/orbsvcs/orbsvcs/Notify \ + TAO/orbsvcs/orbsvcs/Notify/Any \ + TAO/orbsvcs/orbsvcs/Notify/Sequence \ + TAO/orbsvcs/orbsvcs/Notify/Structured +FILE_PATTERNS = *.cpp *.h *.inl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/cosnotification +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver \ + html/tao/cosevent/TAO_CosEvent.tag=../cosevent \ + html/tao/esf/TAO_ESF.tag=../esf +GENERATE_TAGFILE = html/tao/cosnotification/TAO_CosNotification.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_costime.doxygen b/TAO/etc/tao_costime.doxygen new file mode 100644 index 00000000000..dbb59ccfb09 --- /dev/null +++ b/TAO/etc/tao_costime.doxygen @@ -0,0 +1,169 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_CosTime +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/TimeService.idl \ + TAO/orbsvcs/orbsvcs/Time +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/costime +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/costime/TAO_CosTime.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_costrader.doxygen b/TAO/etc/tao_costrader.doxygen new file mode 100644 index 00000000000..e2f06cb87ef --- /dev/null +++ b/TAO/etc/tao_costrader.doxygen @@ -0,0 +1,172 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_CosTrader +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = \ + TAO/orbsvcs/orbsvcs/CosTrading.idl \ + TAO/orbsvcs/orbsvcs/CosTradingDynamic.idl \ + TAO/orbsvcs/orbsvcs/CosTradingRepos.idl \ + TAO/orbsvcs/orbsvcs/Trader +FILE_PATTERNS = *.cpp *.h *.inl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/costrader +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/costrader/TAO_CosTrader.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_dynamicany.doxygen b/TAO/etc/tao_dynamicany.doxygen new file mode 100644 index 00000000000..01eda2d7061 --- /dev/null +++ b/TAO/etc/tao_dynamicany.doxygen @@ -0,0 +1,167 @@ + +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_DynamicAny +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/DynamicAny +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/dynamicany +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/dynamicany/TAO_DynamicAny.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_dynamicinterface.doxygen b/TAO/etc/tao_dynamicinterface.doxygen new file mode 100644 index 00000000000..6243ff13dd5 --- /dev/null +++ b/TAO/etc/tao_dynamicinterface.doxygen @@ -0,0 +1,166 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_DynamicInterface +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/DynamicInterface +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/dynamicinterface +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/dynamicinterface/TAO_DynamicInterface.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_esf.doxygen b/TAO/etc/tao_esf.doxygen new file mode 100644 index 00000000000..4f2d8610aed --- /dev/null +++ b/TAO/etc/tao_esf.doxygen @@ -0,0 +1,168 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_ESF +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/ESF +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/esf +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/esf/TAO_ESF.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_ifr.doxygen b/TAO/etc/tao_ifr.doxygen new file mode 100644 index 00000000000..8fd1276fe98 --- /dev/null +++ b/TAO/etc/tao_ifr.doxygen @@ -0,0 +1,170 @@ +# Doxyfile 1.3.4 +# +# $Id$ +# + +PROJECT_NAME = TAO_IFR +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/IFR_Service +FILE_PATTERNS = *.cpp *.h +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/ifr +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver \ + html/tao/iortable/TAO_IORTable.tag=../iortable \ + html/tao/cosnaming/TAO_CosNaming.tag=../cosnaming +GENERATE_TAGFILE = html/tao/ifr/TAO_IFR.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_implrepo.doxygen b/TAO/etc/tao_implrepo.doxygen new file mode 100644 index 00000000000..2bb987d4528 --- /dev/null +++ b/TAO/etc/tao_implrepo.doxygen @@ -0,0 +1,169 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_Implementation_Repository +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/ImplRepo_Service +FILE_PATTERNS = *.cpp *.h *.inl *.txt +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/implrepo_service +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver \ + html/tao/iortable/TAO_IORTable.tag=../iortable +GENERATE_TAGFILE = html/tao/implrepo_service/TAO_ImplRepo.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_iormanip.doxygen b/TAO/etc/tao_iormanip.doxygen new file mode 100644 index 00000000000..98a7bde7267 --- /dev/null +++ b/TAO/etc/tao_iormanip.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_IORManipulation +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/IORManipulation +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/iormanipulation +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/iormanipulation/TAO_IORManipulation.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_iortable.doxygen b/TAO/etc/tao_iortable.doxygen new file mode 100644 index 00000000000..6cf306684b8 --- /dev/null +++ b/TAO/etc/tao_iortable.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_IORTable +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/IORTable +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/iortable +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/iortable/TAO_IORTable.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_pi.doxygen b/TAO/etc/tao_pi.doxygen new file mode 100644 index 00000000000..e9a13c2df9e --- /dev/null +++ b/TAO/etc/tao_pi.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_PI +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/PI +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/pi +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/pi/TAO_PI.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_pi_server.doxygen b/TAO/etc/tao_pi_server.doxygen new file mode 100644 index 00000000000..b6a990f9488 --- /dev/null +++ b/TAO/etc/tao_pi_server.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_PI_Server +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/PI_Server +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/pi_server +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/pi_server/TAO_PI_Server.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_portablegroup.doxygen b/TAO/etc/tao_portablegroup.doxygen new file mode 100644 index 00000000000..072805a4332 --- /dev/null +++ b/TAO/etc/tao_portablegroup.doxygen @@ -0,0 +1,171 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_PortableGroup +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = \ + TAO/orbsvcs/orbsvcs/miop.idl \ + TAO/orbsvcs/orbsvcs/PortableGroup.idl \ + TAO/orbsvcs/orbsvcs/PortableGroup +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/portablegroup +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/portablegroup/TAO_PortableGroup.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_portableserver.doxygen b/TAO/etc/tao_portableserver.doxygen new file mode 100644 index 00000000000..da3c86075f9 --- /dev/null +++ b/TAO/etc/tao_portableserver.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_PortableServer +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/PortableServer +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/portableserver +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/portableserver/TAO_PortableServer.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_pss.doxygen b/TAO/etc/tao_pss.doxygen new file mode 100644 index 00000000000..6a1e7d7b62e --- /dev/null +++ b/TAO/etc/tao_pss.doxygen @@ -0,0 +1,168 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_PSS +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/PSS +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/pss +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/pss/TAO_PSS.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_rtcorba.doxygen b/TAO/etc/tao_rtcorba.doxygen new file mode 100644 index 00000000000..50dd2d1ae1e --- /dev/null +++ b/TAO/etc/tao_rtcorba.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_RTCORBA +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/RTCORBA +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/rtcorba +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/rtcorba/TAO_RTCORBA.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_rtevent.doxygen b/TAO/etc/tao_rtevent.doxygen new file mode 100644 index 00000000000..6fc2a302953 --- /dev/null +++ b/TAO/etc/tao_rtevent.doxygen @@ -0,0 +1,178 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_RTEvent +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/RtecEventComm.idl \ + TAO/orbsvcs/orbsvcs/RtecEventChannelAdmin.idl \ + TAO/orbsvcs/orbsvcs/RtecBase.idl \ + TAO/orbsvcs/orbsvcs/RtecDefaultEventData.idl \ + TAO/orbsvcs/orbsvcs/RtecUDPAdmin.idl \ + TAO/orbsvcs/orbsvcs/Event_Utilities.h \ + TAO/orbsvcs/orbsvcs/Event_Utilities.inl \ + TAO/orbsvcs/orbsvcs/Event_Utilities.cpp \ + TAO/orbsvcs/orbsvcs/Event_Service_Constants.h \ + TAO/orbsvcs/orbsvcs/Event +FILE_PATTERNS = EC_*.cpp EC_*.h EC_*.inl EC_*.pidl ECG_*.cpp ECG_*.h *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/rtevent +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO/orbsvcs TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver \ + html/tao/esf/TAO_ESF.tag=../esf +GENERATE_TAGFILE = html/tao/rtevent/TAO_RTEvent.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_rtportableserver.doxygen b/TAO/etc/tao_rtportableserver.doxygen new file mode 100644 index 00000000000..4426460a78d --- /dev/null +++ b/TAO/etc/tao_rtportableserver.doxygen @@ -0,0 +1,167 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_RTPortableServer +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/RTPortableServer +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/rtportableserver +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/rtportableserver/TAO_RTPortableServer.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_security.doxygen b/TAO/etc/tao_security.doxygen new file mode 100644 index 00000000000..68349c96ef7 --- /dev/null +++ b/TAO/etc/tao_security.doxygen @@ -0,0 +1,173 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_Security +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/Security.idl \ + TAO/orbsvcs/orbsvcs/SecurityLevel1.idl \ + TAO/orbsvcs/orbsvcs/SecurityLevel2.idl \ + TAO/orbsvcs/orbsvcs/SecurityAdmin.idl \ + TAO/orbsvcs/orbsvcs/SecurityReplaceable.idl \ + TAO/orbsvcs/orbsvcs/Security +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/security +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver +GENERATE_TAGFILE = html/tao/security/TAO_Security.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_smartproxies.doxygen b/TAO/etc/tao_smartproxies.doxygen new file mode 100644 index 00000000000..0d32961d09e --- /dev/null +++ b/TAO/etc/tao_smartproxies.doxygen @@ -0,0 +1,166 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_SmartProxies +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/SmartProxies +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = TAO_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/smartproxies +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/smartproxies/TAO_SmartProxies.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_ssliop.doxygen b/TAO/etc/tao_ssliop.doxygen new file mode 100644 index 00000000000..92e65d67093 --- /dev/null +++ b/TAO/etc/tao_ssliop.doxygen @@ -0,0 +1,174 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_SSLIOP +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/orbsvcs/orbsvcs/Security.idl \ + TAO/orbsvcs/orbsvcs/SecurityLevel1.idl \ + TAO/orbsvcs/orbsvcs/SecurityLevel2.idl \ + TAO/orbsvcs/orbsvcs/Security \ + TAO/orbsvcs/orbsvcs/SSLIOP.idl \ + TAO/orbsvcs/orbsvcs/SSLIOP +FILE_PATTERNS = *.cpp *.h *.inl *.pidl *.idl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/ssliop +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/portableserver/TAO_PortableServer.tag=../portableserver \ + html/tao/security/TAO_Security.tag=../security +GENERATE_TAGFILE = html/tao/ssliop/TAO_SSLIOP.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_strategies.doxygen b/TAO/etc/tao_strategies.doxygen new file mode 100644 index 00000000000..e82d23c768f --- /dev/null +++ b/TAO/etc/tao_strategies.doxygen @@ -0,0 +1,166 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_Strategies +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/Strategies +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/strategies +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace html/tao/TAO.tag=.. +GENERATE_TAGFILE = html/tao/strategies/TAO_Strategies.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_transportcurrent.doxygen b/TAO/etc/tao_transportcurrent.doxygen new file mode 100644 index 00000000000..998122cb32d --- /dev/null +++ b/TAO/etc/tao_transportcurrent.doxygen @@ -0,0 +1,168 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_TransportCurrent +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/TransportCurrent +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/transportcurrent +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/pi/TAO_PI.tag=../pi +GENERATE_TAGFILE = html/tao/transportcurrent/TAO_TransportCurrent.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/etc/tao_ziop.doxygen b/TAO/etc/tao_ziop.doxygen new file mode 100644 index 00000000000..a81965b7aec --- /dev/null +++ b/TAO/etc/tao_ziop.doxygen @@ -0,0 +1,168 @@ +# Doxyfile 1.1.5 +# +# $Id$ +# + +PROJECT_NAME = TAO_ZIOP +PROJECT_NUMBER = Snapshot +OUTPUT_DIRECTORY = . +OUTPUT_LANGUAGE = English +DISABLE_INDEX = NO +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CLASS_DIAGRAMS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = YES +TAB_SIZE = 8 +ENABLED_SECTIONS = +SHORT_NAMES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +INPUT = TAO/tao/ZIOP +FILE_PATTERNS = *.cpp *.h *.inl *.pidl +RECURSIVE = +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +GENERATE_HTML = YES +HTML_OUTPUT = html/tao/ziop +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = TAO . +PREDEFINED = __ACE_INLINE__ \ + ACE_TEMPLATES_REQUIRE_SOURCE \ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ + ACE_END_VERSIONED_NAMESPACE_DECL \ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + TAO_END_VERSIONED_NAMESPACE_DECL \ + ACE_INLINE +EXPAND_AS_DEFINED = ACE_RCSID \ + ACE_UNIMPLEMENTED_FUNC \ + ACE_CACHE_MAP_MANAGER \ + ACE_THROW_SPEC + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +TAGFILES = html/ace/ACE.tag=../../ace \ + html/tao/TAO.tag=.. \ + html/tao/compression/TAO_Compression.tag=../compression +GENERATE_TAGFILE = html/tao/ziop/TAO_ZIOP.tag +ALLEXTERNALS = NO +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz + +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_MULTI_TARGETS = YES +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +SEARCHENGINE = YES + diff --git a/TAO/examples/AMI/FL_Callback/Progress_i.cpp b/TAO/examples/AMI/FL_Callback/Progress_i.cpp index d998c68fc29..d0994ce93b7 100644 --- a/TAO/examples/AMI/FL_Callback/Progress_i.cpp +++ b/TAO/examples/AMI/FL_Callback/Progress_i.cpp @@ -2,8 +2,8 @@ #include "Progress_i.h" -#include <FL/Fl_Slider.h> -#include <FL/Fl_Button.h> +#include <FL/Fl_Slider.H> +#include <FL/Fl_Button.H> ACE_RCSID (FL_Cube, test_i, diff --git a/TAO/examples/AMI/FL_Callback/Progress_i.h b/TAO/examples/AMI/FL_Callback/Progress_i.h index 7d9c8fbe9ee..1b17a0b95d5 100644 --- a/TAO/examples/AMI/FL_Callback/Progress_i.h +++ b/TAO/examples/AMI/FL_Callback/Progress_i.h @@ -18,7 +18,7 @@ #include "testS.h" -#include <FL/Fl_Box.h> +#include <FL/Fl_Box.H> class Progress_Window : public Fl_Box { diff --git a/TAO/examples/AMI/FL_Callback/progress.cpp b/TAO/examples/AMI/FL_Callback/progress.cpp index 34c6eb68dd1..a1363e7a56d 100644 --- a/TAO/examples/AMI/FL_Callback/progress.cpp +++ b/TAO/examples/AMI/FL_Callback/progress.cpp @@ -9,8 +9,8 @@ ACE_RCSID (FL_Callback, progress, "$Id$") -#include <FL/Fl.h> -#include <FL/Fl_Window.h> +#include <FL/Fl.H> +#include <FL/Fl_Window.H> const ACE_TCHAR *ior_output_file = ACE_TEXT("progress.ior"); int n_iterations = 1000; diff --git a/TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc b/TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc new file mode 100644 index 00000000000..468c4508383 --- /dev/null +++ b/TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc @@ -0,0 +1,34 @@ +// -*- MPC -*- +// $Id$ + +project(*idl) : taoclient { + IDL_Files { + CCS.idl + } + custom_only = 1 +} + +project(*client) : taoclient { + after += *idl + source_files { + client.cpp + CCSC.cpp + } + IDL_Files { + } +} + +project(*server) : taoserver { + requires += dummy_label + after += *idl + source_files { + server.cpp + icp.cpp + CCSC.cpp + CCSS.cpp + } + IDL_Files { + } +} + + diff --git a/TAO/examples/Advanced/ch_12/client.cpp b/TAO/examples/Advanced/ch_12/client.cpp index 0dab785902d..d6e85f69ef8 100644 --- a/TAO/examples/Advanced/ch_12/client.cpp +++ b/TAO/examples/Advanced/ch_12/client.cpp @@ -19,12 +19,8 @@ // // ============================================================================ -#include "CCSC.h" // ORB-specific - -// The following headers are #included automatically by ACE+TAO. -// Therefore, they don't need to be included explicitly. -#include <iostream> -// #include <fstream.h> +#include "CCSC.h" // ORB-specific +#include <ace/streams.h> using namespace std; @@ -169,7 +165,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) catch (const CORBA::SystemException &se) { std::cerr << "Cannot narrow controller reference: " - //<< se + << se << std::endl; throw 0; } @@ -205,7 +201,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Show details for each device. for ( i = 0; i < list->length (); i++) - std::cout << list[i]; + { + CCS::Thermometer_ptr ti = list[i]; + std::cout << ti; + } std::cout << std::endl; @@ -217,7 +216,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Check that the location was updated std::cout << "New details for device " << anum << " are:" << std::endl; - std::cout << list[0u] << std::endl; + CCS::Thermometer_ptr tx = list[0u]; + std::cout << tx << std::endl; // Find first thermostat in list. CCS::Thermostat_var tmstat; @@ -290,7 +290,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } diff --git a/TAO/examples/Advanced/ch_12/icp.cpp b/TAO/examples/Advanced/ch_12/icp.cpp index ed686022691..8b8d4ceaa07 100644 --- a/TAO/examples/Advanced/ch_12/icp.cpp +++ b/TAO/examples/Advanced/ch_12/icp.cpp @@ -45,9 +45,9 @@ typedef map<unsigned long, DeviceState> StateMap; const size_t MAXSTR = 32; // Max len of string including NUL -const short MIN_TEMP = 40; // 40 F == 4.44 C -const short MAX_TEMP = 90; // 90 F == 32.22 C -const short DFLT_TEMP = 68; // 68 F == 20.00 C +const long MIN_TEMP = 40; // 40 F == 4.44 C +const long MAX_TEMP = 90; // 90 F == 32.22 C +const long DFLT_TEMP = 68; // 68 F == 20.00 C static StateMap dstate; // Map of known devices @@ -118,15 +118,10 @@ ICP_offline (unsigned long id) // exact temperature: 40% static -short -vary_temp (short temp) +long +vary_temp (long temp) { - #if defined (__BORLANDC__) || defined (_MSC_VER) - long r = ACE_OS::rand() % 50; - #else - long r = lrand48() % 50; - #endif - + long r = ACE_OS::rand() % 50; long delta; if (r < 5) delta = 3; @@ -137,12 +132,7 @@ vary_temp (short temp) else delta = 0; - #if defined (__BORLANDC__) || defined (_MSC_VER) - if (ACE_OS::rand() % 2) - #else - if (lrand48() % 2) - #endif - + if (ACE_OS::rand() % 2) delta = -delta; return temp + delta; @@ -179,7 +169,7 @@ private: // determined by vary_temp (). static -short +long actual_temp (const StateMap::iterator & pos) { long sum = 0; @@ -245,20 +235,20 @@ ICP_get (unsigned long id, if (pos->second.type != thermostat) return -1; // Must be thermostat ACE_OS::memcpy (value, &pos->second.nominal_temp, - std::min (len, sizeof (pos->second.nominal_temp))); + ace_min (len, sizeof (pos->second.nominal_temp))); } else if (ACE_OS::strcmp (attr, "temperature") == 0) { - short temp = actual_temp (pos); - ACE_OS::memcpy (value, &temp, std::min (len, sizeof (temp))); + long temp = actual_temp (pos); + ACE_OS::memcpy (value, &temp, ace_min (len, sizeof (temp))); } else if (ACE_OS::strcmp (attr, "MIN_TEMP") == 0) { - ACE_OS::memcpy (value, &MIN_TEMP, std::min (len, sizeof (MIN_TEMP))); + ACE_OS::memcpy (value, &MIN_TEMP, ace_min (len, sizeof (MIN_TEMP))); } else if (ACE_OS::strcmp (attr, "MAX_TEMP") == 0) { - ACE_OS::memcpy (value, &MAX_TEMP, std::min (len, sizeof (MAX_TEMP))); + ACE_OS::memcpy (value, &MAX_TEMP, ace_min (len, sizeof (MAX_TEMP))); } else { diff --git a/TAO/examples/Advanced/ch_12/icp.h b/TAO/examples/Advanced/ch_12/icp.h index 5029a06803d..fc080d49823 100644 --- a/TAO/examples/Advanced/ch_12/icp.h +++ b/TAO/examples/Advanced/ch_12/icp.h @@ -22,7 +22,9 @@ #ifndef _ICP_H #define _ICP_H -extern "C" +#include "ace/OS.h" + +extern "C" { int ICP_online (unsigned long id); // Add device int ICP_offline (unsigned long id); // Remove device @@ -33,11 +35,9 @@ extern "C" void *value, size_t len); // Set attribute - int ICP_set (unsigned long id, + int ICP_set (unsigned long id, const char *attr, const void *value); } -size_t min(const size_t len1, const size_t len2); - #endif /* _ICP_H */ diff --git a/TAO/examples/Advanced/ch_12/server.cpp b/TAO/examples/Advanced/ch_12/server.cpp index c74036b9b7e..e81977633ce 100644 --- a/TAO/examples/Advanced/ch_12/server.cpp +++ b/TAO/examples/Advanced/ch_12/server.cpp @@ -19,8 +19,7 @@ // // ============================================================================ -#include <iostream> -#include <fstream> +#include <ace/streams.h> #include <strstream> #include "server.h" #include <algorithm> @@ -686,7 +685,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } diff --git a/TAO/examples/Advanced/ch_12/server.h b/TAO/examples/Advanced/ch_12/server.h index 919360f7586..5a5a3729fd2 100644 --- a/TAO/examples/Advanced/ch_12/server.h +++ b/TAO/examples/Advanced/ch_12/server.h @@ -27,6 +27,8 @@ #include "assert.h" #include <map> #include <list> +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantLocatorC.h" using namespace std; diff --git a/TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc b/TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc new file mode 100644 index 00000000000..c61eb267c20 --- /dev/null +++ b/TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc @@ -0,0 +1,34 @@ +// -*- MPC -*- +// $Id$ + +project(*idl) : taoclient { + IDL_Files { + CCS.idl + } + custom_only = 1 +} + +project(*client) : taoclient, naming { + after += *idl + source_files { + client.cpp + CCSC.cpp + } + IDL_Files { + } +} + +project(*server) : taoserver, naming, avoids_corba_e_micro, avoids_corba_e_compact { + requires += dummy_label + after += *idl + source_files { + server.cpp + icp.cpp + CCSC.cpp + CCSS.cpp + } + IDL_Files { + } +} + + diff --git a/TAO/examples/Advanced/ch_18/client.cpp b/TAO/examples/Advanced/ch_18/client.cpp index 1d0b8d50ecf..2b85967e1bc 100644 --- a/TAO/examples/Advanced/ch_18/client.cpp +++ b/TAO/examples/Advanced/ch_18/client.cpp @@ -17,11 +17,10 @@ // // ============================================================================ -#include "CCSC.h" // ORB-specific -#include "assert.h" -#include <orbsvcs/CosNamingC.h> -#include <iostream> -// #include <fstream.h> +#include "CCSC.h" // ORB-specific +#include "assert.h" +#include <orbsvcs/CosNamingC.h> +#include <ace/streams.h> // ---------------------------------------------------------------- using namespace std; @@ -40,7 +39,7 @@ resolve_init(CORBA::ORB_ptr orb, const char * id) catch (const CORBA::Exception & e) { std::cerr << "Cannot get initial reference for " << id << ": " - //<< e + << e << std::endl; throw 0; } @@ -53,7 +52,7 @@ resolve_init(CORBA::ORB_ptr orb, const char * id) catch (const CORBA::Exception & e) { std::cerr << "Cannot narrow reference for " << id << ": " - //<< e + << e << std::endl; throw 0; } @@ -82,7 +81,7 @@ resolve_name( } catch (const CORBA::Exception & e) { std::cerr << "Cannot resolve binding: " - //<< e + << e << std::endl; throw 0; } @@ -97,7 +96,7 @@ resolve_name( } catch (const CORBA::Exception & e) { std::cerr << "Cannot narrow reference: " - //<< e + << e << std::endl; throw 0; } @@ -280,7 +279,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) list = ctrl->list(); // Show details for each device. for ( i = 0; i < list->length(); i++) - std::cout << list[i]; + { + CCS::Thermometer_ptr ti = list[i]; + std::cout << ti; + } std::cout << std::endl; // Change the location of first device in the list @@ -291,7 +293,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Check that the location was updated std::cout << "New details for device " << anum << " are:" << std::endl; - std::cout << list[0u] << std::endl; + CCS::Thermometer_ptr tx = list[0u]; + std::cout << tx << std::endl; // Find first thermostat in list. CCS::Thermostat_var tmstat; @@ -352,7 +355,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } } catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } catch (...) { diff --git a/TAO/examples/Advanced/ch_18/icp.cpp b/TAO/examples/Advanced/ch_18/icp.cpp index a6fc657329c..e8eb768bb3b 100644 --- a/TAO/examples/Advanced/ch_18/icp.cpp +++ b/TAO/examples/Advanced/ch_18/icp.cpp @@ -45,9 +45,9 @@ typedef map<unsigned long, DeviceState> StateMap; const size_t MAXSTR = 32; // Max len of string including NUL -const short MIN_TEMP = 40; // 40 F == 4.44 C -const short MAX_TEMP = 90; // 90 F == 32.22 C -const short DFLT_TEMP = 68; // 68 F == 20.00 C +const long MIN_TEMP = 40; // 40 F == 4.44 C +const long MAX_TEMP = 90; // 90 F == 32.22 C +const long DFLT_TEMP = 68; // 68 F == 20.00 C static StateMap dstate; // Map of known devices @@ -123,15 +123,10 @@ ICP_offline(unsigned long id) // exact temperature: 40% static -short -vary_temp(short temp) +long +vary_temp(long temp) { - #if defined (__BORLANDC__) || defined (_MSC_VER) - long r = ACE_OS::rand() % 50; - #else - long r = lrand48() % 50; - #endif - + long r = ACE_OS::rand() % 50; long delta; if (r < 5) delta = 3; @@ -142,13 +137,8 @@ vary_temp(short temp) else delta = 0; - #if defined (__BORLANDC__) || defined (_MSC_VER) - if (ACE_OS::rand() % 2) - #else - if (lrand48() % 2) - #endif - - delta = -delta; + if (ACE_OS::rand() % 2) + delta = -delta; return temp + delta; } @@ -193,7 +183,7 @@ private: // determined by vary_temp(). static -short +long actual_temp(const StateMap::iterator & pos) { long sum = 0; @@ -260,15 +250,15 @@ ICP_get( return -1; // Must be thermostat ACE_OS::memcpy( value, &pos->second.nominal_temp, - std::min(len, sizeof(pos->second.nominal_temp)) + ace_min(len, sizeof(pos->second.nominal_temp)) ); } else if (ACE_OS::strcmp(attr, "temperature") == 0) { - short temp = actual_temp(pos); - ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp))); + long temp = actual_temp(pos); + ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp))); } else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) { - ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP))); + ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP))); } else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) { - ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP))); + ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP))); } else { return -1; // No such attribute } diff --git a/TAO/examples/Advanced/ch_18/icp.h b/TAO/examples/Advanced/ch_18/icp.h index 69c2dab85f1..fb2d9d182de 100644 --- a/TAO/examples/Advanced/ch_18/icp.h +++ b/TAO/examples/Advanced/ch_18/icp.h @@ -17,12 +17,11 @@ // // ============================================================================ - - - #ifndef _ICP_H #define _ICP_H +#include "ace/OS.h" + extern "C" { int ICP_online(unsigned long id); // Add device int ICP_offline(unsigned long id); // Remove device @@ -33,12 +32,10 @@ extern "C" { size_t len ); int ICP_set( // Set attribute - unsigned long id, + unsigned long id, const char * attr, const void * value ); } -size_t min(const size_t len1, const size_t len2); - #endif /* _ICP_H */ diff --git a/TAO/examples/Advanced/ch_18/server.cpp b/TAO/examples/Advanced/ch_18/server.cpp index 67e743bcddd..d61fa852c25 100644 --- a/TAO/examples/Advanced/ch_18/server.cpp +++ b/TAO/examples/Advanced/ch_18/server.cpp @@ -19,8 +19,7 @@ // // ============================================================================ -#include <iostream> -#include <fstream> +#include <ace/streams.h> #include <strstream> #include "server.h" #include <algorithm> @@ -46,7 +45,7 @@ resolve_init (CORBA::ORB_ptr orb, const char * id) catch (const CORBA::Exception & e) { std::cerr << "Cannot get initial reference for " << id << ": " - //<< e + << e << std::endl; throw 0; } @@ -59,7 +58,7 @@ resolve_init (CORBA::ORB_ptr orb, const char * id) catch (const CORBA::Exception & e) { std::cerr << "Cannot narrow reference for " << id << ": " - //<< e + << e << std::endl; throw 0; } @@ -761,7 +760,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } diff --git a/TAO/examples/Advanced/ch_18/server.h b/TAO/examples/Advanced/ch_18/server.h index 0e03514c0a7..fc6f1680259 100644 --- a/TAO/examples/Advanced/ch_18/server.h +++ b/TAO/examples/Advanced/ch_18/server.h @@ -28,7 +28,8 @@ #include <map> #include <list> #include <assert.h> -//#include <corba/poaS.h> +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantLocatorC.h" using namespace std; diff --git a/TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc b/TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc new file mode 100644 index 00000000000..740dcb48c2f --- /dev/null +++ b/TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc @@ -0,0 +1,34 @@ +// -*- MPC -*- +// $Id$ + +project(*idl) : taoclient { + IDL_Files { + CCS.idl + } + custom_only = 1 +} + +project(*client) : taoclient, avoids_corba_e_micro, avoids_corba_e_compact { + after += *idl + source_files { + client.cpp + CCSC.cpp + } + IDL_Files { + } +} + +project(*server) : taoserver, avoids_corba_e_micro, avoids_corba_e_compact { + requires += dummy_label + after += *idl + source_files { + server.cpp + icp.cpp + CCSC.cpp + CCSS.cpp + } + IDL_Files { + } +} + + diff --git a/TAO/examples/Advanced/ch_21/client.cpp b/TAO/examples/Advanced/ch_21/client.cpp index 0c5b00344a3..0a45d6ed64e 100644 --- a/TAO/examples/Advanced/ch_21/client.cpp +++ b/TAO/examples/Advanced/ch_21/client.cpp @@ -18,9 +18,8 @@ // // ============================================================================ -#include "CCSC.h" // ORB-specific -#include <iostream> -// #include <fstream.h> +#include "CCSC.h" // ORB-specific +#include <ace/streams.h> using namespace std; @@ -166,7 +165,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) ctrl = CCS::Controller::_narrow(obj.in()); } catch (const CORBA::SystemException &se) { std::cerr << "Cannot narrow controller reference: " - //<< se + << se << std::endl; throw 0; } @@ -199,7 +198,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) list = ctrl->list(); // Show details for each device. for ( i = 0; i < list->length(); i++) - std::cout << list[i]; + { + CCS::Thermometer_ptr ti = list[i]; + std::cout << ti; + } std::cout << std::endl; // Change the location of first device in the list @@ -210,7 +212,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Check that the location was updated std::cout << "New details for device " << anum << " are:" << std::endl; - std::cout << list[0U] << std::endl; + CCS::Thermometer_ptr tx = list[0u]; + std::cout << tx << std::endl; // Find first thermostat in list. CCS::Thermostat_var tmstat; @@ -271,7 +274,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } } catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } catch (...) { diff --git a/TAO/examples/Advanced/ch_21/icp.cpp b/TAO/examples/Advanced/ch_21/icp.cpp index 3a32948c9b5..4c3bb1c076a 100644 --- a/TAO/examples/Advanced/ch_21/icp.cpp +++ b/TAO/examples/Advanced/ch_21/icp.cpp @@ -123,15 +123,10 @@ ICP_offline(unsigned long id) // exact temperature: 40% static -short -vary_temp(short temp) +long +vary_temp(long temp) { - #if defined (__BORLANDC__) || defined (_MSC_VER) - long r = ACE_OS::rand() % 50; - #else - long r = lrand48() % 50; - #endif - + long r = ACE_OS::rand() % 50; long delta; if (r < 5) delta = 3; @@ -141,12 +136,7 @@ vary_temp(short temp) delta = 1; else delta = 0; - #if defined (__BORLANDC__) || defined (_MSC_VER) - if (ACE_OS::rand() % 2) - #else - if (lrand48() % 2) - #endif - + if (ACE_OS::rand() % 2) delta = -delta; return temp + delta; @@ -192,7 +182,7 @@ private: // determined by vary_temp(). static -short +long actual_temp(const StateMap::iterator & pos) { long sum = 0; @@ -258,15 +248,15 @@ ICP_get( return -1; // Must be thermostat ACE_OS::memcpy( value, &pos->second.nominal_temp, - std::min(len, sizeof(pos->second.nominal_temp)) + ace_min(len, sizeof(pos->second.nominal_temp)) ); } else if (ACE_OS::strcmp(attr, "temperature") == 0) { - short temp = actual_temp(pos); - ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp))); + long temp = actual_temp(pos); + ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp))); } else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) { - ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP))); + ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP))); } else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) { - ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP))); + ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP))); } else { return -1; // No such attribute } diff --git a/TAO/examples/Advanced/ch_21/icp.h b/TAO/examples/Advanced/ch_21/icp.h index b413a9157df..b93d94193f2 100644 --- a/TAO/examples/Advanced/ch_21/icp.h +++ b/TAO/examples/Advanced/ch_21/icp.h @@ -17,13 +17,11 @@ // // ============================================================================ - - - - #ifndef _ICP_H #define _ICP_H +#include "ace/OS.h" + extern "C" { int ICP_online(unsigned long id); // Add device int ICP_offline(unsigned long id); // Remove device @@ -34,14 +32,12 @@ extern "C" { size_t len ); int ICP_set( // Set attribute - unsigned long id, + unsigned long id, const char * attr, const void * value ); } -size_t min(const size_t len1, const size_t len2); - #endif /* _ICP_H */ diff --git a/TAO/examples/Advanced/ch_21/server.cpp b/TAO/examples/Advanced/ch_21/server.cpp index c6f72bf0346..93ab672566a 100644 --- a/TAO/examples/Advanced/ch_21/server.cpp +++ b/TAO/examples/Advanced/ch_21/server.cpp @@ -18,8 +18,7 @@ // // ============================================================================ -#include <iostream> -#include <fstream> +#include <ace/streams.h> #include <strstream> #include "server.h" #include <ace/Synch_T.h> @@ -530,8 +529,8 @@ find (CCS::Controller::SearchSeq & slist) CCS::Controller::SearchCriterion sc = slist[i].key._d (); if (sc == CCS::Controller::ASSET) { // Search for matching asset number. - bool make = false; - CCS::AssetType num; + bool make = false; + CCS::AssetType num = 0; { ACE_Guard<ACE_Mutex> guard (m_assets_mutex); where = m_assets.find (slist[i].key.asset_num ()); @@ -738,7 +737,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } diff --git a/TAO/examples/Advanced/ch_21/server.h b/TAO/examples/Advanced/ch_21/server.h index c2d94bf18c2..6ddaca5bb97 100644 --- a/TAO/examples/Advanced/ch_21/server.h +++ b/TAO/examples/Advanced/ch_21/server.h @@ -30,7 +30,8 @@ #include <list> #include <map> #include <assert.h> -// #include <corba/poaS.h> +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantLocatorC.h" #include "CCSS.h" @@ -80,7 +81,7 @@ class Thermostat_impl : public: // CORBA operations virtual CCS::TempType get_nominal(); - virtual CCS::TempType set_nominal(CCS::TempType new_temp)); + virtual CCS::TempType set_nominal(CCS::TempType new_temp); // Constructor and destructor Thermostat_impl(CCS::AssetType anum); @@ -102,7 +103,7 @@ public: virtual CCS::Controller::ThermometerSeq* list(); virtual void find(CCS::Controller::SearchSeq & slist); virtual void change(const CCS::Controller::ThermostatSeq & tlist, - CORBA::Short delta)); + CORBA::Short delta); virtual CCS::Thermometer_ptr create_thermometer(CCS::AssetType anum, const char* loc); diff --git a/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc b/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc index cc64707b833..468c4508383 100644 --- a/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc +++ b/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc @@ -1,18 +1,33 @@ // -*- MPC -*- // $Id$ +project(*idl) : taoclient { + IDL_Files { + CCS.idl + } + custom_only = 1 +} + project(*client) : taoclient { - requires += dummy_label + after += *idl source_files { client.cpp + CCSC.cpp + } + IDL_Files { } } project(*server) : taoserver { requires += dummy_label + after += *idl source_files { server.cpp icp.cpp + CCSC.cpp + CCSS.cpp + } + IDL_Files { } } diff --git a/TAO/examples/Advanced/ch_8_and_10/client.cpp b/TAO/examples/Advanced/ch_8_and_10/client.cpp index 5843c985ac0..8d8203cf140 100644 --- a/TAO/examples/Advanced/ch_8_and_10/client.cpp +++ b/TAO/examples/Advanced/ch_8_and_10/client.cpp @@ -118,7 +118,7 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp) return; CCS::AssetType anum = tmstat->asset_num(); - try + try { std::cout << "Setting thermostat " << anum << " to " << new_temp << " degrees." << std::endl; @@ -127,8 +127,8 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp) << old_nominal << std::endl; std::cout << "New nominal temperature is: " << tmstat->get_nominal() << std::endl; - } - catch (const CCS::Thermostat::BadTemp & bt) + } + catch (const CCS::Thermostat::BadTemp & bt) { std::cerr << "Setting of nominal temperature failed." << std::endl; std::cerr << bt.details << std::endl; // Overloaded << @@ -140,13 +140,13 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp) int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { - try + try { // Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // Check arguments - if (argc != 2) + if (argc != 2) { std::cerr << "Usage: client IOR_string" << std::endl; throw 0; @@ -155,7 +155,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Get controller reference from argv // and convert to object. CORBA::Object_var obj = orb->string_to_object(argv[1]); - if (CORBA::is_nil(obj.in())) + if (CORBA::is_nil(obj.in())) { std::cerr << "Nil controller reference" << std::endl; throw 0; @@ -163,18 +163,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Try to narrow to CCS::Controller. CCS::Controller_var ctrl; - try + try { ctrl = CCS::Controller::_narrow(obj.in()); - } - catch (const CORBA::SystemException & se) + } + catch (const CORBA::SystemException & se) { std::cerr << "Cannot narrow controller reference: " - //<< se + << se << std::endl; throw 0; } - if (CORBA::is_nil(ctrl.in())) + if (CORBA::is_nil(ctrl.in())) { std::cerr << "Wrong type for controller ref." << std::endl; throw 0; @@ -207,23 +207,24 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Check that the location was updated std::cout << "New details for device " << anum << " are:" << std::endl; - std::cout << list[(CORBA::ULong) 0] << std::endl; + CCS::Thermometer_ptr tx = list[0u]; + std::cout << tx << std::endl; // Find first thermostat in list. CCS::Thermostat_var tmstat; for ( CORBA::ULong j = 0; j < list->length() && CORBA::is_nil(tmstat.in()); - j++) + j++) { tmstat = CCS::Thermostat::_narrow(list[j]); } // Check that we found a thermostat on the list. - if (CORBA::is_nil(tmstat.in())) + if (CORBA::is_nil(tmstat.in())) { std::cout << "No thermostat devices in list." << std::endl; - } - else + } + else { // Set temperature of thermostat to // 50 degrees (should work). @@ -255,7 +256,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // containing only thermostats. std::cout << "Increasing thermostats by 40 degrees." << std::endl; CCS::Controller::ThermostatSeq tss; - for (CORBA::ULong l = 0; l < list->length(); l++) + for (CORBA::ULong l = 0; l < list->length(); l++) { tmstat = CCS::Thermostat::_narrow(list[l]); if (CORBA::is_nil(tmstat.in())) @@ -266,23 +267,23 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } // Try to change all thermostats. - try + try { ctrl->change(tss, 40); - } - catch (const CCS::Controller::EChange & ec) + } + catch (const CCS::Controller::EChange & ec) { std::cerr << ec; // Overloaded << } - } - catch (const CORBA::Exception & e) + } + catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; - } - catch (...) + } + catch (...) { return 1; } diff --git a/TAO/examples/Advanced/ch_8_and_10/icp.cpp b/TAO/examples/Advanced/ch_8_and_10/icp.cpp index 6ee53cee339..2ccfc38a70e 100644 --- a/TAO/examples/Advanced/ch_8_and_10/icp.cpp +++ b/TAO/examples/Advanced/ch_8_and_10/icp.cpp @@ -44,9 +44,9 @@ typedef std::map<unsigned long, DeviceState> StateMap; const size_t MAXSTR = 32; // Max len of string including NUL -const short MIN_TEMP = 40; // 40 F == 4.44 C -const short MAX_TEMP = 90; // 90 F == 32.22 C -const short DFLT_TEMP = 68; // 68 F == 20.00 C +const long MIN_TEMP = 40; // 40 F == 4.44 C +const long MAX_TEMP = 90; // 90 F == 32.22 C +const long DFLT_TEMP = 68; // 68 F == 20.00 C static StateMap dstate; // Map of known devices @@ -122,14 +122,10 @@ ICP_offline(unsigned long id) // exact temperature: 40% static -short -vary_temp(short temp) +long +vary_temp(long temp) { -#if defined (__BORLANDC__) || defined (_MSC_VER) long r = ACE_OS::rand() % 50; -#else - long r = lrand48() % 50; -#endif long delta; if (r < 5) delta = 3; @@ -139,11 +135,7 @@ vary_temp(short temp) delta = 1; else delta = 0; -#if defined (__BORLANDC__) || defined (_MSC_VER) if (ACE_OS::rand() % 2) -#else - if (lrand48() % 2) -#endif delta = -delta; return temp + delta; } @@ -188,7 +180,7 @@ private: // determined by vary_temp(). static -short +long actual_temp(const StateMap::iterator & pos) { long sum = 0; @@ -255,15 +247,15 @@ ICP_get( return -1; // Must be thermostat ACE_OS::memcpy( value, &pos->second.nominal_temp, - std::min(len, sizeof(pos->second.nominal_temp)) + ace_min(len, sizeof(pos->second.nominal_temp)) ); } else if (ACE_OS::strcmp(attr, "temperature") == 0) { - short temp = actual_temp(pos); - ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp))); + long temp = actual_temp(pos); + ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp))); } else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) { - ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP))); + ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP))); } else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) { - ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP))); + ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP))); } else { return -1; // No such attribute } diff --git a/TAO/examples/Advanced/ch_8_and_10/icp.h b/TAO/examples/Advanced/ch_8_and_10/icp.h index 795e527e0b6..a884c51d769 100644 --- a/TAO/examples/Advanced/ch_8_and_10/icp.h +++ b/TAO/examples/Advanced/ch_8_and_10/icp.h @@ -38,6 +38,4 @@ extern "C" { ); } -size_t min(const size_t len1, const size_t len2); - #endif /* _ICP_H */ diff --git a/TAO/examples/Advanced/ch_8_and_10/server.cpp b/TAO/examples/Advanced/ch_8_and_10/server.cpp index f95cc75a296..1db6a9afcbc 100644 --- a/TAO/examples/Advanced/ch_8_and_10/server.cpp +++ b/TAO/examples/Advanced/ch_8_and_10/server.cpp @@ -445,7 +445,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) } catch (const CORBA::Exception & e) { std::cerr << "Uncaught CORBA exception: " - //<< e + << e << std::endl; return 1; } diff --git a/TAO/examples/Simple/Simple_util.cpp b/TAO/examples/Simple/Simple_util.cpp index ed34fd728e9..56ceefb0546 100644 --- a/TAO/examples/Simple/Simple_util.cpp +++ b/TAO/examples/Simple/Simple_util.cpp @@ -166,7 +166,7 @@ Server<Servant>::init (const char *servant_name, ACE_TEXT ("The IOR is: <%C>\n"), str.in ())); - if (this->ins_ && this->test_for_ins (str) != 0) + if (this->ins_ && this->test_for_ins (str.in ()) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("test_for_ins (): failed\n")), -1); diff --git a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h index 9dfb7ce0ff3..8fc33ea4a5b 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h +++ b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h @@ -3,6 +3,9 @@ #ifndef MESSENGERI_H_ #define MESSENGERI_H_ +// This is needed on LynxOS 4.0 with GCC 2.95 +#include "ace/OS_NS_stdio.h" + #include <openssl/ssl.h> #include <openssl/x509.h> #include "orbsvcs/SecurityC.h" diff --git a/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp b/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp index 22a24cc3f50..18d64a14e1e 100644 --- a/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp +++ b/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp @@ -1622,7 +1622,7 @@ ifr_adding_visitor::visit_structure_fwd (AST_StructureFwd *node) CORBA::StructMemberSeq dummyMembers; dummyMembers.length (0); CORBA::Container_ptr current_scope = CORBA::Container::_nil (); - + if (be_global->ifr_scopes ().top (current_scope) != 0) { ACE_ERROR_RETURN (( @@ -1634,7 +1634,7 @@ ifr_adding_visitor::visit_structure_fwd (AST_StructureFwd *node) -1 ); } - + CORBA::StructDef_var struct_def = current_scope->create_struct ( node->repoID (), @@ -1642,7 +1642,7 @@ ifr_adding_visitor::visit_structure_fwd (AST_StructureFwd *node) node->version (), dummyMembers ); - + node->full_definition ()->ifr_fwd_added (true); } } @@ -1989,7 +1989,7 @@ ifr_adding_visitor::visit_union_fwd (AST_UnionFwd *node) CORBA::UnionMemberSeq dummyMembers; dummyMembers.length (0); CORBA::Container_ptr current_scope = CORBA::Container::_nil (); - + if (be_global->ifr_scopes ().top (current_scope) != 0) { ACE_ERROR_RETURN (( @@ -2001,7 +2001,7 @@ ifr_adding_visitor::visit_union_fwd (AST_UnionFwd *node) -1 ); } - + CORBA::UnionDef_var union_def = current_scope->create_union ( node->repoID (), @@ -2010,7 +2010,7 @@ ifr_adding_visitor::visit_union_fwd (AST_UnionFwd *node) CORBA::IDLType::_nil (), dummyMembers ); - + node->full_definition ()->ifr_fwd_added (true); } } @@ -2082,10 +2082,10 @@ ifr_adding_visitor::visit_constant (AST_Constant *node) AST_Decl *enum_val = node->defined_in ()->lookup_by_name (cv->n (), true); AST_Decl *d = ScopeAsDecl (enum_val->defined_in ()); - + CORBA::Contained_var contained = be_global->repository ()->lookup_id (d->repoID ()); - + this->ir_current_ = CORBA::IDLType::_narrow (contained.in ()); } else @@ -2093,7 +2093,7 @@ ifr_adding_visitor::visit_constant (AST_Constant *node) // This constant's type is a primitive type - fetch it from the // repo and pass it to create_constant(). CORBA::PrimitiveKind pkind = this->expr_type_to_pkind (et); - + this->ir_current_ = be_global->repository ()->get_primitive (pkind); } @@ -2144,7 +2144,7 @@ ifr_adding_visitor::visit_array (AST_Array *node) AST_Type *bt = node->base_type (); UTL_Scope *bts = bt->defined_in (); UTL_Scope *ns = node->defined_in (); - + if (bts == ns && !bt->ifr_added ()) { // What we most likely have if we get here is an @@ -2156,7 +2156,7 @@ ifr_adding_visitor::visit_array (AST_Array *node) // happens. owned = true; } - + this->element_type (bt, owned); AST_Expression **dims = node->dims (); @@ -2573,7 +2573,7 @@ ifr_adding_visitor::load_any (AST_Expression::AST_ExprValue *ev, wstr[len] = 0; any <<= wstr; - delete wstr; + delete [] wstr; break; } case AST_Expression::EV_enum: diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index d65450c6c79..78cf1a90d1f 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -1059,7 +1059,6 @@ ImR_Locator_i::find (const char* server, ImplementationRepository::ServerInformation_out imr_info) { ACE_ASSERT (server != 0); - ACE_NEW_THROW_EX (imr_info, ImplementationRepository::ServerInformation, CORBA::NO_MEMORY ()); Server_Info_Ptr info = this->repository_.get_server (server); if (! info.null ()) @@ -1071,6 +1070,8 @@ ImR_Locator_i::find (const char* server, } else { + ACE_NEW_THROW_EX (imr_info, ImplementationRepository::ServerInformation, CORBA::NO_MEMORY ()); + if (debug_ > 1) ACE_DEBUG ((LM_DEBUG, "ImR: Cannot find server <%s>\n", server)); } diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp index 8b74787ca4f..82ef3482818 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp @@ -18,6 +18,7 @@ #include "ace/Sched_Params.h" #include "ace/Synch.h" #include "ace/Argv_Type_Converter.h" +#include "ace/Logging_Strategy.h" TAO_Notify_Service_Driver::TAO_Notify_Service_Driver (void) : notify_service_ (0) @@ -30,6 +31,7 @@ TAO_Notify_Service_Driver::TAO_Notify_Service_Driver (void) , nthreads_ (1) , separate_dispatching_orb_ (false) , timeout_ (0) +, logging_worker_(this) { // No-Op. } @@ -130,7 +132,9 @@ TAO_Notify_Service_Driver::init (int argc, ACE_TCHAR *argv[]) if (this->notify_service_ == 0) { - ACE_DEBUG ((LM_DEBUG, "Service not found. Check service configurator file.\n")); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Service not found. Check service ") + ACE_TEXT ("configurator file.\n"))); return -1; } @@ -148,9 +152,13 @@ TAO_Notify_Service_Driver::init (int argc, ACE_TCHAR *argv[]) this->notify_service_->init_service (this->orb_.in ()); } + logging_worker_.start(); + if (this->nthreads_ > 0) // we have chosen to run in a thread pool. { - ACE_DEBUG ((LM_DEBUG, "Running %d ORB threads\n", this->nthreads_)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Running %d ORB threads\n"), + this->nthreads_)); worker_.orb (this->orb_.in ()); // Task activation flags. @@ -180,7 +188,7 @@ TAO_Notify_Service_Driver::init (int argc, ACE_TCHAR *argv[]) } ACE_DEBUG ((LM_DEBUG, - "\nStarting up the Notification Service...\n")); + ACE_TEXT("\nStarting up the Notification Service...\n"))); // Activate the factory this->notify_factory_ = @@ -198,7 +206,8 @@ TAO_Notify_Service_Driver::init (int argc, ACE_TCHAR *argv[]) IORTable::Table::_narrow (table_object.in ()); if (CORBA::is_nil (adapter.in ())) { - ACE_ERROR ((LM_ERROR, "Nil IORTable. corbaloc support not enabled.\n")); + ACE_ERROR ((LM_ERROR, + "Nil IORTable. corbaloc support not enabled.\n")); } else { @@ -276,7 +285,7 @@ TAO_Notify_Service_Driver::init (int argc, ACE_TCHAR *argv[]) else if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "The Notification Event Channel Factory IOR is <%C>\n", + ACE_TEXT ("The Notification Event Channel Factory IOR is <%C>\n"), str.in ())); } @@ -305,8 +314,9 @@ int TAO_Notify_Service_Driver::run (void) { if (TAO_debug_level > 0 ) - ACE_DEBUG ((LM_DEBUG, "%s: Running the Notification Service\n", - __FILE__)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s: Running the Notification Service\n"), + ACE_TEXT_CHAR_TO_TCHAR (__FILE__))); if (this->nthreads_ > 0) { @@ -316,6 +326,7 @@ TAO_Notify_Service_Driver::run (void) this->orb_->run (); + this->logging_worker_.end(); return 0; } @@ -432,7 +443,9 @@ TAO_Notify_Service_Driver::parse_args (int &argc, ACE_TCHAR *argv[]) } else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Notify_TPReactor")))) { - ACE_DEBUG((LM_DEBUG, "-Notify_TPReactor option is deprecated, use -ORBRunThreads option\n")); + ACE_DEBUG((LM_DEBUG, + ACE_TEXT ("-Notify_TPReactor option is deprecated, ") + ACE_TEXT ("use -ORBRunThreads option\n"))); this->nthreads_ = ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); @@ -449,21 +462,26 @@ TAO_Notify_Service_Driver::parse_args (int &argc, ACE_TCHAR *argv[]) arg_shifter.consume_arg (); #else ACE_DEBUG((LM_DEBUG, - "WARNING: CORBA Messaging has been disabled. The " - "timeout will not be applied.\n")); + ACE_TEXT ("WARNING: CORBA Messaging has been disabled.") + ACE_TExT ("The timeout will not be applied.\n"))); #endif /* TAO_HAS_CORBA_MESSAGING != 0 */ } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-LoggingInterval")))) + { + this->logging_interval_ = ACE_Time_Value (ACE_OS::atoi (current_arg)); + arg_shifter.consume_arg (); + } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-?")) == 0) { ACE_DEBUG((LM_DEBUG, - "usage: %s -Factory factory_name " - "-Boot -[No]NameSvc " - "-IORoutput file_name " - "-Channel -ChannelName channel_name " - "-ORBRunThreads threads " - "-Timeout <msec>\n" - "default: %s -Factory NotifyEventChannelFactory " - "-NameSvc -Channel NotifyEventChannel -ORBRunThreads 1\n", + ACE_TEXT ("usage: %s -Factory factory_name ") + ACE_TEXT ("-Boot -[No]NameSvc ") + ACE_TEXT ("-IORoutput file_name ") + ACE_TEXT ("-Channel -ChannelName channel_name ") + ACE_TEXT ("-ORBRunThreads threads ") + ACE_TEXT ("-Timeout <msec>\n") + ACE_TEXT ("default: %s -Factory NotifyEventChannelFactory ") + ACE_TEXT ("-NameSvc -Channel NotifyEventChannel -ORBRunThreads 1\n"), argv[0], argv[0])); arg_shifter.consume_arg (); @@ -479,6 +497,68 @@ TAO_Notify_Service_Driver::parse_args (int &argc, ACE_TCHAR *argv[]) } /*****************************************************************/ +LoggingWorker::LoggingWorker(TAO_Notify_Service_Driver* ns) +: ns_ (ns), + started_ (false) +{ +} + + +void +LoggingWorker::start () +{ + ACE_Logging_Strategy* logging_strategy = ACE_Dynamic_Service<ACE_Logging_Strategy>::instance ("Logging_Strategy"); + if (logging_strategy == 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t)logging_strategy == 0\n"))); + } + else + { + if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)can not activate the ") + ACE_TEXT ("logging event thread\n"))); + } + else { + if (this->ns_->logging_interval_ > ACE_Time_Value::zero) + { + ACE_Time_Value delay; + if (this->ns_->orb_->orb_core()->reactor()-> + schedule_timer (logging_strategy, 0, delay, + this->ns_->logging_interval_) == -1) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t)failed to schedule ") + ACE_TEXT("logging switch timer\n"))); + } + } + } + + } +} + + +int +LoggingWorker::svc (void) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)Running logging reactor \n"))); + started_ = true; + this->logging_reactor_.run_event_loop(); + + return 0; +} + +void +LoggingWorker::end () +{ + if (started_) + { + this->logging_reactor_.end_event_loop(); + this->thr_mgr ()->wait (); + } +} Worker::Worker (void) { @@ -506,11 +586,15 @@ Worker::svc (void) int priority; if (ACE_Thread::getprio (current, priority) == -1) { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Failed to get Worker thread priority\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - Failed to get ") + ACE_TEXT ("Worker thread priority\n"))); return -1; } - ACE_DEBUG ((LM_DEBUG, "Activated Worker Thread to run the ORB @ priority:%d\n", priority)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Activated Worker Thread to run ") + ACE_TEXT ("the ORB @ priority:%d\n", priority)); #endif try diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.h b/TAO/orbsvcs/Notify_Service/Notify_Service.h index 86b57b125a9..2feb23b3204 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.h +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.h @@ -23,14 +23,29 @@ #include "orbsvcs/CosNamingC.h" #include "../orbsvcs/Notify/CosNotify_Initializer.h" #include "ace/SString.h" +#include "ace/Reactor.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_Notify_Service; -TAO_END_VERSIONED_NAMESPACE_DECL +class TAO_Notify_Service_Driver; #define NOTIFY_KEY "NotifyEventChannelFactory" #define NOTIFY_CHANNEL_NAME "NotifyEventChannel" +class LoggingWorker : public ACE_Task_Base +{ + public: + LoggingWorker (TAO_Notify_Service_Driver* ns); + virtual int svc (void); + void start (); + void end (); + private: + + ACE_Reactor logging_reactor_; + TAO_Notify_Service_Driver* ns_; + bool started_; +}; + /** * @class Worker * @@ -64,6 +79,8 @@ private: class TAO_Notify_Service_Driver { + friend class LoggingWorker; + public: // = Initialization and termination methods. /// Constructor. @@ -149,7 +166,12 @@ protected: /// The relative round-trip timeout suseconds_t timeout_; + + ACE_Time_Value logging_interval_; + LoggingWorker logging_worker_; }; +TAO_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* NOTIFY_SERVICE_H */ diff --git a/TAO/orbsvcs/Notify_Service/README b/TAO/orbsvcs/Notify_Service/README index 5ee008b4ed4..ddaf3a38801 100644 --- a/TAO/orbsvcs/Notify_Service/README +++ b/TAO/orbsvcs/Notify_Service/README @@ -142,9 +142,37 @@ The "TAO_CosNotify_Service" service object accepts the following options: "-NoUpdates" : Globally disables subscription and publication updates. -"-DefaultConsumerAdminFilterOp [op]" : Sets the default consumer admin filter operator [OR|AND]. - -"-DefaultSupplierAdminFilterOp [op]" : Sets the default consumer admin filter operator [OR|AND]. +"-ValidateClient" : Creates a thread that periodically + walks the topology tree visiting each + proxy and checking the liviness of + the peer. A peer which had ordinary + activity within the validation time + period is considered alive. Otherwise + the peer's _non_existent() operation + is invoked. If this fails the proxy's + disconnect operation is invoked. + +"-ValidateClientDelay [sec]" : Specifies the initial delay from the + start of the validator task until the + first pass through the topology. If + left at the default value of 0, the + validator taks will start immediately. + A long delay is useful when the Notify + service restarts after a shutdown and + has to repopulate its topology from a + persistent store, which takes time. + +"-ValidateClientInterval [sec]" : Specifies how frequently after the + first pass to revisit the topology + to further validate clients. The + default value of 0 means validation + will only happen once. + +"-DefaultConsumerAdminFilterOp [op]" : Sets the default consumer admin filter + operator [OR|AND]. Default is AND. + +"-DefaultSupplierAdminFilterOp [op]" : Sets the default supplier admin filter + operator [OR|AND]. Default is AND. All other options are deprecated and should not be used. diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp index 6e1ffafb619..1ed8649ac7d 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp @@ -69,6 +69,14 @@ Client_Timer_Handler::handle_timeout (const ACE_Time_Value &, timer_.stop (); + ++invocations_; + + ACE_DEBUG ((LM_EMERGENCY, "m(%s,%d,%d,%d) ", + logfile_.c_str (), + max_iterations_, + log_start_, + invocations_)); + if (logging_ && (invocations_ >= log_start_)) { ACE_Time_Value rt; @@ -79,9 +87,9 @@ Client_Timer_Handler::handle_timeout (const ACE_Time_Value &, } catch (CORBA::SystemException & ex) { - ACE_DEBUG ((LM_WARNING, - ACE_TEXT ("Client_Timer_Handler::handle_timeout () -" - "caught: %s"), ex._info ().c_str ())); + ACE_DEBUG ((LM_EMERGENCY, + ACE_TEXT ("Client_Timer_Handler::handle_timeout () -" + "caught: %s"), ex._info ().c_str ())); orb_->shutdown (); @@ -90,7 +98,7 @@ Client_Timer_Handler::handle_timeout (const ACE_Time_Value &, try { - if ((max_iterations_ > 0) && (++invocations_ >= max_iterations_)) + if ((max_iterations_ > 0) && (invocations_ >= max_iterations_)) { worker_->stop (); @@ -112,6 +120,8 @@ Client_Timer_Handler::handle_timeout (const ACE_Time_Value &, int Client_Timer_Handler::handle_signal (int, siginfo_t *, ucontext_t *) { + orb_->orb_core ()->reactor ()->cancel_timer (this); + orb_->shutdown (); return 0; diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.mpc b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.mpc index 0166a030785..d1dceb34436 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.mpc +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.mpc @@ -30,15 +30,19 @@ project(*Server): lwft_server, lwft_client, naming, rtcorba { } } -project(*Client): lwft_client, naming, rtcorba { +project(*Client): lwft_client, naming, rtcorba, portableserver { after += *idl Source_Files { client.cpp Client_Timer_Handler.cpp - WorkerC.cpp + WorkerC.cpp + TriggerS.cpp + TriggerC.cpp + Trigger_i.cpp } IDL_Files { + Trigger.idl } } diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp index e7806502566..3da7aba5ab2 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp @@ -16,7 +16,7 @@ Failure_Task::svc (void) { ACE_Guard <ACE_Thread_Mutex> guard (lock_); - while (((limit_ == 0) || (count_ < limit_)) && !stop_) + while (((limit_ == 0) || (count_ <= limit_)) && !stop_) { condition_.wait (); } @@ -59,6 +59,8 @@ Worker_i::Worker_i (CORBA::ORB_ptr orb, CORBA::ULong Worker_i::run_task (CORBA::Double execution_time) { + ACE_DEBUG ((LM_EMERGENCY, "x(%d) ", state_)); + timer_.start (); this->cpu_.run (static_cast <size_t> (execution_time)); diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp index dde0f65d562..660c6069819 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp @@ -1,6 +1,7 @@ // $Id$ #include <sstream> +#include <fstream> #include "WorkerC.h" #include "ace/Get_Opt.h" #include "orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h" @@ -8,6 +9,7 @@ #include "ace/Sig_Handler.h" #include "ace/Reactor.h" #include "tao/ORB_Core.h" +#include "Trigger_i.h" #include "tao/RTCORBA/RTCORBA.h" @@ -119,15 +121,30 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) timeout_handler.set_orb (orb.in ()); timeout_handler.set_worker (server1.in ()); - // add a the handler for the SIGINT signal here + // add a the handler for the SIGINT signal here ACE_Sig_Handler sig_handler; sig_handler.register_handler (SIGINT, &timeout_handler); - - // register the timer handler with the ORB reactor - orb->orb_core ()->reactor ()->schedule_timer (&timeout_handler, - 0, - ACE_Time_Value::zero, - period); + + Trigger_i * trigger = new Trigger_i (orb.in (), + timeout_handler, + period.msec ()); + + PortableServer::ServantBase_var ownership_transfer (trigger); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in ()); + + PortableServer::POAManager_var poa_mgr = poa->the_POAManager (); + + poa_mgr->activate (); + + Trigger_var trig = trigger->_this (); + + std::string fname = server_id + "Client.ior"; + std::ofstream file (fname.c_str ()); + file << orb->object_to_string (trig.in ()); + file.close (); orb->run (); diff --git a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp index 3d2363cb364..f3a59934841 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp @@ -879,7 +879,7 @@ TAO_StreamCtrl::bind (AVStreams::StreamEndPoint_A_ptr sep_a, AVStreams::flowSpec a_flows, b_flows; CORBA::Any_var flows_any; flows_any = sep_a_->get_property_value ("Flows"); - AVStreams::flowSpec *temp_flows; + AVStreams::flowSpec *temp_flows = 0; flows_any.in () >>= temp_flows; a_flows = *temp_flows; flows_any = sep_b_->get_property_value ("Flows"); @@ -1068,7 +1068,7 @@ TAO_StreamCtrl::bind (AVStreams::StreamEndPoint_A_ptr sep_a, } CORBA::String_var fep_a_name, fep_b_name; flowname_any = fep_a->get_property_value ("FlowName"); - const char *temp_name; + const char *temp_name = 0; flowname_any.in () >>= temp_name; fep_a_name = CORBA::string_dup (temp_name); flowname_any = fep_b->get_property_value ("FlowName"); @@ -1579,7 +1579,7 @@ TAO_StreamEndPoint::connect (AVStreams::StreamEndPoint_ptr responder, CORBA::Any_var protocols_any = responder->get_property_value ("AvailableProtocols"); AVStreams::protocolSpec peer_protocols; - AVStreams::protocolSpec *temp_protocols; + AVStreams::protocolSpec *temp_protocols = 0; protocols_any.in () >>= temp_protocols; peer_protocols = *temp_protocols; for (u_int i=0;i<peer_protocols.length ();i++) @@ -2211,7 +2211,7 @@ TAO_StreamEndPoint::add_fep_i (AVStreams::FlowEndPoint_ptr fep) CORBA::Any_var flow_name_any = fep->get_property_value ("FlowName"); - const char *tmp; + const char *tmp = 0; flow_name_any >>= tmp; flow_name = CORBA::string_dup (tmp); } @@ -3226,7 +3226,7 @@ TAO_MMDevice::add_fdev (CORBA::Object_ptr fdev_obj) flow_name_any = fdev->get_property_value ("Flow"); - const char *tmp; + const char *tmp = 0; *flow_name_any >>= tmp; flow_name = CORBA::string_dup (tmp); } @@ -3974,7 +3974,7 @@ TAO_FlowEndPoint::set_protocol_restriction (const AVStreams::protocolSpec & prot AvailableProtocols_property <<= protocols; this->define_property ("AvailableProtocols", AvailableProtocols_property); - AVStreams::protocolSpec *temp_spec; + AVStreams::protocolSpec *temp_spec = 0; CORBA::Any_var temp_any = this->get_property_value ("AvailableProtocols"); temp_any.in () >>= temp_spec; if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%N:%l\n")); @@ -4007,7 +4007,7 @@ TAO_FlowEndPoint::is_fep_compatible (AVStreams::FlowEndPoint_ptr peer_fep) exception_message = "TAO_FlowEndPoint::is_fep_compatible - Format"; format_ptr = this->get_property_value ("Format"); - const char *temp_format; + const char *temp_format = 0; format_ptr.in () >>= temp_format; my_format = CORBA::string_dup (temp_format); // get my peer's format value @@ -4022,7 +4022,7 @@ TAO_FlowEndPoint::is_fep_compatible (AVStreams::FlowEndPoint_ptr peer_fep) // since formats are same, check for a common protocol CORBA::Any_var AvailableProtocols_ptr; AVStreams::protocolSpec my_protocol_spec, peer_protocol_spec; - AVStreams::protocolSpec *temp_protocols;; + AVStreams::protocolSpec *temp_protocols = 0; exception_message = "TAO_FlowEndPoint::is_fep_compatible - AvailableProtocols"; diff --git a/TAO/orbsvcs/orbsvcs/CosNotification.mpc b/TAO/orbsvcs/orbsvcs/CosNotification.mpc index 7bfc36233d4..d4f495778a7 100644 --- a/TAO/orbsvcs/orbsvcs/CosNotification.mpc +++ b/TAO/orbsvcs/orbsvcs/CosNotification.mpc @@ -111,10 +111,11 @@ project(CosNotification_Skel) : orbsvcslib, orbsvcs_output, install, notificatio } } -project(CosNotification_Serv) : orbsvcslib, orbsvcs_output, svc_utils, install, notification_skel, dynamicany, etcl{ +project(CosNotification_Serv) : orbsvcslib, orbsvcs_output, svc_utils, install, notification_skel, dynamicany, etcl, messaging{ sharedname = TAO_CosNotification_Serv dynamicflags = TAO_NOTIFY_SERV_BUILD_DLL tagchecks += Notify + after += Messaging IDL_Files { } @@ -144,6 +145,7 @@ project(CosNotification_Serv) : orbsvcslib, orbsvcs_output, svc_utils, install, Notify/Event_Manager.cpp Notify/Event_Persistence_Factory.cpp Notify/FilterAdmin.cpp + Notify/Validate_Client_Task.cpp Notify/ID_Factory.cpp Notify/Method_Request.cpp Notify/Method_Request_Dispatch.cpp diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp index 7712a54b917..b076949f084 100644 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp @@ -223,7 +223,7 @@ TAO_ECG_UDP_Receiver::handle_input (ACE_SOCK_Dgram& dgram) { ACE_ERROR ((LM_ERROR, "Caught and swallowed EXCEPTION in " - "ECG_UDP_Receiver::handle_input: %s\n", + "ECG_UDP_Receiver::handle_input: %C\n", ex._info ().c_str ())); } return 0; diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp index 98a8e5f7ae5..bc3a9cc1947 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp @@ -74,7 +74,7 @@ TAO_EC_Thread_Flags::parse_symbols (const char* syms) if (tok[0] >= '0' && tok[0] <= '9') // Numeric, so just accept it! { // parse it as a long straight to the flags - + // If somebody specifies the scheduler this way, then they // lose range checking on the priority. Bummer, but those // are the breaks. @@ -112,7 +112,7 @@ TAO_EC_Thread_Flags::parse_symbols (const char* syms) // Ideally this would call some sort of on-error function... // but, it doesn't. ACE_ERROR ((LM_ERROR, - "RTEC (%P|%t) unable to parse %s as a thread flag - skipping\n", + "RTEC (%P|%t) unable to parse %C as a thread flag - skipping\n", tok)); } } diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp index 9d516f16ca3..846388ea8d8 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp @@ -185,7 +185,6 @@ namespace TAO TAO_InputCDR icdr (cdr); CORBA::String_var rep_id; - CORBA::ULong min, cs = 0; if (!(icdr.read_string (rep_id.out ()) && @@ -229,7 +228,7 @@ namespace TAO { IOP::ServiceContext sc; sc.context_id = IOP::FT_GROUP_VERSION; - + if (this->ft_send_extended_sc_) { // We send the whole tagged component as a service context. @@ -243,29 +242,29 @@ namespace TAO TAO_InputCDR cdr (reinterpret_cast<const char*> (tp->component_data.get_buffer ()), tp->component_data.length ()); CORBA::Boolean byte_order; - - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + + if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) return; - + cdr.reset_byte_order (static_cast<int> (byte_order)); - + FT::TagFTGroupTaggedComponent gtc; - - if ((cdr >> gtc) == 0) + + if (!(cdr >> gtc)) throw CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, CORBA::COMPLETED_NO); - + TAO_OutputCDR ocdr; if (!(ocdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) return; - + if (!(ocdr << gtc.object_group_ref_version)) return; - + CORBA::ULong length = static_cast<CORBA::ULong> (ocdr.total_length ()); sc.context_data.length (length); CORBA::Octet *buf = sc.context_data.get_buffer (); - + for (const ACE_Message_Block *i = ocdr.begin (); i != 0; i = i->cont ()) @@ -357,7 +356,6 @@ namespace TAO catch (const CORBA::Exception&) { } - return; } TimeBase::TimeT @@ -375,8 +373,7 @@ namespace TAO if (p.in ()) { - t = - p->request_duration_policy_value (); + t = p->request_duration_policy_value (); } else { diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp index 5c6b3cf6212..142cc8f5a08 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp @@ -31,23 +31,20 @@ TAO_FT_Invocation_Endpoint_Selector::select_endpoint ( TAO::Profile_Transport_Resolver *r, ACE_Time_Value *val) { - bool retval = - this->select_primary (r, - val); + bool retval = this->select_primary (r, val); if (retval) return; - retval = - this->select_secondary (r, - val); + retval = this->select_secondary (r, val); - if (retval == false) - { - // If we get here, we completely failed to find an endpoint selector - // that we know how to use, so throw an exception. - throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); - } + // If we get here and still haven't found a primary or + // secondary then we used to throw a TRANSIENT exception here. + // But that would prevent any request interception points + // being called. They may know how to fix the problem so + // we wait to throw the exception in + // Synch_Twoway_Invocation::remote_twoway and + // Synch_Oneway_Invocation::remote_oneway instead. return; } @@ -69,9 +66,8 @@ TAO_FT_Invocation_Endpoint_Selector::select_primary ( if (prof_list == 0) return false; - // Did not succeed. Try to look for primaries all over the place - CORBA::ULong sz = - prof_list->size (); + // Try to look for primaries all over the place + CORBA::ULong const sz = prof_list->size (); // Iterate through the list in a circular fashion. Stop one before // the list instead of trying the same thing again. @@ -84,7 +80,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_primary ( bool retval = this->check_profile_for_primary (tmp); - // Choose a non-primary + // Found a primary if (retval == true && tmp != 0) { retval = @@ -92,7 +88,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_primary ( tmp, max_wait_time); - if (retval == true) + if (retval) return true; } } @@ -118,8 +114,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_secondary ( if (prof_list == 0) return false; - CORBA::ULong sz = - prof_list->size (); + CORBA::ULong const sz = prof_list->size (); for (CORBA::ULong i = 0; i != sz; @@ -131,7 +126,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_secondary ( bool retval = this->check_profile_for_primary (tmp); - // Choose a non-primary + // Found a non-primary if (retval == false && tmp != 0) { retval = @@ -189,7 +184,7 @@ bool TAO_FT_Invocation_Endpoint_Selector::check_profile_for_primary ( TAO_Profile *pfile) { - if (pfile == 0) + if (!pfile) return false; IOP::TaggedComponent tagged_component; diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp index f9e57d5a2d4..e8b9460fda3 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp @@ -194,37 +194,6 @@ TAO::HTIOP::Transport::send_message (TAO_OutputCDR &stream, } int -TAO::HTIOP::Transport::generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) -{ - // Check whether we have a Bi Dir HTIOP policy set, whether the - // messaging objects are ready to handle bidirectional connections - // and also make sure that we have not recd. or sent any information - // regarding this before... - if (this->orb_core ()->bidir_giop_policy () && - this->messaging_object ()->is_ready_for_bidirectional (msg) && - this->bidirectional_flag () < 0) - { - this->set_bidir_context_info (opdetails); - - // Set the flag to 1 (i.e., originating side) - this->bidirectional_flag (1); - - // At the moment we enable BiDIR giop we have to get a new - // request id to make sure that we follow the even/odd rule - // for request id's. We only need to do this when enabled - // it, after that the Transport Mux Strategy will make sure - // that the rule is followed - opdetails.request_id (this->tms ()->request_id ()); - } - - return TAO_Transport::generate_request_header (opdetails, - spec, - msg); -} - -int TAO::HTIOP::Transport::tear_listen_point_list (TAO_InputCDR &cdr) { CORBA::Boolean byte_order; @@ -248,8 +217,6 @@ TAO::HTIOP::Transport::tear_listen_point_list (TAO_InputCDR &cdr) void TAO::HTIOP::Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) { - ACE_UNUSED_ARG (opdetails); - // Get a handle to the acceptor registry TAO_Acceptor_Registry &ar = this->orb_core ()->lane_resources ().acceptor_registry (); @@ -264,7 +231,7 @@ TAO::HTIOP::Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) acceptor++) { // Check whether it is a HTIOP acceptor - if ((*acceptor)->tag () == OCI_TAG_HTIOP_PROFILE) + if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) @@ -283,13 +250,12 @@ TAO::HTIOP::Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) TAO_OutputCDR cdr; // Marshall the information into the stream - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << listen_point_list) == 0) + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(cdr << listen_point_list)) return; // Add this info in to the svc_list - opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, - cdr); + opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, cdr); return; } diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h index 51b035662ce..242d7c16eea 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h @@ -114,13 +114,6 @@ namespace TAO TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait = 0); - // @@ This is probably not needed - Priyanka - // This is needed because we want to send additional information - // such as session id etc. in the header. - virtual int generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg); - virtual int tear_listen_point_list (TAO_InputCDR &cdr); virtual TAO_Connection_Handler * connection_handler_i (void); diff --git a/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp index d9948085b90..532c7b4c749 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp @@ -196,7 +196,6 @@ TAO_ConstantDef_i::value_i (void) CORBA::NO_MEMORY ()); retval->replace (impl); - safety.release (); return retval; } @@ -243,6 +242,7 @@ TAO_ConstantDef_i::value_i (const CORBA::Any &value) TAO_InputCDR in (out); mb = in.steal_contents (); } + ACE_Auto_Ptr<ACE_Message_Block> safe (mb); CORBA::TCKind kind = val_tc->kind (); diff --git a/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp index b378fe7f12a..85832e59248 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp @@ -598,9 +598,10 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, } case CORBA::dk_Native: { - container_impl.create_native_i (new_id.c_str (), - new_name, - new_version); + CORBA::NativeDef_var new_defn = + container_impl.create_native_i (new_id.c_str (), + new_name, + new_version); break; } case CORBA::dk_ValueBox: @@ -613,9 +614,9 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, CORBA::ValueBoxDef_var new_defn = container_impl.create_value_box_i (new_id.c_str (), - new_name, - new_version, - otype.in ()); + new_name, + new_version, + otype.in ()); ACE_TString new_path = TAO_IFR_Service_Utils::reference_to_path (new_defn.in ()); @@ -750,11 +751,12 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, CORBA::Any_var value = impl.value_i (); - container_impl.create_constant_i (new_id.c_str (), - new_name, - new_version, - type_def.in (), - value.in ()); + CORBA::ConstantDef_var new_defn = + container_impl.create_constant_i (new_id.c_str (), + new_name, + new_version, + type_def.in (), + value.in ()); break; } case CORBA::dk_Attribute: @@ -773,11 +775,12 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_InterfaceDef_i idef (this->repo_); idef.section_key (container_key); - idef.create_attribute_i (new_id.c_str (), - new_name, - new_version, - type_def.in (), - mode); + CORBA::AttributeDef_var new_defn = + idef.create_attribute_i (new_id.c_str (), + new_name, + new_version, + type_def.in (), + mode); break; } else if (container_dk == CORBA::dk_Value) @@ -785,11 +788,12 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_ValueDef_i vdef (this->repo_); vdef.section_key (container_key); - vdef.create_attribute_i (new_id.c_str (), - new_name, - new_version, - type_def.in (), - mode); + CORBA::AttributeDef_var new_defn = + vdef.create_attribute_i (new_id.c_str (), + new_name, + new_version, + type_def.in (), + mode); break; } else @@ -824,14 +828,15 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_InterfaceDef_i idef (this->repo_); idef.section_key (container_key); - idef.create_operation_i (new_id.c_str (), - new_name, - new_version, - result.in (), - mode, - params.in (), - exceptions.in (), - contexts.in ()); + CORBA::OperationDef_var new_defn = + idef.create_operation_i (new_id.c_str (), + new_name, + new_version, + result.in (), + mode, + params.in (), + exceptions.in (), + contexts.in ()); break; } else if (container_dk == CORBA::dk_Value) @@ -839,14 +844,15 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_ValueDef_i vdef (this->repo_); impl.section_key (container_key); - vdef.create_operation_i (new_id.c_str (), - new_name, - new_version, - result.in (), - mode, - params.in (), - exceptions.in (), - contexts.in ()); + CORBA::OperationDef_var new_defn = + vdef.create_operation_i (new_id.c_str (), + new_name, + new_version, + result.in (), + mode, + params.in (), + exceptions.in (), + contexts.in ()); break; } else diff --git a/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp index 7abc1365f09..88b28241e80 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp @@ -844,6 +844,7 @@ TAO_Container_i::create_constant_i (const char *id, TAO_InputCDR in (out); mb = in.steal_contents (); } + ACE_Auto_Ptr<ACE_Message_Block> safe (mb); CORBA::TypeCode_var val_tc = value.type (); diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp index 2760bbf711e..cc0788b558a 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp @@ -860,15 +860,18 @@ TAO_Log_Constraint_Visitor::visit_binary_op ( this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_LE: - result = left_operand <= right_operand; + //result = left_operand <= right_operand; // Compile error on LynxOS + result = left_operand.operator<= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GT: - result = left_operand > right_operand; + //result = left_operand > right_operand; // Compile error on LynxOS + result = left_operand.operator> (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GE: - result = left_operand >= right_operand; + //result = left_operand >= right_operand; // Compile error on LynxOS + result = left_operand.operator>= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_EQ: @@ -876,7 +879,8 @@ TAO_Log_Constraint_Visitor::visit_binary_op ( this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_NE: - result = left_operand != right_operand; + //result = left_operand != right_operand; // Compile error on LynxOS + result = left_operand.operator!= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_PLUS: diff --git a/TAO/orbsvcs/orbsvcs/Makefile.am b/TAO/orbsvcs/orbsvcs/Makefile.am index 0bf28dea9b4..e729c32dcf9 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile.am +++ b/TAO/orbsvcs/orbsvcs/Makefile.am @@ -2209,6 +2209,7 @@ libTAO_CosNotification_Serv_la_SOURCES = \ Notify/Topology_Loader.cpp \ Notify/Topology_Object.cpp \ Notify/Topology_Saver.cpp \ + Notify/Validate_Client_Task.cpp \ Notify/Worker_Task.cpp libTAO_CosNotification_Serv_la_LDFLAGS = \ @@ -2336,6 +2337,7 @@ nobase_include_HEADERS += \ Notify/Topology_Object.h \ Notify/Topology_Object.inl \ Notify/Topology_Saver.h \ + Notify/Validate_Client_Task.h \ Notify/Worker_Task.h \ Notify/notify_serv_export.h diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp index a0969d81032..6580e815f82 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp @@ -1,5 +1,6 @@ // $Id$ #include "orbsvcs/Notify/Admin.h" +#include "orbsvcs/Notify/Validate_Worker_T.h" #if ! defined (__ACE_INLINE__) #include "orbsvcs/Notify/Admin.inl" @@ -54,6 +55,8 @@ TAO_Notify_Admin::init (TAO_Notify::Topology_Parent* parent) this->ec_.reset (dynamic_cast<TAO_Notify_EventChannel *>(parent)); ACE_ASSERT (this->ec_.get() != 0); + filter_admin_.event_channel (this->ec_.get ()); + // this-> on the following line confuses VC6 initialize (parent); @@ -217,4 +220,13 @@ TAO_Notify_Admin::reconnect (void) this->proxy_container().collection()->for_each(&wrk); } +void +TAO_Notify_Admin::validate () +{ + TAO_Notify::Validate_Worker<TAO_Notify_Proxy> wrk; + this->proxy_container().collection()->for_each(&wrk); +} + + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.h b/TAO/orbsvcs/orbsvcs/Notify/Admin.h index 62037ff3c31..1962d352465 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.h @@ -84,6 +84,8 @@ public: CORBA::Long id, const TAO_Notify::NVPList& attrs); virtual void reconnect (void); + virtual void validate (); + void set_default (bool is_default); bool is_default () const; virtual void load_attrs(const TAO_Notify::NVPList& attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp index 0e8748971d8..bc2f3b9dca9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp @@ -75,4 +75,21 @@ TAO_Notify_CosEC_ProxyPushConsumer::get_proxy_type_name (void) const return "ec_proxy_push_consumer"; } +void +TAO_Notify_CosEC_ProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_CosEC_ProxyPushConsumer::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_push_consumer (); + } +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h index cafba3d2966..709814adafc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h @@ -50,6 +50,7 @@ public: virtual const char * get_proxy_type_name (void) const; + virtual void validate (); protected: ///= CosNotifyChannelAdmin::ProxyPushConsumer methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp index ed6577d57fa..9d5a71b02ee 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp @@ -52,4 +52,20 @@ TAO_Notify_CosEC_ProxyPushSupplier::get_proxy_type_name (void) const return "ec_proxy_push_supplier"; } +void +TAO_Notify_CosEC_ProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_CosEC_ProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + this->disconnect_push_supplier (); + } +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h index 8ae6fee1b81..3c3126755f3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h @@ -63,6 +63,8 @@ public: virtual void disconnect_push_supplier ( ); + virtual void validate (); + private: /// Release virtual void release (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp index c710bc98b03..71ea3de5a78 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp @@ -79,6 +79,23 @@ TAO_Notify_ProxyPushConsumer::get_proxy_type_name (void) const } void +TAO_Notify_ProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_ProxyPushConsumer::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + this->disconnect_push_consumer (); + } +} + + +void TAO_Notify_ProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h index 5282b4807d9..107abc5326d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h @@ -55,6 +55,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); protected: ///= CosNotifyChannelAdmin::ProxyPushConsumer methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp index 02cb590b026..3f2686319fa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp @@ -61,6 +61,23 @@ TAO_Notify_ProxyPushSupplier::get_proxy_type_name (void) const } void +TAO_Notify_ProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_ProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_push_supplier (); + } +} + +void TAO_Notify_ProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h index 777422bf456..87bea7a33b6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h @@ -58,6 +58,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); // = Interface methods virtual CosNotifyChannelAdmin::ProxyType MyType (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp index 615c364ffef..dd6ec81d500 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp @@ -110,6 +110,7 @@ TAO_Notify_PushConsumer::push (const CORBA::Any& payload) } //--cj end + last_ping_ = ACE_OS::gettimeofday (); this->push_consumer_->push (payload); } @@ -120,6 +121,7 @@ TAO_Notify_PushConsumer::push (const CosNotification::StructuredEvent& event) TAO_Notify_Event::translate (event, any); + last_ping_ = ACE_OS::gettimeofday (); this->push_consumer_->push (any); } @@ -159,4 +161,10 @@ TAO_Notify_PushConsumer::reconnect_from_consumer (TAO_Notify_Consumer* old_consu this->schedule_timer(false); } +CORBA::Object_ptr +TAO_Notify_PushConsumer::get_consumer (void) +{ + return CosEventComm::PushConsumer::_duplicate (this->push_consumer_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h index c06c2dc1b70..0e88ccdfdfc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h @@ -63,6 +63,9 @@ public: TAO_Notify_Consumer* old_consumer); protected: + + virtual CORBA::Object_ptr get_consumer (void); + /// The Consumer CosEventComm::PushConsumer_var push_consumer_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp index fce47748b90..8a7db5acc4f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp @@ -57,4 +57,10 @@ TAO_Notify_PushSupplier::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_PushSupplier::get_supplier (void) +{ + return CosEventComm::PushSupplier::_duplicate (this->push_supplier_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h index c5f75c1e234..7ffbc3e1463 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h @@ -49,6 +49,9 @@ public: virtual ACE_CString get_ior (void) const; protected: + + virtual CORBA::Object_ptr get_supplier (void); + /// The Supplier CosEventComm::PushSupplier_var push_supplier_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp index 712897a1756..1f4f9076557 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -166,9 +166,9 @@ TAO_Notify_Builder::~TAO_Notify_Builder () } CosNotifyFilter::FilterFactory_ptr -TAO_Notify_Builder::build_filter_factory (PortableServer::POA_ptr poa) +TAO_Notify_Builder::build_filter_factory (PortableServer::POA_ptr poa, TAO_Notify_FilterFactory*& ff) { - TAO_Notify_FilterFactory* ff = ACE_Dynamic_Service<TAO_Notify_FilterFactory>::instance ("TAO_Notify_FilterFactory"); + ff = ACE_Dynamic_Service<TAO_Notify_FilterFactory>::instance ("TAO_Notify_FilterFactory"); if (ff == 0) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.h b/TAO/orbsvcs/orbsvcs/Notify/Builder.h index 6fe36a0234d..b0fba2e3b29 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.h @@ -61,7 +61,7 @@ public: /// Build the Filter Factory. virtual CosNotifyFilter::FilterFactory_ptr - build_filter_factory (PortableServer::POA_ptr poa); + build_filter_factory (PortableServer::POA_ptr poa, TAO_Notify_FilterFactory*& ff); /// Build EventChannel. virtual CosNotifyChannelAdmin::EventChannel_ptr diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp index 28a5d234bfb..79638daa595 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp @@ -11,11 +11,14 @@ ACE_RCSID (RT_Notify, TAO_Notify_Consumer, "$Id$") #include "orbsvcs/Notify/Timer.h" #include "orbsvcs/Notify/ProxySupplier.h" #include "orbsvcs/Notify/Method_Request_Event.h" +#include "orbsvcs/Notify/QoSProperties.h" +#include "orbsvcs/Notify/Properties.h" #include "orbsvcs/Time_Utilities.h" #include "tao/debug.h" #include "tao/corba.h" +#include "tao/Messaging/Messaging_TypesC.h" #include "ace/Bound_Ptr.h" #include "ace/Unbounded_Queue.h" @@ -42,6 +45,10 @@ TAO_Notify_Consumer::TAO_Notify_Consumer (TAO_Notify_ProxySupplier* proxy) this->pending_events_.reset( pending_events ); this->timer_.reset( this->proxy ()->timer () ); + + // Enable reference counting on the event handler. + this->reference_counting_policy ().value ( + ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } TAO_Notify_Consumer::~TAO_Notify_Consumer () @@ -53,6 +60,18 @@ TAO_Notify_Consumer::~TAO_Notify_Consumer () } } +CORBA::ULong +TAO_Notify_Consumer::_incr_refcnt (void) +{ + return this->add_reference(); +} + +CORBA::ULong +TAO_Notify_Consumer::_decr_refcnt (void) +{ + return this->remove_reference(); +} + TAO_Notify_Proxy* TAO_Notify_Consumer::proxy (void) { @@ -616,6 +635,10 @@ TAO_Notify_Consumer::schedule_timer (bool is_error) static_cast<int> (this->proxy ()->id ()) )); } + if (this->is_suspended()) // double check to avoid race + { + this->cancel_timer(); + } } void @@ -637,14 +660,17 @@ TAO_Notify_Consumer::cancel_timer (void) int TAO_Notify_Consumer::handle_timeout (const ACE_Time_Value&, const void*) { - TAO_Notify_Consumer::Ptr grd (this); - this->timer_id_ = -1; // This must come first, because dispatch_pending may try to resched - try - { - this->dispatch_pending (); - } - catch (...) + if (!this->is_suspended() && this->timer_.isSet() && this->timer_id_ != -1) { + TAO_Notify_Consumer::Ptr grd (this); + this->timer_id_ = -1; // This must come first, because dispatch_pending may try to resched + try + { + this->dispatch_pending (); + } + catch (...) + { + } } return 0; @@ -653,6 +679,7 @@ TAO_Notify_Consumer::handle_timeout (const ACE_Time_Value&, const void*) void TAO_Notify_Consumer::shutdown (void) { + this->suspend(); if (this->timer_.isSet ()) { this->cancel_timer (); @@ -705,6 +732,93 @@ TAO_Notify_Consumer::assume_pending_events (TAO_Notify_Consumer& rhs) // timer value (unless we have a valid pacing interval). this->schedule_timer (); } + if (this->is_suspended()) // double check to avoid race + { + this->cancel_timer(); + } +} + +bool +TAO_Notify_Consumer::is_alive (bool allow_nil_consumer) +{ + bool status = false; + CORBA::Object_var consumer = this->get_consumer (); + if (CORBA::is_nil (consumer.in ())) + { + // The consumer may not connected or the consumer did + // not provide a callback. In this case, the liveliness + // check should return true so it will be validated in + // next period. + if (allow_nil_consumer) + return true; + else + return status; + } + + CORBA::PolicyList policy_list; + try + { + bool do_liveliness_check = false; + ACE_Time_Value now = ACE_OS::gettimeofday (); + + if (CORBA::is_nil (this->rtt_obj_.in ())) + { + // We need to determine if the consumer on the other end is still + // alive. Since we may be in an upcall from the owner of the + // original consumer, we have to put a timeout on the call in case + // the client side is not processing ORB requests at this time. In + // the event that the timeout exception occurs, we will assume that + // the original consumer is still around. If we get any other + // exception we will say that the original consumer is not + // available anymore. + TimeBase::TimeT timeout = 10000000; + CORBA::Any timeout_any; + timeout_any <<= timeout; + + policy_list.length (1); + policy_list[0] = TAO_Notify_PROPERTIES::instance()->orb()-> + create_policy ( + Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, + timeout_any); + rtt_obj_ = + consumer->_set_policy_overrides (policy_list, + CORBA::ADD_OVERRIDE); + + // Clean up the policy that was allocated in the try/catch + for (CORBA::ULong i = 0; i < policy_list.length (); i++) + policy_list[i]->destroy (); + + do_liveliness_check + = (last_ping_ == ACE_Time_Value::zero ? true + : now - last_ping_.value () >= TAO_Notify_PROPERTIES::instance()->validate_client_delay ()); + } + else + do_liveliness_check = + now - last_ping_.value () >= TAO_Notify_PROPERTIES::instance()->validate_client_interval (); + + if (CORBA::is_nil (rtt_obj_.in ())) + status = false; + else if (do_liveliness_check || allow_nil_consumer) + { + last_ping_ = now; + status = !rtt_obj_->_non_existent (); + } + else + status = true; + } + catch (CORBA::TIMEOUT&) + { + status = true; + } + catch (CORBA::Exception& ex) + { + if (DEBUG_LEVEL > 0) + { + ex._tao_print_exception ("TAO_Notify_Consumer::is_alive: false"); + } + } + + return status; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h index a81c6e22b02..154303efacb 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h @@ -27,7 +27,7 @@ #include "orbsvcs/Notify/Event.h" #include "orbsvcs/Notify/Timer.h" #include "ace/Event_Handler.h" - +#include "ace/Atomic_Op.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -57,12 +57,19 @@ public: }; public: + +typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Consumer > Ptr; + /// Constructor TAO_Notify_Consumer (TAO_Notify_ProxySupplier* proxy); /// Destructor virtual ~TAO_Notify_Consumer (); + /// This method sigantures deliberately match the RefCounting methods required for ESF Proxy + CORBA::ULong _incr_refcnt (void); + CORBA::ULong _decr_refcnt (void); + /// Access Specific Proxy. TAO_Notify_ProxySupplier* proxy_supplier (void); @@ -110,8 +117,17 @@ public: /// schedule our timer. The caller should have locked the proxy lock /// before calling this method. void assume_pending_events (TAO_Notify_Consumer& rhs); + + /// Is the connected consumer still around? + bool is_alive (bool allow_nil_consumer); + protected: + + /// This method is called by the is_alive() method. It should provide + /// the connected consumer or nil if there is none. + virtual CORBA::Object_ptr get_consumer (void) = 0; + typedef ACE_Unbounded_Queue<TAO_Notify_Method_Request_Event_Queueable *> Request_Queue; DispatchStatus dispatch_request (TAO_Notify_Method_Request_Event * request); @@ -182,10 +198,16 @@ protected: /// The Timer Manager that we use. TAO_Notify_Timer::Ptr timer_; + /// Last time either push an event or validate connection + /// via _non_exist call. + ACE_Atomic_Op<TAO_SYNCH_MUTEX, ACE_Time_Value> last_ping_; + private: /// Events pending to be delivered. ACE_Auto_Ptr< Request_Queue > pending_events_; + + CORBA::Object_var rtt_obj_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp index c8843b836c5..fd77dc396f7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp @@ -267,7 +267,7 @@ TAO_Notify_ConsumerAdmin::add_filter (CosNotifyFilter::Filter_ptr new_filter) { CosNotifyFilter::FilterID fid = this->filter_admin_.add_filter (new_filter); - this->self_change (); + this->self_change (); return fid; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp index b9cfff8d090..261d117eee3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp @@ -180,6 +180,50 @@ TAO_CosNotify_Service::init (int argc, ACE_TCHAR *argv[]) properties->defaultSupplierAdminFilterOp (op); arg_shifter.consume_arg (); } + else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClient")) == 0) + { + arg_shifter.consume_arg (); + TAO_Notify_PROPERTIES::instance()->validate_client (true); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using reactive client control.\n"))); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClientDelay")) == 0) + { + current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ValidateClientDelay")); + if (current_arg != 0) + { + ACE_Time_Value tv (ACE_OS::atoi (current_arg)); + TAO_Notify_PROPERTIES::instance()->validate_client_delay (tv); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") + ACE_TEXT ("argument (%s). Ignoring invalid ") + ACE_TEXT ("-ValidateClientDelay usage.\n"), + (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); + } + if (current_arg != 0) + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClientInterval")) == 0) + { + current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ValidateClientInterval")); + if (current_arg != 0) + { + ACE_Time_Value tv (ACE_OS::atoi (current_arg)); + TAO_Notify_PROPERTIES::instance()->validate_client_interval (tv); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") + ACE_TEXT ("argument (%s). Ignoring invalid ") + ACE_TEXT ("-ValidateClientDelay usage.\n"), + (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); + } + if (current_arg != 0) + arg_shifter.consume_arg (); + } else { ACE_ERROR ((LM_ERROR, @@ -341,6 +385,12 @@ TAO_CosNotify_Service::finalize_service ( // We're shutting things down, so ignore exceptions } } + + TAO_Notify_EventChannelFactory* necf = + dynamic_cast<TAO_Notify_EventChannelFactory*> (ecf->_servant ()); + if (necf != 0) + necf->stop_validator(); + } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp index 85caa64ae99..f49d421f8da 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp @@ -9,37 +9,130 @@ ACE_RCSID(Notify, #include "ace/Auto_Ptr.h" #include "tao/debug.h" #include "orbsvcs/Notify/Notify_Constraint_Visitors.h" +#include "orbsvcs/Notify/Topology_Saver.h" + +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL TAO_debug_level +#endif //DEBUG_LEVEL TAO_BEGIN_VERSIONED_NAMESPACE_DECL -TAO_Notify_ETCL_Filter::TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa) - : constraint_expr_ids_ (0), - poa_ (PortableServer::POA::_duplicate (poa)) +TAO_Notify_Constraint_Expr::TAO_Notify_Constraint_Expr (void) +{ +} + + +TAO_Notify_Constraint_Expr::~TAO_Notify_Constraint_Expr () +{ +} + + +void +TAO_Notify_Constraint_Expr::save_persistent ( + TAO_Notify::Topology_Saver& saver) +{ + CosNotification::EventTypeSeq& event_types = this->constr_expr.event_types; + CORBA::ULong len = event_types.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + TAO_Notify::NVPList attrs; + bool changed = true; + + attrs.push_back(TAO_Notify::NVP("Domain", event_types[i].domain_name.in())); + attrs.push_back(TAO_Notify::NVP("Type", event_types[i].type_name.in())); + saver.begin_object(0, "EventType", attrs, changed); + saver.end_object(0, "EventType"); + } +} + + +void +TAO_Notify_Constraint_Expr::load_attrs( + const TAO_Notify::NVPList& attrs) +{ + TAO_Notify_Object::load_attrs (attrs); + const char* expr = 0; + if (attrs.find ("Expression", expr)) + { + this->constr_expr.constraint_expr = CORBA::string_dup (expr); + } +} + + +TAO_Notify::Topology_Object* +TAO_Notify_Constraint_Expr::load_child ( + const ACE_CString &type, + CORBA::Long id, + const TAO_Notify::NVPList& attrs) { + ACE_UNUSED_ARG (id); + TAO_Notify::Topology_Object* result = this; + if (type == "EventType") + { + const char* domain = 0; + const char* type = 0; + attrs.find ("Domain", domain); + attrs.find ("Type", type); + + CORBA::ULong len = this->constr_expr.event_types.length (); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) reload EventType %d \n"), + len + 1)); + + this->constr_expr.event_types.length (len + 1); + this->constr_expr.event_types[len].domain_name = CORBA::string_dup (domain); + this->constr_expr.event_types[len].type_name = CORBA::string_dup (type); + + this->interpreter.build_tree (this->constr_expr); + } + + return result; } + +void +TAO_Notify_Constraint_Expr::release (void) +{ + delete this; + //@@ inform factory +} + + + +TAO_Notify_ETCL_Filter::TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa, + const char *constraint_grammar, + const TAO_Notify_Object::ID& id) + :constraint_expr_ids_ (0), + poa_ (PortableServer::POA::_duplicate (poa)), + id_ (id), + grammar_ (constraint_grammar) +{ +} + + TAO_Notify_ETCL_Filter::~TAO_Notify_ETCL_Filter () { try { - this->remove_all_constraints (); + this->destroy(); } catch (const CORBA::Exception&) { if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, "Error in Filter dtor\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Error in Filter dtor\n"))); // @@ eat exception. } if (TAO_debug_level > 1) - ACE_DEBUG ((LM_DEBUG, "Filter Destroyed\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Filter Destroyed\n"))); } char* TAO_Notify_ETCL_Filter::constraint_grammar (void) { - return CORBA::string_dup ("ETCL"); + return CORBA::string_dup (this->grammar_.c_str ()); } void @@ -48,33 +141,78 @@ TAO_Notify_ETCL_Filter::add_constraints_i ( { for (CORBA::ULong index = 0; index < constraint_info_seq.length (); ++index) { - TAO_Notify_Constraint_Expr* notify_constr_expr = 0; + this->add_constraint_i (constraint_info_seq[index]); + } +} - ACE_NEW_THROW_EX (notify_constr_expr, - TAO_Notify_Constraint_Expr (), - CORBA::NO_MEMORY ()); - auto_ptr <TAO_Notify_Constraint_Expr> auto_expr (notify_constr_expr); +TAO_Notify_Constraint_Expr* +TAO_Notify_ETCL_Filter::add_constraint_i (CosNotifyFilter::ConstraintID cnstr_id) +{ + TAO_Notify_Constraint_Expr* notify_constr_expr = 0; - const CosNotifyFilter::ConstraintExp& expr = - constraint_info_seq[index].constraint_expression; + ACE_NEW_THROW_EX (notify_constr_expr, + TAO_Notify_Constraint_Expr (), + CORBA::NO_MEMORY ()); + auto_ptr <TAO_Notify_Constraint_Expr> auto_expr (notify_constr_expr); - notify_constr_expr->interpreter. - build_tree (expr.constraint_expr.in ()); + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Added an empty constraint to filter\n"))); - notify_constr_expr->constr_expr = expr; + if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) + throw CORBA::INTERNAL (); - CosNotifyFilter::ConstraintID cnstr_id = ++constraint_expr_ids_; + auto_expr.release (); - if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) - throw CORBA::INTERNAL (); + return notify_constr_expr; +} - if (TAO_debug_level > 1) - ACE_DEBUG ((LM_DEBUG, "Added constraint to filter %x\n", this, expr.constraint_expr.in ())); - auto_expr.release (); - } +void +TAO_Notify_ETCL_Filter::add_constraint_i + (const CosNotifyFilter::ConstraintInfo& constraint, + CosNotifyFilter::ConstraintID cnstr_id + ) +{ + TAO_Notify_Constraint_Expr* notify_constr_expr = 0; + + ACE_NEW_THROW_EX (notify_constr_expr, + TAO_Notify_Constraint_Expr (), + CORBA::NO_MEMORY ()); + auto_ptr <TAO_Notify_Constraint_Expr> auto_expr (notify_constr_expr); + + const CosNotifyFilter::ConstraintExp& expr = + constraint.constraint_expression; + + notify_constr_expr->interpreter. + build_tree (expr); + + notify_constr_expr->constr_expr = expr; + + if (cnstr_id == 0) + { + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Added constraint %s to filter %d\n"), + expr.constraint_expr.in (), this->id_)); + + cnstr_id = ++constraint_expr_ids_; + } + else + { + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Loaded constraint %s to filter %d\n"), + expr.constraint_expr.in (), this->id_)); + } + + if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) + throw CORBA::INTERNAL (); + + auto_expr.release (); } + CosNotifyFilter::ConstraintInfoSeq* TAO_Notify_ETCL_Filter::add_constraints ( const CosNotifyFilter::ConstraintExpSeq& constraint_list) @@ -85,7 +223,8 @@ TAO_Notify_ETCL_Filter::add_constraints ( CORBA::ULong constraint_length = constraint_list.length (); if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "constraint_length = %d\n", + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("constraint_length = %d\n"), constraint_length)); // Create the list that goes out. @@ -106,7 +245,7 @@ TAO_Notify_ETCL_Filter::add_constraints ( if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "Adding constraint %d, %s\n", + ACE_TEXT ("Adding constraint %d, %C\n"), pop_index, constraint_list [pop_index].constraint_expr.in ())); } @@ -195,6 +334,8 @@ TAO_Notify_ETCL_Filter::modify_constraints ( { delete constr_saved[index]; } + + this->self_change (); } CosNotifyFilter::ConstraintInfoSeq* @@ -304,11 +445,14 @@ TAO_Notify_ETCL_Filter::destroy (void) ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ()); - this->remove_all_constraints_i (); + if (CORBA::is_nil (this->poa_.in())) + return; - PortableServer::ObjectId_var refTemp = poa_->servant_to_id (this); + this->remove_all_constraints_i (); - poa_->deactivate_object (refTemp.in ()); + PortableServer::ObjectId_var refTemp = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (refTemp.in ()); + this->poa_ = PortableServer::POA::_nil(); } CORBA::Boolean @@ -378,4 +522,94 @@ TAO_Notify_ETCL_Filter::get_callbacks (void) throw CORBA::NO_IMPLEMENT (); } + +void +TAO_Notify_ETCL_Filter::save_persistent (TAO_Notify::Topology_Saver& saver) +{ + TAO_Notify::NVPList attrs; + bool changed = true; + attrs.push_back(TAO_Notify::NVP("FilterId", this->id_)); + attrs.push_back(TAO_Notify::NVP("Grammar", this->constraint_grammar())); + saver.begin_object(0, "filter", attrs, changed); + + { + int index = 0; + CONSTRAINT_EXPR_LIST::ITERATOR iterator (this->constraint_expr_list_); + + for (CONSTRAINT_EXPR_LIST::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance (), ++index) + { + TAO_Notify::NVPList attrs; + bool changed = true; + attrs.push_back(TAO_Notify::NVP("ConstraintId", entry->ext_id_)); + attrs.push_back(TAO_Notify::NVP("Expression", + entry->int_id_->constr_expr.constraint_expr.in ())); + saver.begin_object(0, "constraint", attrs, changed); + + entry->int_id_->save_persistent (saver); + + saver.end_object(0, "constraint"); + } + + saver.end_object(0, "filter"); + } +} + + +void +TAO_Notify_ETCL_Filter::release (void) +{ + delete this; + //@@ inform factory +} + + +void +TAO_Notify_ETCL_Filter::load_attrs(const TAO_Notify::NVPList& attrs) +{ + const char* value = 0; + TAO_Notify_Object::load_attrs (attrs); + if (attrs.find ("FilterId", value)) + { + ACE_ASSERT (this->id_ == ACE_OS::atoi (value)); + } + + if (attrs.find ("Grammar", value)) + { + this->grammar_ = value; + } +} + +TAO_Notify::Topology_Object* +TAO_Notify_ETCL_Filter::load_child (const ACE_CString &type, + CORBA::Long id, const TAO_Notify::NVPList& attrs) +{ + ACE_UNUSED_ARG (id); + + TAO_Notify::Topology_Object* result = this; + if (type == "constraint") + { + const char* value = 0; + if (attrs.find ("ConstraintId", value)) + { + TAO_Notify_Object::ID id = ACE_OS::atoi (value); + constraint_expr_ids_ = id; + + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) reload filter %d constraint %d\n"), + static_cast<int> (this->id_), static_cast<int> (id))); + + TAO_Notify_Constraint_Expr* expr + = this->add_constraint_i (id); + expr->load_attrs (attrs); + + return expr; + } + } + return result; +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h index 38fb8b0f5cc..3dc1b144832 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h @@ -22,6 +22,7 @@ #include "ace/Atomic_Op.h" #include "orbsvcs/CosNotifyFilterS.h" #include "orbsvcs/Notify/Notify_Constraint_Interpreter.h" +#include "orbsvcs/Notify/Topology_Object.h" #include "ace/Null_Mutex.h" #if defined(_MSC_VER) @@ -31,6 +32,44 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_ETCL_Filter; + +class TAO_Notify_Constraint_Expr : public TAO_Notify::Topology_Object +{ +public: + + friend class TAO_Notify_ETCL_Filter; + + TAO_Notify_Constraint_Expr (void); + virtual ~TAO_Notify_Constraint_Expr (); + + void save_persistent ( + TAO_Notify::Topology_Saver& saver); + + + void load_attrs( + const TAO_Notify::NVPList& attrs); + + TAO_Notify::Topology_Object* load_child ( + const ACE_CString &type, + CORBA::Long id, + const TAO_Notify::NVPList& attrs); + + +private: + /// Release this object. + virtual void release (void); + + // = DESCRIPTION + // Structure for associating ConstraintInfo with an interpreter. + // + CosNotifyFilter::ConstraintExp constr_expr; + // Constraint Expression. + + TAO_Notify_Constraint_Interpreter interpreter; + // Constraint Interpreter. +}; + /** * @class TAO_ETCL_Filter * @@ -38,15 +77,23 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * */ class TAO_Notify_Serv_Export TAO_Notify_ETCL_Filter - : public POA_CosNotifyFilter::Filter + : public POA_CosNotifyFilter::Filter, + public TAO_Notify::Topology_Object { public: /// Constructor - TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa); + TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa, + const char *constraint_grammar, + const TAO_Notify_Object::ID& id); /// Destructor virtual ~TAO_Notify_ETCL_Filter (void); + virtual void save_persistent (TAO_Notify::Topology_Saver& saver); + void load_attrs(const TAO_Notify::NVPList& attrs); + TAO_Notify::Topology_Object* load_child (const ACE_CString &type, + CORBA::Long id, const TAO_Notify::NVPList& attrs); + protected: virtual char * constraint_grammar (void); @@ -76,21 +123,18 @@ protected: virtual CosNotifyFilter::CallbackIDSeq * get_callbacks (void); private: - void add_constraints_i (const CosNotifyFilter::ConstraintInfoSeq& constraint_info_seq); - void remove_all_constraints_i (void); + /// Release this object. + virtual void release (void); + + void add_constraints_i (const CosNotifyFilter::ConstraintInfoSeq& constraint_info_seq); + void add_constraint_i (const CosNotifyFilter::ConstraintInfo& constraint, + CosNotifyFilter::ConstraintID cnstr_id = 0); - /** - * Structure for associating ConstraintInfo with an interpreter. - */ - struct TAO_Notify_Constraint_Expr - { - /// Constraint Expression. - CosNotifyFilter::ConstraintExp constr_expr; + TAO_Notify_Constraint_Expr* + add_constraint_i (CosNotifyFilter::ConstraintID cnstr_id); - /// Constraint Interpreter. - TAO_Notify_Constraint_Interpreter interpreter; - }; + void remove_all_constraints_i (void); /// Lock to serialize access to data members. TAO_SYNCH_MUTEX lock_; @@ -100,13 +144,17 @@ private: /// A list of the constraints stored in this filter. typedef ACE_Hash_Map_Manager <CosNotifyFilter::ConstraintID, - TAO_Notify_ETCL_Filter::TAO_Notify_Constraint_Expr*, + TAO_Notify_Constraint_Expr*, ACE_SYNCH_NULL_MUTEX> CONSTRAINT_EXPR_LIST; CONSTRAINT_EXPR_LIST constraint_expr_list_; PortableServer::POA_var poa_; + + TAO_Notify_Object::ID id_; + + ACE_CString grammar_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp index 2d2b79d9f26..30ce99ba192 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp @@ -5,6 +5,15 @@ ACE_RCSID(Notify, TAO_Notify_ETCL_FilterFactory, "$Id$") #include "orbsvcs/Notify/ETCL_Filter.h" +#include "orbsvcs/Notify/Properties.h" +#include "tao/debug.h" + + +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL TAO_debug_level +#endif //DEBUG_LEVEL + + TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -15,22 +24,62 @@ TAO_Notify_ETCL_FilterFactory::TAO_Notify_ETCL_FilterFactory (void) : TAO_Notify_ETCL_FilterFactory::~TAO_Notify_ETCL_FilterFactory () { + FILTERMAP::ITERATOR iterator (this->filters_); + + for (FILTERMAP::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance ()) + { + delete entry->int_id_; + entry->int_id_ = 0; + } + + this->filters_.unbind_all (); + } CosNotifyFilter::FilterFactory_ptr TAO_Notify_ETCL_FilterFactory::create (PortableServer::POA_ptr filter_poa) { - this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); // save the filter poa. - - PortableServer::ServantBase_var servant_var (this); + this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); - PortableServer::ObjectId_var id = filter_poa->activate_object (this); + CORBA::Object_var object = CORBA::Object::_nil(); + try + { + PortableServer::ObjectId_var id = filter_poa->activate_object (this); + object = filter_poa->id_to_reference (id.in()); + } + catch (PortableServer::POA::ServantAlreadyActive&) + { + try + { + object = filter_poa->servant_to_reference (this); + } + catch (CORBA::Exception& ) + { + return CosNotifyFilter::FilterFactory::_nil(); + } + } - CORBA::Object_var object = filter_poa->id_to_reference (id.in ()); + return CosNotifyFilter::FilterFactory::_narrow (object.in ()); +} - CosNotifyFilter::FilterFactory_var filter = CosNotifyFilter::FilterFactory::_narrow (object.in ()); +void +TAO_Notify_ETCL_FilterFactory::destroy (void) +{ + if (CORBA::is_nil(this->filter_poa_.in ())) + return; + PortableServer::ServantBase_var guard(this); + try + { + PortableServer::ObjectId_var id = + this->filter_poa_->servant_to_id (this); + this->filter_poa_->deactivate_object (id.in()); + } + catch (CORBA::Exception&) + { + } - return filter._retn(); } CosNotifyFilter::Filter_ptr @@ -42,18 +91,50 @@ TAO_Notify_ETCL_FilterFactory::create_filter (const char *constraint_grammar) ACE_OS::strcmp (constraint_grammar, "EXTENDED_TCL") != 0) throw CosNotifyFilter::InvalidGrammar (); - // Create the RefCounted servant. + TAO_Notify_Object::ID id = filter_ids_.id (); TAO_Notify_ETCL_Filter* filter = 0; + return this->create_filter (constraint_grammar, id, filter); +} - ACE_NEW_THROW_EX (filter, - TAO_Notify_ETCL_Filter (this->filter_poa_.in ()), - CORBA::NO_MEMORY ()); - PortableServer::ServantBase_var filter_var (filter); +CosNotifyFilter::Filter_ptr +TAO_Notify_ETCL_FilterFactory::create_filter ( + const char *constraint_grammar, + const TAO_Notify_Object::ID& id, + TAO_Notify_ETCL_Filter*& filter) +{ + // Create the RefCounted servant. + filter = 0; - PortableServer::ObjectId_var oid = - this->filter_poa_->activate_object (filter); + ACE_NEW_THROW_EX (filter, + TAO_Notify_ETCL_Filter (this->filter_poa_.in (), + constraint_grammar, + id), + CORBA::NO_MEMORY ()); + if (filters_.bind (id, filter) == -1) + { + throw CORBA::INTERNAL (); + return 0; + } + + PortableServer::ObjectId_var oid; + try + { + oid = this->filter_poa_->activate_object (filter); + } + catch (PortableServer::POA::ServantAlreadyActive&) + { + try + { + oid = this->filter_poa_->servant_to_id (filter); + } + catch (CORBA::Exception& ) + { + throw CORBA::INTERNAL (); + return 0; + } + } CORBA::Object_var obj = this->filter_poa_->id_to_reference (oid.in ()); @@ -69,4 +150,110 @@ TAO_Notify_ETCL_FilterFactory::create_mapping_filter (const char * /*constraint_ TAO_END_VERSIONED_NAMESPACE_DECL + +void +TAO_Notify_ETCL_FilterFactory::save_persistent (TAO_Notify::Topology_Saver& saver) +{ + bool changed = true; + TAO_Notify::NVPList attrs; // ECF has no attributes + saver.begin_object(0, "filter_factory", attrs, changed); + + if (this->filters_.current_size () > 0) + { + int index = 0; + FILTERMAP::ITERATOR iterator (this->filters_); + + for (FILTERMAP::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance (), ++index) + { + entry->int_id_->save_persistent (saver); + } + } + + saver.end_object(0, "filter_factory"); +} + + +TAO_Notify::Topology_Object* +TAO_Notify_ETCL_FilterFactory::load_child (const ACE_CString &type, + CORBA::Long id, const TAO_Notify::NVPList& attrs) +{ + ACE_UNUSED_ARG (id); + + TAO_Notify::Topology_Object* result = this; + if (type == "filter") + { + const char* value = 0; + if (attrs.find ("FilterId", value)) + { + TAO_Notify_Object::ID id = ACE_OS::atoi (value); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) reload filter %d\n"), + static_cast<int> (id) + )); + + filter_ids_.set_last_used (id); + + TAO_Notify_ETCL_Filter* filter = 0; + this->create_filter (0, id, filter); + filter->load_attrs (attrs); + + return filter; + } + } + return result; +} + + +void +TAO_Notify_ETCL_FilterFactory::release (void) +{ + delete this; + //@@ inform factory +} + + +TAO_Notify_Object::ID +TAO_Notify_ETCL_FilterFactory::get_filter_id (CosNotifyFilter::Filter_ptr filter) +{ + ::PortableServer::Servant svt + = this->filter_poa_->reference_to_servant (filter); + + FILTERMAP::ITERATOR iterator (this->filters_); + + for (FILTERMAP::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance ()) + { + if (svt == entry->int_id_) + return entry->ext_id_; + } + + throw CORBA::INTERNAL (); + return 0; +} + + +CosNotifyFilter::Filter_ptr +TAO_Notify_ETCL_FilterFactory::get_filter (const TAO_Notify_Object::ID& id) +{ + TAO_Notify_ETCL_Filter* filter = 0; + if (filters_.find (id, filter) == -1) + return CosNotifyFilter::Filter::_nil (); + else + { + CORBA::Object_var obj = + this->filter_poa_->servant_to_reference (filter + ); + + CosNotifyFilter::Filter_var filter + = CosNotifyFilter::Filter::_narrow (obj.in ()); + + return filter._retn (); + } +} + + ACE_FACTORY_DEFINE (TAO_Notify_Serv, TAO_Notify_ETCL_FilterFactory) diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h index 43761ff2456..ce95bb061ea 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h @@ -23,6 +23,10 @@ #include "orbsvcs/CosNotifyFilterS.h" #include "orbsvcs/Notify/FilterFactory.h" +#include "orbsvcs/Notify/ID_Factory.h" +#include "orbsvcs/Notify/ETCL_Filter.h" +#include "orbsvcs/Notify/Topology_Saver.h" + #if defined(_MSC_VER) #pragma warning(push) @@ -53,6 +57,8 @@ public: virtual CosNotifyFilter::FilterFactory_ptr create ( PortableServer::POA_ptr filter_poa); + virtual void destroy (void); + ///= CosNotifyFilter::FilterFactory methods virtual CosNotifyFilter::Filter_ptr create_filter ( @@ -62,9 +68,39 @@ public: const char * constraint_grammar, const CORBA::Any & default_value); + + virtual void save_persistent (TAO_Notify::Topology_Saver& saver); + + virtual TAO_Notify::Topology_Object* load_child ( + const ACE_CString &type, + CORBA::Long id, + const TAO_Notify::NVPList& attrs); + + virtual TAO_Notify_Object::ID get_filter_id (CosNotifyFilter::Filter_ptr filter); + virtual CosNotifyFilter::Filter_ptr get_filter (const TAO_Notify_Object::ID& id); + + protected: + + CosNotifyFilter::Filter_ptr + create_filter (const char *constraint_grammar, + const TAO_Notify_Object::ID& id, + TAO_Notify_ETCL_Filter*& filter); + + /// Release this object. + virtual void release (void); + /// The POA in which to activate the Filters. PortableServer::POA_var filter_poa_; + + /// Id generator for proxy suppliers + TAO_Notify_ID_Factory filter_ids_; + + typedef ACE_Hash_Map_Manager <TAO_Notify_Object::ID, + TAO_Notify_ETCL_Filter*, + TAO_SYNCH_MUTEX> FILTERMAP; + + FILTERMAP filters_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp index ca5fed68302..3e5e7aed22b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp @@ -17,6 +17,7 @@ #include "orbsvcs/Notify/Proxy.h" #include "orbsvcs/Notify/Event_Manager.h" #include "orbsvcs/Notify/POA_Helper.h" +#include "orbsvcs/Notify/Validate_Worker_T.h" #include "tao/debug.h" //#define DEBUG_LEVEL 9 @@ -48,6 +49,7 @@ TAO_Notify_EventChannel::TAO_Notify_EventChannel (void) , ca_container_ (0) , sa_container_ (0) , default_filter_factory_ (CosNotifyFilter::FilterFactory::_nil ()) + , default_filter_factory_servant_ (0) { } @@ -110,14 +112,17 @@ TAO_Notify_EventChannel::init (TAO_Notify_EventChannelFactory* ecf this->set_admin (initial_admin); - PortableServer::POA_var default_poa = TAO_Notify_PROPERTIES::instance ()->default_poa (); + PortableServer::POA_var default_poa = + TAO_Notify_PROPERTIES::instance ()->default_poa (); + this->default_filter_factory_ = - TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory (default_poa.in()); + TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory ( + default_poa.in(), this->default_filter_factory_servant_); - // Note originally default admins were allocated here, bt this caused problems - // attempting to save the topology changes before the Event Channel was completely - // constructed and linked to the ECF. - // Lazy evaluation also avoids creating unneded admins. + // Note originally default admins were allocated here, bt this + // caused problems attempting to save the topology changes before + // the Event Channel was completely constructed and linked to the + // ECF. Lazy evaluation also avoids creating unneded admins. } @@ -172,7 +177,8 @@ TAO_Notify_EventChannel::init (TAO_Notify::Topology_Parent* parent) PortableServer::POA_var default_poa = TAO_Notify_PROPERTIES::instance ()->default_poa (); this->default_filter_factory_ = - TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory (default_poa.in ()); + TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory ( + default_poa.in(), this->default_filter_factory_servant_); } @@ -235,6 +241,8 @@ TAO_Notify_EventChannel::destroy (void) this->ca_container_.reset( 0 ); this->default_filter_factory_ = CosNotifyFilter::FilterFactory::_nil(); + + this->default_filter_factory_servant_->destroy(); } void @@ -325,6 +333,12 @@ TAO_Notify_EventChannel::default_filter_factory (void) return CosNotifyFilter::FilterFactory::_duplicate (this->default_filter_factory_.in ()); } +TAO_Notify_FilterFactory* +TAO_Notify_EventChannel::default_filter_factory_servant () const +{ + return this->default_filter_factory_servant_; +} + ::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_Notify_EventChannel::new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id) @@ -442,6 +456,8 @@ TAO_Notify_EventChannel::save_persistent (TAO_Notify::Topology_Saver& saver) bool want_all_children = saver.begin_object( this->id(), "channel", attrs, changed); + + this->default_filter_factory_servant_->save_persistent (saver); TAO_Notify::Save_Persist_Worker<TAO_Notify_ConsumerAdmin> ca_wrk(saver, want_all_children); @@ -487,16 +503,21 @@ TAO_Notify_EventChannel::load_attrs(const TAO_Notify::NVPList& attrs) TAO_Notify::Topology_Object * TAO_Notify_EventChannel::load_child (const ACE_CString &type, - CORBA::Long id, - const TAO_Notify::NVPList& attrs) + CORBA::Long id, + const TAO_Notify::NVPList& attrs) { TAO_Notify::Topology_Object* result = this; - if (type == "consumer_admin") + if (type == "filter_factory") + { + return this->default_filter_factory_servant_; + } + else if (type == "consumer_admin") { - if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) EventChannel reload consumer_admin %d\n") - , static_cast<int> (id) - )); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) EventChannel reload consumer_admin %d\n") + , static_cast<int> (id) + )); // call special builder method to reload TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder(); @@ -515,10 +536,11 @@ TAO_Notify_EventChannel::load_child (const ACE_CString &type, } else if (type == "supplier_admin") { - if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) EventChannel reload supplier_admin %d\n") - , static_cast<int> (id) - )); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) EventChannel reload supplier_admin %d\n") + , static_cast<int> (id) + )); TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder(); TAO_Notify_SupplierAdmin * sa = bld->build_supplier_admin ( @@ -597,4 +619,17 @@ TAO_Notify_EventChannel::sa_container() return *sa_container_; } + +void +TAO_Notify_EventChannel::validate () +{ + TAO_Notify::Validate_Worker<TAO_Notify_ConsumerAdmin> ca_wrk; + this->ca_container().collection()->for_each(&ca_wrk); + + TAO_Notify::Validate_Worker<TAO_Notify_SupplierAdmin> sa_wrk; + this->sa_container().collection()->for_each(&sa_wrk); +} + + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h index f1db9a72c67..e5384c7bbae 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h @@ -24,9 +24,11 @@ #include "orbsvcs/Notify/Topology_Object.h" #include "orbsvcs/Notify/Object.h" #include "orbsvcs/Notify/EventChannelFactory.h" +#include "orbsvcs/Notify/FilterFactory.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_FilterFactory; class TAO_Notify_ConsumerAdmin; class TAO_Notify_SupplierAdmin; class TAO_Notify_EventChannelFactory; @@ -87,6 +89,7 @@ public: CORBA::Long id, const TAO_Notify::NVPList& attrs); virtual void reconnect (void); + virtual void validate (); virtual TAO_Notify_Object::ID get_id () const {return id();} @@ -113,6 +116,8 @@ public: virtual CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin (CosNotifyChannelAdmin::AdminID id); + TAO_Notify_FilterFactory* default_filter_factory_servant () const; + private: typedef TAO_Notify_Container_T <TAO_Notify_ConsumerAdmin> TAO_Notify_ConsumerAdmin_Container; typedef TAO_Notify_Container_T <TAO_Notify_SupplierAdmin> TAO_Notify_SupplierAdmin_Container; @@ -179,8 +184,8 @@ private: /// The default filter factory. CosNotifyFilter::FilterFactory_var default_filter_factory_; + TAO_Notify_FilterFactory * default_filter_factory_servant_; - /// Release virtual void release (void); }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp index d958167541c..e615a5c588a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp @@ -20,6 +20,9 @@ ACE_RCSID(Notify, #include "orbsvcs/Notify/Find_Worker_T.h" #include "orbsvcs/Notify/Seq_Worker_T.h" #include "orbsvcs/Notify/POA_Helper.h" +#include "orbsvcs/Notify/Validate_Worker_T.h" +#include "orbsvcs/Notify/Validate_Client_Task.h" +#include "orbsvcs/Notify/FilterFactory.h" #include "ace/Dynamic_Service.h" @@ -79,6 +82,8 @@ TAO_Notify_EventChannelFactory::destroy (void) void TAO_Notify_EventChannelFactory::init (PortableServer::POA_ptr poa) { + this->poa_ = PortableServer::POA::_duplicate (poa); + ACE_ASSERT (this->ec_container_.get() == 0); // Init ec_container_ @@ -116,6 +121,17 @@ TAO_Notify_EventChannelFactory::init (PortableServer::POA_ptr poa) this->load_topology (); this->load_event_persistence (); + + if (TAO_Notify_PROPERTIES::instance()->validate_client() == true) + { + TAO_Notify_validate_client_Task* validate_client_task = 0; + ACE_NEW_THROW_EX (validate_client_task, + TAO_Notify_validate_client_Task (TAO_Notify_PROPERTIES::instance()->validate_client_delay (), + TAO_Notify_PROPERTIES::instance()->validate_client_interval (), + this), + CORBA::INTERNAL ()); + this->validate_client_task_.reset (validate_client_task); + } } void @@ -147,6 +163,8 @@ TAO_Notify_EventChannelFactory::remove (TAO_Notify_EventChannel* event_channel) int TAO_Notify_EventChannelFactory::shutdown (void) { + this->stop_validator(); + if (TAO_Notify_Object::shutdown () == 1) return 1; @@ -155,6 +173,7 @@ TAO_Notify_EventChannelFactory::shutdown (void) return 0; } + CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_named_channel ( const CosNotification::QoSProperties& initial_qos, @@ -165,6 +184,7 @@ TAO_Notify_EventChannelFactory::create_named_channel ( return this->create_channel (initial_qos, initial_admin, id); } + ::CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_channel ( const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, @@ -228,6 +248,24 @@ TAO_Notify_EventChannelFactory::load_topology (void) } this->loading_topology_ = false; } + +void +TAO_Notify_EventChannelFactory::validate () +{ + TAO_Notify::Validate_Worker<TAO_Notify_EventChannel> wrk; + + this->ec_container().collection()->for_each(&wrk); +} + +void +TAO_Notify_EventChannelFactory::stop_validator () +{ + if (this->validate_client_task_.get () != 0) + { + this->validate_client_task_->shutdown (); + } +} + bool TAO_Notify_EventChannelFactory::is_persistent () const { @@ -502,4 +540,5 @@ TAO_Notify_EventChannelFactory::ec_container() return *ec_container_; } + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h index 5eaf5d049f1..cc120bae4dd 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h @@ -24,12 +24,17 @@ #include "orbsvcs/Notify/Topology_Factory.h" #include "orbsvcs/Notify/Reconnection_Registry.h" #include "orbsvcs/Notify/Routing_Slip.h" +#include "orbsvcs/Notify/Validate_Client_Task.h" +#include "orbsvcs/Notify/Name_Value_Pair.h" #include "orbsvcs/CosNotifyChannelAdminS.h" #include "orbsvcs/NotifyExtS.h" +#include "ace/Auto_Ptr.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_FilterFactory; + #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4250) @@ -47,7 +52,6 @@ template <class TYPE> class TAO_Notify_Container_T; class TAO_Notify_Serv_Export TAO_Notify_EventChannelFactory : public virtual POA_NotifyExt::EventChannelFactory , public TAO_Notify::Topology_Parent - { friend class TAO_Notify_Builder; typedef ACE_Unbounded_Set <TAO_Notify::Routing_Slip_Ptr> Routing_Slip_Set; @@ -103,6 +107,10 @@ public: const TAO_Notify::NVPList& attrs); CosNotifyChannelAdmin::EventChannelFactory_ptr activate_self (void); virtual void reconnect (void); + virtual void validate (); + + /// at shutdown time, this causes the validator thread to exit. + void stop_validator (void); /// Handle change notifications bool handle_change (void); @@ -170,6 +178,9 @@ private: /// Release this object. virtual void release (void); + ACE_Auto_Ptr <TAO_Notify_validate_client_Task> validate_client_task_; + + PortableServer::POA_var poa_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.h b/TAO/orbsvcs/orbsvcs/Notify/EventType.h index f249ff18a3c..f9c74ef2323 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.h @@ -80,6 +80,9 @@ public: virtual void save_persistent (TAO_Notify::Topology_Saver& saver); protected: + + friend class TAO_Notify_Constraint_Interpreter; + /// Init this object. void init_i (const char* domain_name, const char* type_name); diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp index 53f080b262f..47debb424d5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp @@ -10,6 +10,8 @@ ACE_RCSID(Notify, FilterAdmin, "$Id$") #include "orbsvcs/Notify/Topology_Saver.h" #include "orbsvcs/Notify/Properties.h" +#include "orbsvcs/Notify/EventChannelFactory.h" +#include "orbsvcs/Notify/FilterFactory.h" #include "ace/Bound_Ptr.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -19,6 +21,7 @@ TAO_Notify_FilterAdmin::TAO_Notify_FilterAdmin (void) { } + // Implementation skeleton destructor TAO_Notify_FilterAdmin::~TAO_Notify_FilterAdmin (void) { @@ -134,8 +137,14 @@ TAO_Notify_FilterAdmin::save_persistent (TAO_Notify::Topology_Saver& saver) { TAO_Notify::NVPList fattrs; CORBA::Long id = entry->ext_id_; - CORBA::String_var ior = orb->object_to_string(entry->int_id_.in()); - fattrs.push_back(TAO_Notify::NVP("IOR", ior.in())); + + //TBD: this presume the filter always collocated. + //otherwise we need modify the filter interface to add get_filter_id() + + TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant (); + TAO_Notify_Object::ID mapid = factory->get_filter_id (entry->int_id_.in ()); + + fattrs.push_back(TAO_Notify::NVP("MapId", mapid)); saver.begin_object(id, "filter", fattrs, changed); saver.end_object(id, "filter"); } @@ -150,15 +159,12 @@ TAO_Notify_FilterAdmin::load_child (const ACE_CString &type, CORBA::Long id, { if (type == "filter") { - TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance(); - CORBA::ORB_var orb = properties->orb(); - ACE_ASSERT(! CORBA::is_nil(orb.in())); - ACE_CString ior; - - (void) attrs.load("IOR", ior); - CORBA::Object_var obj = orb->string_to_object(ior.c_str()); - CosNotifyFilter::Filter_var filter = CosNotifyFilter::Filter::_unchecked_narrow(obj.in()); + TAO_Notify_Object::ID mapid = 0; + attrs.load("MapId", mapid); + TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant (); + CosNotifyFilter::Filter_var filter = factory->get_filter (mapid); + if (! CORBA::is_nil(filter.in())) { this->filter_ids_.set_last_used(id); @@ -175,4 +181,11 @@ TAO_Notify_FilterAdmin::release (void) delete this; } +void +TAO_Notify_FilterAdmin::event_channel (TAO_Notify_EventChannel* ec) +{ + this->ec_.reset (ec); +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h index 45114b2879f..77c27c7e2e8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h @@ -24,6 +24,9 @@ #include "orbsvcs/Notify/Event.h" #include "orbsvcs/Notify/notify_serv_export.h" #include "orbsvcs/Notify/Topology_Object.h" +#include "orbsvcs/Notify/EventChannel.h" + +class TAO_Notify_EventChannel; TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -68,6 +71,9 @@ class TAO_Notify_Serv_Export TAO_Notify_FilterAdmin virtual void save_persistent (TAO_Notify::Topology_Saver& saver); virtual TAO_Notify::Topology_Object* load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList& attrs); + + void event_channel (TAO_Notify_EventChannel* ec); + private: typedef ACE_Hash_Map_Manager <CosNotifyFilter::FilterID, CosNotifyFilter::Filter_var, ACE_SYNCH_NULL_MUTEX> FILTER_LIST; @@ -81,6 +87,8 @@ class TAO_Notify_Serv_Export TAO_Notify_FilterAdmin /// Id generator for proxy suppliers TAO_Notify_ID_Factory filter_ids_; + + TAO_Notify_EventChannel::Ptr ec_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h index 1e0b3c56895..7810a37421b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h @@ -23,6 +23,7 @@ #include "ace/Service_Object.h" #include "tao/PortableServer/PortableServer.h" +#include "Topology_Object.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -32,13 +33,19 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * @brief Service Object to obtain a CosNotifyFilter::FilterFactory reference. * */ -class /*TAO_Notify_Serv_Export*/ TAO_Notify_FilterFactory : public ACE_Service_Object +class TAO_Notify_Serv_Export TAO_Notify_FilterFactory + : public ACE_Service_Object, public TAO_Notify::Topology_Object { public: + /// Factory method to create a FilterFactory reference /// The Factory is activated in the default POA. The filters created are activated in the <filter_poa>. virtual CosNotifyFilter::FilterFactory_ptr create ( PortableServer::POA_ptr filter_poa) = 0; + virtual void destroy (void) = 0; + + virtual TAO_Notify_Object::ID get_filter_id (CosNotifyFilter::Filter_ptr filter) = 0; + virtual CosNotifyFilter::Filter_ptr get_filter (const TAO_Notify_Object::ID& id) = 0; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp index 0efb6c66d69..3d9d66c1244 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp @@ -59,11 +59,6 @@ TAO_Notify_Method_Request_Dispatch::TAO_Notify_Method_Request_Dispatch ( TAO_Notify_Method_Request_Dispatch::~TAO_Notify_Method_Request_Dispatch () { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Destroy TAO_Notify_Method_Request_Dispatch @%@\n"), - this)); -#endif } int TAO_Notify_Method_Request_Dispatch::execute_i (void) @@ -79,7 +74,10 @@ int TAO_Notify_Method_Request_Dispatch::execute_i (void) parent.filter_operator ()); if (TAO_debug_level > 1) - ACE_DEBUG ((LM_DEBUG, "Proxysupplier %x filter eval result = %d",&this->proxy_supplier_ , val)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Notify (%P|%t) Proxysupplier %x filter ") + ACE_TEXT ("eval result = %d"), + &this->proxy_supplier_ , val)); // Filter failed - do nothing. if (val == 0) @@ -142,10 +140,11 @@ TAO_Notify_Method_Request_Dispatch::unmarshal ( 0); if (proxy_supplier != 0) { - if (DEBUG_LEVEL > 6) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch reload event for %s\n") - , textpath.c_str() - )); + if (DEBUG_LEVEL > 6) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT (" reload event for %C\n"), + textpath.c_str())); ACE_NEW_NORETURN (result, TAO_Notify_Method_Request_Dispatch_Queueable (delivery_request, proxy_supplier, true)); } @@ -155,24 +154,24 @@ TAO_Notify_Method_Request_Dispatch::unmarshal ( if (proxy_consumer == 0) { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch::unmarshal: unknown proxy id %s\n") - , textpath.c_str() - )); + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT ("::unmarshal: unknown proxy id %C\n"), + textpath.c_str())); } else { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch::unmarshal: wrong type of proxy id %s\n") - , textpath.c_str() - )); + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT ("::unmarshal: wrong type of proxy id %C\n"), + textpath.c_str())); } } } else { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch::unmarshal: Cant read proxy id path\n") - )); + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT ("::unmarshal: Cant read proxy id path\n"))); } } return result; @@ -195,11 +194,6 @@ TAO_Notify_Method_Request_Dispatch_Queueable::TAO_Notify_Method_Request_Dispatch , TAO_Notify_Method_Request_Queueable (event.get ()) , event_var_( event ) { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Construct Method_Request_Dispatch @%@\n"), - this)); -#endif } /// Constuct construct from Delivery Request @@ -213,20 +207,10 @@ TAO_Notify_Method_Request_Dispatch_Queueable::TAO_Notify_Method_Request_Dispatch , event_var_( request->event () ) { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Construct unmarshalled Method_Request_Dispatch_Queueable @%@\n"), - this)); -#endif } TAO_Notify_Method_Request_Dispatch_Queueable::~TAO_Notify_Method_Request_Dispatch_Queueable () { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Destroy TAO_Notify_Method_Request_Dispatch_Queueable @%@\n"), - this)); -#endif } int @@ -244,20 +228,10 @@ TAO_Notify_Method_Request_Dispatch_No_Copy::TAO_Notify_Method_Request_Dispatch_N bool filtering) : TAO_Notify_Method_Request_Dispatch (request, request.event (), proxy_supplier, filtering) { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Construct Method_Request_Dispatch_No_Copy @%@\n"), - this)); -#endif } TAO_Notify_Method_Request_Dispatch_No_Copy:: ~TAO_Notify_Method_Request_Dispatch_No_Copy () { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Destroy Method_Request_Dispatch_No_Copy @%@\n"), - this)); -#endif } int diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp index 1b5b690c459..9159392c8a2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp @@ -2,6 +2,8 @@ #include "orbsvcs/Notify/Notify_Constraint_Interpreter.h" #include "orbsvcs/Notify/Notify_Constraint_Visitors.h" +#include "orbsvcs/Notify/EventType.h" +#include "tao/debug.h" ACE_RCSID (Notify, NS_Constraint_Interpreter, @@ -39,6 +41,79 @@ TAO_Notify_Constraint_Interpreter::build_tree ( } } + +void +TAO_Notify_Constraint_Interpreter::build_tree ( + const CosNotifyFilter::ConstraintExp& exp + ) +{ + ACE_CString exp_str; + ACE_CString et_exp; + + CORBA::ULong len = exp.event_types.length (); + + bool has_et_exp = false; + + for (CORBA::ULong ii = 0; ii < len; ++ii) + { + TAO_Notify_EventType et; + bool d = et.domain_is_wildcard (exp.event_types [ii].domain_name.in ()); + bool t = et.type_is_wildcard (exp.event_types [ii].type_name.in ()); + + if (d && t) + { + exp_str = ""; + break; + } + + if (has_et_exp) + et_exp += " or "; + et_exp += "("; + + has_et_exp = has_et_exp || 1; + + if (! d) + { + et_exp += "$domain_name=='"; + et_exp += exp.event_types [ii].domain_name.in (); + et_exp += "'"; + } + + if (! t) + { + if (!d) + et_exp += " and "; + + et_exp += "$type_name=='"; + et_exp += exp.event_types [ii].type_name.in (); + et_exp += "'"; + } + + et_exp += ")"; + } + + bool valid_constraint = ! ETCL_Interpreter::is_empty_string (exp.constraint_expr.in ()); + + if (has_et_exp && valid_constraint) + { + exp_str = "("; + exp_str += et_exp; + exp_str += ")"; + } + else if (has_et_exp) + exp_str = et_exp; + else if (valid_constraint) + exp_str = exp.constraint_expr.in (); + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t)Constraint: %C \n"), + exp_str.c_str ())); + } + this->build_tree (exp_str.c_str ()); +} + + CORBA::Boolean TAO_Notify_Constraint_Interpreter::evaluate (TAO_Notify_Constraint_Visitor &evaluator) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h index c9f8af17640..2f644b3b15c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h @@ -51,11 +51,14 @@ public: * Constraint exception if the constraint given has syntax errors or * semantic errors, such as mismatched types. */ - void build_tree (const char* constraints); + void build_tree (const CosNotifyFilter::ConstraintExp& exp); /// Returns true if the constraint is evaluated successfully by /// the evaluator. CORBA::Boolean evaluate (TAO_Notify_Constraint_Visitor &evaluator); + +private: + void build_tree (const char* constraints); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp index 2822defc1db..2cda51d0939 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp @@ -1045,15 +1045,18 @@ TAO_Notify_Constraint_Visitor::visit_binary_op (ETCL_Binary_Expr *binary, this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_LE: - result = left_operand <= right_operand; + // result = left_operand <= right_operand; // Compile error on LynxOS + result = left_operand.operator<= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GT: - result = left_operand > right_operand; + // result = left_operand > right_operand; // Compile error on LynxOS + result = left_operand.operator> (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GE: - result = left_operand >= right_operand; + //result = left_operand >= right_operand; // Compile error on LynxOS + result = left_operand.operator>= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_EQ: @@ -1061,7 +1064,8 @@ TAO_Notify_Constraint_Visitor::visit_binary_op (ETCL_Binary_Expr *binary, this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_NE: - result = left_operand != right_operand; + //result = left_operand != right_operand; // Compile error on LynxOS + result = left_operand.operator!= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_PLUS: diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp index d6926c6f8e4..a52eca64945 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp @@ -160,8 +160,11 @@ TAO_Notify_POA_Helper::activate (PortableServer::Servant servant, CORBA::Long& i if (DEBUG_LEVEL > 0) { CORBA::String_var the_name = this->poa_->the_name (); - - ACE_DEBUG ((LM_DEBUG, "Activating object with id = %d in POA : %s\n", id, the_name.in ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) POA_Helper Activating object with ") + ACE_TEXT ("id = %d in POA : %C\n"), + id, the_name.in () + )); } // Convert CORBA::Long to ObjectId @@ -178,7 +181,11 @@ TAO_Notify_POA_Helper::activate_with_id (PortableServer::Servant servant, CORBA: if (DEBUG_LEVEL > 0) { CORBA::String_var the_name = this->poa_->the_name (); - ACE_DEBUG ((LM_DEBUG, "Activating object with existing id = %d in POA : %s\n", id, the_name.in ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) POA_Helper Activating object with ") + ACE_TEXT ("existing id = %d in POA : %C\n"), + id, the_name.in () + )); } this->id_factory_.set_last_used (id); @@ -196,6 +203,14 @@ TAO_Notify_POA_Helper::deactivate (CORBA::Long id) const // Convert CORBA::Long to ObjectId PortableServer::ObjectId_var oid = this->long_to_ObjectId (id); + if (DEBUG_LEVEL > 0) + { + CORBA::String_var the_name = this->poa_->the_name (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) POA_Helper Deactivating object with") + ACE_TEXT ("id = %d in POA : %C\n"), + id, the_name.in ())); + } poa_->deactivate_object (oid.in ()); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp index 6ee5114f3ae..0256a0470b0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp @@ -21,6 +21,7 @@ TAO_Notify_Properties::TAO_Notify_Properties (void) , dispatching_orb_ (0) , asynch_updates_ (false) , allow_reconnect_ (false) + , validate_client_ (false) , separate_dispatching_orb_ (false) , updates_ (1) , defaultConsumerAdminFilterOp_ (CosNotifyChannelAdmin::OR_OP) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.h b/TAO/orbsvcs/orbsvcs/Notify/Properties.h index 4ace64cc03f..3419780448e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.h @@ -72,6 +72,12 @@ public: bool allow_reconnect (void); void allow_reconnect (bool b); + bool validate_client (void); + void validate_client (bool b); + ACE_Time_Value validate_client_delay (void); + void validate_client_delay (ACE_Time_Value b); + ACE_Time_Value validate_client_interval (void); + void validate_client_interval (ACE_Time_Value b); // Turn on/off update messages. CORBA::Boolean updates (void); @@ -136,6 +142,9 @@ protected: /// True if clients can reconnect to proxies. bool allow_reconnect_; + bool validate_client_; + ACE_Time_Value validate_client_delay_; + ACE_Time_Value validate_client_interval_; /// True is separate dispatching orb bool separate_dispatching_orb_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl index 765da34238d..62fb4db7e6b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl @@ -89,6 +89,43 @@ TAO_Notify_Properties::allow_reconnect (bool b) } ACE_INLINE bool +TAO_Notify_Properties::validate_client (void) +{ + return this->validate_client_; +} + +ACE_INLINE void +TAO_Notify_Properties::validate_client (bool b) +{ + this->validate_client_ = b; +} + +ACE_INLINE ACE_Time_Value +TAO_Notify_Properties::validate_client_delay (void) +{ + return this->validate_client_delay_; +} + +ACE_INLINE void +TAO_Notify_Properties::validate_client_delay (ACE_Time_Value b) +{ + this->validate_client_delay_ = b; +} + +ACE_INLINE ACE_Time_Value +TAO_Notify_Properties::validate_client_interval (void) +{ + return this->validate_client_interval_; +} + +ACE_INLINE void +TAO_Notify_Properties::validate_client_interval (ACE_Time_Value b) +{ + this->validate_client_interval_ = b; +} + + +ACE_INLINE bool TAO_Notify_Properties::separate_dispatching_orb (void) { return this->separate_dispatching_orb_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h index e310751f31f..79e7aa47285 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h @@ -106,6 +106,8 @@ public: virtual TAO_Notify::Topology_Object* load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList& attrs); + virtual void validate () = 0; + protected: /// Filter Administration diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp index 742ac748116..34d4c95c72e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp @@ -54,6 +54,8 @@ TAO_Notify_ProxyConsumer::init (TAO_Notify::Topology_Parent* topology_parent) this->supplier_admin_.reset (dynamic_cast<TAO_Notify_SupplierAdmin *>(topology_parent)); ACE_ASSERT (this->supplier_admin_.get() != 0); + this->filter_admin_.event_channel (this->supplier_admin_->event_channel()); + const CosNotification::QoSProperties &default_ps_qos = TAO_Notify_PROPERTIES::instance ()->default_proxy_consumer_qos_properties (); @@ -111,6 +113,8 @@ TAO_Notify_ProxyConsumer::connect (TAO_Notify_Supplier *supplier) void TAO_Notify_ProxyConsumer::push_i (TAO_Notify_Event * event) { + last_ping_ = ACE_OS::gettimeofday (); + if (this->supports_reliable_events ()) { TAO_Notify_Event::Ptr pevent(event->queueable_copy()); @@ -183,4 +187,19 @@ TAO_Notify_ProxyConsumer::destroy (void) // It is not safe to delete the non-refcounted supplier here. } + +ACE_Time_Value +TAO_Notify_ProxyConsumer::last_ping() const +{ + return this->last_ping_.value (); +} + + +void +TAO_Notify_ProxyConsumer::last_ping(const ACE_Time_Value& tv) +{ + this->last_ping_ = tv; +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h index bcb9a45e99b..f191c6d45ac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h @@ -68,6 +68,9 @@ public: /// The SA parent. TAO_Notify_SupplierAdmin& supplier_admin (void); + ACE_Time_Value last_ping() const; + void last_ping(const ACE_Time_Value& tv); + protected: /// Access the Supplier TAO_Notify_Supplier* supplier (void); @@ -75,6 +78,10 @@ protected: /// Accept an event from the Supplier void push_i (TAO_Notify_Event * event); + /// Last time either push an event or validate connection + /// via _non_exist call. + ACE_Atomic_Op<TAO_SYNCH_MUTEX, ACE_Time_Value> last_ping_; + private: /// Is this part of a reliable channel bool supports_reliable_events () const; @@ -88,6 +95,7 @@ private: /// Access our Peer. virtual TAO_Notify_Peer* peer (void); + }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp index 82de35d8736..309a8dc1dad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp @@ -37,6 +37,9 @@ TAO_Notify_ProxySupplier::init (TAO_Notify_ConsumerAdmin* consumer_admin) this->consumer_admin_.reset (consumer_admin); + this->filter_admin_.event_channel ( + this->consumer_admin_->event_channel()); + const CosNotification::QoSProperties &default_ps_qos = TAO_Notify_PROPERTIES::instance ()->default_proxy_supplier_qos_properties (); @@ -57,7 +60,7 @@ void TAO_Notify_ProxySupplier::connect (TAO_Notify_Consumer *consumer) { // Adopt the consumer - ACE_Auto_Ptr< TAO_Notify_Consumer > auto_consumer (consumer); + TAO_Notify_Consumer::Ptr auto_consumer (consumer); TAO_Notify_Atomic_Property_Long& consumer_count = this->admin_properties().consumers (); const TAO_Notify_Property_Long& max_consumers = this->admin_properties().max_consumers (); diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h index 8f7d1d7792f..53cede137b9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h @@ -21,6 +21,7 @@ #include "orbsvcs/Notify/Event.h" #include "orbsvcs/Notify/Proxy.h" #include "orbsvcs/Notify/ConsumerAdmin.h" +#include "orbsvcs/Notify/Consumer.h" #include "orbsvcs/CosEventChannelAdminC.h" @@ -85,7 +86,7 @@ private: TAO_Notify_ConsumerAdmin::Ptr consumer_admin_; /// The Consumer that we're connect to. - ACE_Auto_Ptr<TAO_Notify_Consumer> consumer_; + TAO_Notify_Consumer::Ptr consumer_; /// Access our Peer. virtual TAO_Notify_Peer* peer (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp index 1aa065a1b62..23a129e0553 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp @@ -85,6 +85,23 @@ TAO_Notify_SequenceProxyPushConsumer::get_proxy_type_name (void) const } void +TAO_Notify_SequenceProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_SequenceProxyPushConsumer::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_sequence_push_consumer (); + } +} + +void TAO_Notify_SequenceProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h index 937e4ce703f..a20b5fa7c35 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h @@ -52,6 +52,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); protected: ///= Data Members diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp index 95d19c94875..fb2ee51346f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp @@ -62,6 +62,24 @@ TAO_Notify_SequenceProxyPushSupplier::get_proxy_type_name (void) const } void +TAO_Notify_SequenceProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_SequenceProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_sequence_push_supplier (); + } +} + + +void TAO_Notify_SequenceProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h index df868fb85f2..241e6f4eb9b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h @@ -60,6 +60,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); /// = Servant methods virtual CosNotifyChannelAdmin::ProxyType MyType (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp index a63e5274eae..f0e73cac8dc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp @@ -306,7 +306,7 @@ TAO_Notify_SequencePushConsumer::push (const CosNotification::EventBatch& event_ this->push_consumer_->_stubobj()->orb_core()->orbid())); } //--cj end - + last_ping_ = ACE_OS::gettimeofday (); this->push_consumer_->push_structured_events (event_batch); } @@ -336,4 +336,10 @@ TAO_Notify_SequencePushConsumer::reconnect_from_consumer (TAO_Notify_Consumer* o this->schedule_timer(false); } +CORBA::Object_ptr +TAO_Notify_SequencePushConsumer::get_consumer (void) +{ + return CosNotifyComm::SequencePushConsumer::_duplicate (this->push_consumer_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h index 362cd39b425..3279e6ee66c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h @@ -78,6 +78,8 @@ public: protected: + virtual CORBA::Object_ptr get_consumer (void); + /// The Consumer CosNotifyComm::SequencePushConsumer_var push_consumer_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp index b4101eb48cf..be8c3139944 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp @@ -50,4 +50,10 @@ TAO_Notify_SequencePushSupplier::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_SequencePushSupplier::get_supplier (void) +{ + return CosNotifyComm::SequencePushSupplier::_duplicate (this->push_supplier_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h index a944971ffbc..20fc8ea9aac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h @@ -51,7 +51,10 @@ public: virtual ACE_CString get_ior (void) const; protected: - /// The Supplier + + virtual CORBA::Object_ptr get_supplier (void); + + /// The Supplier CosNotifyComm::SequencePushSupplier_var push_supplier_; }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp index 8967caff514..ae85ddadb88 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp @@ -81,6 +81,23 @@ TAO_Notify_StructuredProxyPushConsumer::get_proxy_type_name (void) const } void +TAO_Notify_StructuredProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_StructuredProxyPushConsumer::validate(%d)") + ACE_TEXT("disconnecting \n"), this->id ())); + } + + this->disconnect_structured_push_consumer (); + } +} + +void TAO_Notify_StructuredProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h index d4b9d86d331..97d71e73760 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h @@ -52,6 +52,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); protected: diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp index faf057ed4b3..e3497094153 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp @@ -65,6 +65,23 @@ TAO_Notify_StructuredProxyPushSupplier::get_proxy_type_name (void) const } void +TAO_Notify_StructuredProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_StructuredProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_structured_push_supplier (); + } +} + +void TAO_Notify_StructuredProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h index 9a5f64ea3e2..920318640c2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h @@ -59,6 +59,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); /// = Servant methods // = interface methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp index a82191d88dc..efea0f8111c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp @@ -107,6 +107,8 @@ TAO_Notify_StructuredPushConsumer::push (const CORBA::Any& event) connection_valid = 1; } + last_ping_ = ACE_OS::gettimeofday (); + this->push_consumer_->push_structured_event (notification); } @@ -138,6 +140,8 @@ TAO_Notify_StructuredPushConsumer::push (const CosNotification::StructuredEvent& connection_valid = 1; } + last_ping_ = ACE_OS::gettimeofday (); + this->push_consumer_->push_structured_event (event); } @@ -176,4 +180,10 @@ TAO_Notify_StructuredPushConsumer::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_StructuredPushConsumer::get_consumer (void) +{ + return CosNotifyComm::StructuredPushConsumer::_duplicate (this->push_consumer_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h index c169a4678c2..a7cd9f05d87 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h @@ -66,6 +66,9 @@ public: protected: + + virtual CORBA::Object_ptr get_consumer (void); + /// The Consumer CosNotifyComm::StructuredPushConsumer_var push_consumer_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp index 7c98e79ef6e..09619c5b83f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp @@ -49,4 +49,10 @@ TAO_Notify_StructuredPushSupplier::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_StructuredPushSupplier::get_supplier (void) +{ + return CosNotifyComm::StructuredPushSupplier::_duplicate (this->push_supplier_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h index 33114c5c309..d4b8d62f7b1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h @@ -48,6 +48,9 @@ public: virtual ACE_CString get_ior (void) const; protected: + + virtual CORBA::Object_ptr get_supplier (void); + /// The Supplier CosNotifyComm::StructuredPushSupplier_var push_supplier_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp index d760d336730..e4cde846df6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp @@ -1,6 +1,11 @@ // $Id$ +#include "tao/corba.h" +#include "orbsvcs/Time_Utilities.h" +#include "orbsvcs/Notify/Properties.h" #include "orbsvcs/Notify/Supplier.h" +#include "tao/debug.h" +#include "tao/Messaging/Messaging_TypesC.h" #if ! defined (__ACE_INLINE__) #include "orbsvcs/Notify/Supplier.inl" @@ -11,6 +16,10 @@ ACE_RCSID(Notify, TAO_Notify_Supplier, "$Id$") #include "orbsvcs/Notify/ProxyConsumer.h" #include "orbsvcs/Notify/Proxy.h" +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL TAO_debug_level +#endif //DEBUG_LEVEL + TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_Supplier::TAO_Notify_Supplier (TAO_Notify_ProxyConsumer* proxy) @@ -37,4 +46,89 @@ TAO_Notify_Supplier::dispatch_updates_i ( this->subscribe_->subscription_change (added, removed); } + + +bool +TAO_Notify_Supplier::is_alive (bool allow_nil_supplier) +{ + bool status = false; + CORBA::Object_var supplier = this->get_supplier (); + if (CORBA::is_nil (supplier.in ())) + { + // The supplier may not connected or the supplier did + // not provide a callback. In this case, the liveliness + // check should return true so it will be validated in + // next period. + if (allow_nil_supplier) + return true; + else + return status; + } + + CORBA::PolicyList policy_list; + try + { + bool do_liveliness_check = false; + ACE_Time_Value now = ACE_OS::gettimeofday (); + ACE_Time_Value last_ping = proxy_->last_ping(); + if (CORBA::is_nil (this->rtt_obj_.in ())) + { + // We need to determine if the supplier on the other end is still + // alive. Since we may be in an upcall from the owner of the + // original supplier, we have to put a timeout on the call in case + // the client side is not processing ORB requests at this time. In + // the event that the timeout exception occurs, we will assume that + // the original supplier is still around. If we get any other + // exception we will say that the original supplier is not + // available anymore. + TimeBase::TimeT timeout = 10000000; + CORBA::Any timeout_any; + timeout_any <<= timeout; + + policy_list.length (1); + policy_list[0] = TAO_Notify_PROPERTIES::instance()->orb()-> + create_policy ( + Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, + timeout_any); + rtt_obj_ = + supplier->_set_policy_overrides (policy_list, + CORBA::ADD_OVERRIDE); + + // Clean up the policy that was allocated in the try/catch + for (CORBA::ULong i = 0; i < policy_list.length (); i++) + policy_list[i]->destroy (); + + do_liveliness_check + = (last_ping == ACE_Time_Value::zero ? true + : now - last_ping >= TAO_Notify_PROPERTIES::instance()->validate_client_delay ()); + } + else + do_liveliness_check = + now - last_ping >= TAO_Notify_PROPERTIES::instance()->validate_client_interval (); + + if (CORBA::is_nil (rtt_obj_.in ())) + status = false; + else if (do_liveliness_check || allow_nil_supplier) + { + this->proxy_->last_ping (now); + status = !rtt_obj_->_non_existent (); + } + else + status = true; + } + catch (CORBA::TIMEOUT&) + { + status = true; + } + catch (CORBA::Exception& ex) + { + if (DEBUG_LEVEL > 0) + { + ex._tao_print_exception ("TAO_Notify_Supplier::is_alive: false"); + } + } + + return status; +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h index e040215e6cf..8ed6141d295 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h @@ -47,7 +47,12 @@ public: /// Access Base Proxy. virtual TAO_Notify_Proxy* proxy (void); + virtual CORBA::Object_ptr get_supplier (void) = 0; + + bool is_alive (bool allow_nil_supplier); + protected: + /// Dispatch updates implementation. virtual void dispatch_updates_i (const CosNotification::EventTypeSeq& added, const CosNotification::EventTypeSeq& removed); @@ -57,6 +62,8 @@ protected: /// Interface that accepts subscription_changes CosNotifyComm::NotifySubscribe_var subscribe_; + + CORBA::Object_var rtt_obj_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp index 5bd5aab1bb7..2adb7572771 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp @@ -87,16 +87,16 @@ TAO_Notify_ThreadPool_Task::init (const NotifyExt::ThreadPoolParams& tp_params, this->_decr_refcnt(); } - if (TAO_debug_level > 0) + if (ACE_OS::last_error () == EPERM) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Insufficient privilege.\n"))); + else if (ACE_OS::last_error () == EAGAIN) { - if (ACE_OS::last_error () == EPERM) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Insufficient privilege.\n"))); - else - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("(%t) task activation at priority %d failed\n") - ACE_TEXT ("exiting!\n%a"), - tp_params.default_priority)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) task activation at priority %d failed %p\n"), + tp_params.default_priority, "activate")); + throw CORBA::NO_RESOURCES (); } + throw CORBA::BAD_PARAM (); } } @@ -151,7 +151,7 @@ TAO_Notify_ThreadPool_Task::svc (void) else { if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "ThreadPool_Task dequeue failed\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t)ThreadPool_Task dequeue failed\n")); } } catch (const CORBA::Exception& ex) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.cpp new file mode 100644 index 00000000000..5d76943f6cf --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.cpp @@ -0,0 +1,88 @@ +/* -*- C++ -*- $Id$ */ +#include "Validate_Client_Task.h" + +ACE_RCSID(Notify, Validate_Client_Task, "$Id$") + +#include "EventChannelFactory.h" +#include "tao/ORB_Core.h" +#include "tao/debug.h" +#include "ace/Reactor.h" + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_Notify_validate_client_Task:: + TAO_Notify_validate_client_Task (const ACE_Time_Value &delay, + const ACE_Time_Value &interval, + TAO_Notify_EventChannelFactory *ecf) + : delay_ (delay), + interval_ (interval), + ecf_ (ecf), + shutdown_ (false) +{ + if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("(%P|%t)TAO_Notify_validate_client_Task: %p\n"),"activate")); + } +} + + +TAO_Notify_validate_client_Task::~TAO_Notify_validate_client_Task (void) +{ +} + + +int +TAO_Notify_validate_client_Task::svc (void) +{ + ACE_Time_Value due = ACE_OS::gettimeofday () + this->delay_; + while (! this->shutdown_) + { + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex()), -1); + this->condition_.wait (&due); + } + + if (this->shutdown_) + break; + + try + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate start\n"))); + } + this->ecf_->validate (); + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate end\n"))); + } + } + catch (...) + { + // Ignore all exceptions + } + + if (this->interval_ == ACE_Time_Value::zero) + break; + + due = ACE_OS::gettimeofday () + this->interval_; + } + + return 0; +} + + +void +TAO_Notify_validate_client_Task::shutdown (void) +{ + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex())); + this->shutdown_ = true; + this->condition_.signal (); + } + this->wait (); +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.h new file mode 100644 index 00000000000..63ea04584dd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.h @@ -0,0 +1,84 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Validate_Client_Task.h + * + * $Id$ + * + * @author Yan Dai (dai_y@ociweb.com) + */ +//============================================================================= + +#ifndef NOTIFY_VALIDATE_CLIENT_TASK_H +#define NOTIFY_VALIDATE_CLIENT_TASK_H + +#include /**/ "ace/pre.h" + +#include "notify_serv_export.h" + +#include "tao/ORB.h" +#include "tao/Condition.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_Notify_EventChannelFactory; + + +/** + * @class TAO_Notify_validate_client_Task + * + * @brief ClientControl + * + * Defines the interface for the consumer control strategy. + * This strategy handles misbehaving or failing consumers. + * = MEMORY MANAGMENT + * = LOCKING + * = TODO + */ +class TAO_Notify_Serv_Export TAO_Notify_validate_client_Task + : public ACE_Task<ACE_NULL_SYNCH> +{ +public: + + typedef TAO_Condition<TAO_SYNCH_MUTEX> CONDITION; + + /// Constructor. It does not assume ownership of the <event_channel> + /// parameter. + TAO_Notify_validate_client_Task (const ACE_Time_Value &delay, + const ACE_Time_Value &interval, + TAO_Notify_EventChannelFactory *ecf); + + /// destructor... + virtual ~TAO_Notify_validate_client_Task (void); + + virtual int svc (void); + + void shutdown (void); + +private: + /// The delay of first time validate. + ACE_Time_Value delay_; + + /// The validate interval + ACE_Time_Value interval_; + + /// The event channel + TAO_Notify_EventChannelFactory *ecf_; + + CONDITION condition_; + + bool shutdown_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* NOTIFY_VALIDATE_CLIENT_TASK_H */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.cpp new file mode 100644 index 00000000000..0b048d75502 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.cpp @@ -0,0 +1,45 @@ +/* -*- C++ -*- $Id$ */ + +#ifndef NOTIFY_VALIDATE_WORKER_CPP +#define NOTIFY_VALIDATE_WORKER_CPP + +#include "Validate_Worker_T.h" +#include "tao/debug.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO_Notify +{ + template<class TOPOOBJ> + Validate_Worker<TOPOOBJ>::Validate_Worker() + { + } + + template<class TOPOOBJ> + void + Validate_Worker<TOPOOBJ>::work (TOPOOBJ* o) + { + if (o == 0) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t)Validate_Worker<TOPOOBJ>::work: obj is nil\n"))); + } + } + else + { + o->validate (); + } + } +} // namespace TAO_Notify + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* VALIDATE_WORKER_CPP */ + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.h b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.h new file mode 100644 index 00000000000..e4e13647acf --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Validate_Worker_T.h + * + * $Id$ + * + * @author Yan Dai (dai_y@ociweb.com) + */ +//============================================================================= + +#ifndef NOTIFY_VALIDATE_WORKER_H +#define NOTIFY_VALIDATE_WORKER_H + +#include /**/ "ace/pre.h" + +#include "orbsvcs/ESF/ESF_Worker.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO_Notify +{ + /** + * \brief Iterate through children reconnecting after reloading persistent information. + */ + template<class TOPOOBJ> + class Validate_Worker : public TAO_ESF_Worker<TOPOOBJ> + { + public: + /// Constructor + Validate_Worker(); + + // override virtual ESF_Worker method + virtual void work (TOPOOBJ* o); + }; +} // namespace TAO_Notify + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Validate_Worker_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Validate_Worker_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* NOTIFY_VALIDATE_WORKER_H */ + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp b/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp index 5b7be5a138e..90b3b415903 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp @@ -177,10 +177,11 @@ namespace TAO_Notify ACE_TString tmp(BUF_SIZE); for (size_t idx = 0; idx < attrs.size(); ++idx) { - ACE_TString valuetmp (ACE_TEXT_CHAR_TO_TCHAR(attrs[idx].value.c_str())); + ACE_TString valuetmp (ACE_TEXT_CHAR_TO_TCHAR (attrs[idx].value.c_str())); ACEXML_escape_string(valuetmp, tmp); - ACE_OS::fprintf (out, "%s%s%s%s%s", " ", - attrs[idx].name.c_str (), "=\"", tmp.c_str(), "\""); + ACE_OS::fprintf (out, "%s%s%s%s%s"," ", + attrs[idx].name.c_str (), + "=\"", ACE_TEXT_ALWAYS_CHAR (tmp.c_str()), "\""); } ACE_OS::fprintf (out, ">\n"); this->indent_ += " "; diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h index 07185f531f1..0bdde1c0a35 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h @@ -151,7 +151,7 @@ namespace TAO * handshake. This includes both the TCP handshake and the SSL * handshake. */ - const ACE_Time_Value timeout_; + ACE_Time_Value const timeout_; }; diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl index 0233a73fc01..f52a511c417 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl @@ -2,6 +2,8 @@ // // $Id$ +// This is needed on LynxOS 4.0 with GCC 2.95 +#include "ace/OS_NS_stdio.h" #include <openssl/crypto.h> diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp index 7da5f41f889..acee802653c 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp @@ -169,50 +169,17 @@ TAO::SSLIOP::Transport::send_message (TAO_OutputCDR &stream, return 1; } - -int -TAO::SSLIOP::Transport::generate_request_header ( - TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) -{ - // Check whether we have a Bi Dir IIOP policy set, whether the - // messaging objects are ready to handle bidirectional connections - // and also make sure that we have not recd. or sent any information - // regarding this before... - if (this->orb_core ()->bidir_giop_policy () - && this->messaging_object ()->is_ready_for_bidirectional (msg) - && this->bidirectional_flag () < 0) - { - this->set_bidir_context_info (opdetails); - - // Set the flag to 1 - this->bidirectional_flag (1); - - // At the moment we enable BiDIR giop we have to get a new - // request id to make sure that we follow the even/odd rule - // for request id's. We only need to do this when enabled - // it, after that the Transport Mux Strategy will make sure - // that the rule is followed - opdetails.request_id (this->tms ()->request_id ()); - } - - // We are going to pass on this request to the underlying messaging - // layer. It should take care of this request - return TAO_Transport::generate_request_header (opdetails, spec, msg); -} - int TAO::SSLIOP::Transport::tear_listen_point_list (TAO_InputCDR &cdr) { CORBA::Boolean byte_order; - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) return -1; cdr.reset_byte_order (static_cast<int> (byte_order)); IIOP::ListenPointList listen_list; - if ((cdr >> listen_list) == 0) + if (!(cdr >> listen_list)) return -1; // As we have received a bidirectional information, set the flag to @@ -242,7 +209,7 @@ TAO::SSLIOP::Transport::set_bidir_context_info ( acceptor++) { // Check whether it is a IIOP acceptor - if ((*acceptor)->tag () == IOP::TAG_INTERNET_IOP) + if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) { @@ -259,8 +226,8 @@ TAO::SSLIOP::Transport::set_bidir_context_info ( TAO_OutputCDR cdr; // Marshall the information into the stream - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << listen_point_list) == 0) + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(cdr << listen_point_list)) return; // Add this info in to the svc_list diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h index 88a76ed8546..6d32bec493e 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h @@ -111,10 +111,6 @@ namespace TAO TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait = 0); - virtual int generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg); - /// Open teh service context list and process it. virtual int tear_listen_point_list (TAO_InputCDR &cdr); //@} diff --git a/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp b/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp index 79234617c6f..42973f57074 100644 --- a/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp +++ b/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp @@ -153,7 +153,7 @@ ACE_Scheduler::get_rt_info (Object_Name name, if (info_collection_.bind (lookup, info_array) != 0) { delete rtinfo; - delete info_array; + delete [] info_array; rtinfo = 0; return FAILED; // Error! } diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc b/TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc new file mode 100644 index 00000000000..63b37d20812 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc @@ -0,0 +1,39 @@ +// -*- MPC -*- +// $Id$ + +project(*idl): taoidldefaults { + idlflags += -Sp + IDL_Files { + Test.idl + } + custom_only = 1 +} + +project(*Server): taoserver { + after += *idl + Source_Files { + Hello.cpp + server.cpp + } + Source_Files { + TestC.cpp + TestS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, pi, ftclientorb { + after += *idl + Source_Files { + ClientORBInitializer.cpp + ClientRequest_Interceptor.cpp + client.cpp + } + Source_Files { + TestC.cpp + } + IDL_Files { + } +} + diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp new file mode 100644 index 00000000000..2f4406185c9 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp @@ -0,0 +1,28 @@ +// -*- C++ -*- +// +// $Id$ + +#include "ClientORBInitializer.h" + +void +ClientORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr) +{ + // No-op +} + +void +ClientORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info) +{ + PortableInterceptor::ClientRequestInterceptor_ptr cri = + PortableInterceptor::ClientRequestInterceptor::_nil (); + + ACE_NEW_THROW_EX (cri, + ClientRequest_Interceptor, + CORBA::NO_MEMORY ()); + + PortableInterceptor::ClientRequestInterceptor_var + client_interceptor = cri; + + info->add_client_request_interceptor (client_interceptor.in ()); + +} diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h new file mode 100644 index 00000000000..1c0ca44b138 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h @@ -0,0 +1,50 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ClientORBInitializer.h + * + * $Id$ + */ +//============================================================================= +#ifndef CLIENTORBINITIALIZER_H +#define CLIENTORBINITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "tao/PortableInterceptorC.h" +#include "ClientRequest_Interceptor.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +/// RTCORBA ORB initializer. +class ClientORBInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ +public: + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" + +#endif /* CLIENTORBINITIALIZER_H */ diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp new file mode 100644 index 00000000000..8c25c69b51e --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include "ClientRequest_Interceptor.h" + +#include "tao/CORBA_String.h" +#include "tao/debug.h" +#include "ace/Log_Msg.h" + + CORBA::Boolean + ClientRequest_Interceptor::success_flag_ = 0; + + ClientRequest_Interceptor::ClientRequest_Interceptor (void) + : name_ ("ClientRequest_Interceptor") + { + } + + ClientRequest_Interceptor::~ClientRequest_Interceptor (void) + { + } + + char * + ClientRequest_Interceptor::name () + { + return CORBA::string_dup (this->name_); + } + + void + ClientRequest_Interceptor::destroy () + { + // No-op + } + + void + ClientRequest_Interceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr ri + ) + { + // Print debug + CORBA::String_var op = + ri->operation (); + + + ACE_DEBUG ((LM_DEBUG, + "TAO_FT (%P|%t): ClientRequest_Interceptor::send_poll called for operation: %C\n", + op.in ())); + } + + void + ClientRequest_Interceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri) + { + // Print debug + CORBA::String_var op = + ri->operation (); + + + ACE_DEBUG ((LM_DEBUG, + "ClientRequest_Interceptor::send_request called for operation: %C - things are going well...\n", + op.in ())); + } + + void + ClientRequest_Interceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr) + { + // No-op + } + + void + ClientRequest_Interceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr) + { + // No-op + } + + void + ClientRequest_Interceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri) + { + // Print debug + CORBA::String_var op = + ri->operation (); + + + ACE_DEBUG ((LM_DEBUG, + "ClientRequest_Interceptor::receive_exception called for operation: %C - test has succeeded...\n", + op.in ())); + success_flag_ = 1; + } diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h new file mode 100644 index 00000000000..36e4fc7032d --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file ClientRequest_Interceptor.h + * + * $Id$ + */ +//============================================================================= +#ifndef CLIENTREQUEST_INTERCEPTOR_H +#define CLIENTREQUEST_INTERCEPTOR_H +#include /**/ "ace/pre.h" + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +/** +* @class ClientRequest_Interceptor +* +*/ +class ClientRequest_Interceptor +: public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual ::CORBA::LocalObject +{ +public: + +ClientRequest_Interceptor (void); + +~ClientRequest_Interceptor (void); + +/// Canonical name of the interceptor. +virtual char * name (); + + +virtual void destroy (); + +virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr); + +virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri); + +virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri); + +virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri); + +virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri); + +static CORBA::Boolean success_flag_; + +private: + +/// Name of the interceptor +const char *name_; + +}; +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /*CLIENTREQUEST_INTERCEPTOR_H*/ + diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp new file mode 100644 index 00000000000..7b9497529ec --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp @@ -0,0 +1,23 @@ +// +// $Id$ +// +#include "Hello.h" + +ACE_RCSID(Hello, Hello, "Hello.cpp,v 1.3 2002/01/29 20:21:07 okellogg Exp") + +Hello::Hello (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +char * +Hello::get_string () +{ + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown () +{ + this->orb_->shutdown (0 ); +} diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h new file mode 100644 index 00000000000..782b1b2f573 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h @@ -0,0 +1,31 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual char * get_string (); + + virtual void shutdown (); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/README b/TAO/orbsvcs/tests/Bug_3598b_Regression/README new file mode 100644 index 00000000000..b2d570b8158 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/README @@ -0,0 +1,12 @@ +$Id$ + +This test attempts to contact a server IOR with no connectable profile in it (on account of how there is no server running). + +The method invocation should fail but the installed client request interceptor should have its send_request and receive_exception methods invoked regardless. + +The expected result looks like: + +Client about to make method call that is doomed to failure... +ClientRequest_Interceptor::send_request called for operation: get_string - things are going well... +ClientRequest_Interceptor::receive_exception called for operation: get_string - test has succeeded... +Success - the server was unreachable and PI receive_exception was invoked. diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl b/TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp new file mode 100644 index 00000000000..651abc13e44 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp @@ -0,0 +1,102 @@ +// $Id$ + +#include "TestC.h" +#include "ace/Get_Opt.h" +#include "tao/PortableInterceptorC.h" +#include "ClientORBInitializer.h" +#include "tao/ORBInitializer_Registry.h" +#include "orbsvcs/FaultTolerance/FT_ClientService_Activate.h" + +ACE_RCSID(Hello, client, "client.cpp,v 1.5 2002/01/29 20:21:07 okellogg Exp") + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = + PortableInterceptor::ORBInitializer::_nil (); + PortableInterceptor::ORBInitializer_var orb_initializer; + + // Register the ClientRequest_Interceptor ORBInitializer. + ACE_NEW_RETURN (temp_orb_initializer, + ClientORBInitializer, + -1); + + orb_initializer = temp_orb_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var tmp = + orb->string_to_object (ACE_TEXT_ALWAYS_CHAR (ior)); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in () ); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + ior), + 1); + } + + ACE_DEBUG ((LM_DEBUG, "Client about to make method call that is doomed to failure...\n")); + + CORBA::String_var the_string = + hello->get_string (); + + ACE_ERROR_RETURN ((LM_DEBUG, + "Error - the remote call succeeded which is bloody miraculous given that no server is running !!\n"), + 1); + } + catch (const CORBA::Exception&) + { + if (ClientRequest_Interceptor::success_flag_) + { + ACE_DEBUG ((LM_DEBUG, "Success - the server was unreachable and PI receive_exception was invoked.\n")); + return 0; + } + else + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Error: regression failed - interceptor receive_exception interception point was not invoked !!\n"), + 1); + } + } + + return 1; +} diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl new file mode 100755 index 00000000000..0af02716e71 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl @@ -0,0 +1,76 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill (60); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->GetStderrLog(); +$client->GetStderrLog(); + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp new file mode 100644 index 00000000000..95d61429e99 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp @@ -0,0 +1,99 @@ +// $Id$ + +#include "Hello.h" +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" + +ACE_RCSID (Hello, + server, + "server.cpp,v 1.6 2003/11/01 11:15:11 dhinton Exp") + +const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA" ); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + if (parse_args (argc, argv) != 0) + return 1; + + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(hello_impl); + + Test::Hello_var hello = + hello_impl->_this (); + + CORBA::String_var ior = + orb->object_to_string (hello.in () ); + + // Output the IOR to the <ior_output_file> + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + root_poa->destroy (1, 1 ); + + orb->destroy (); + + ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp index a6e927cdee9..dd804403c50 100644 --- a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp @@ -9,6 +9,7 @@ Messenger_i::send_message (const char *user_name, const char *subject, ACE_TEXT ("Message from: %C\nSubject: %C\nMessage: %C\n"), user_name, subject, message)); const char *reply = "A reply from the server."; + CORBA::string_free (message); message = CORBA::string_dup (reply); if (++this->count_ == 6) { diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl index 17d3baacc3e..c0690e1d2a3 100755 --- a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl @@ -72,7 +72,7 @@ sub RunImRUtil { my $cmd = shift; print ">>> " . $imr_util->CommandLine() . "\n"; $imr_util->Arguments("$imr_init_ref $cmd"); - return $imr_util->SpawnWaitKill(5); + return $imr_util->SpawnWaitKill(15); } CleanupOutput(); diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp index e6deec621e4..bce2b51d639 100644 --- a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp @@ -63,18 +63,20 @@ Nestea_Client_i::run () this->server_->drink (40); this->server_->drink (100); + CORBA::String_var praise = this->server_->get_praise (); ACE_DEBUG ((LM_DEBUG, "Cans: %d\n" "Praise: %s\n", this->server_->bookshelf_size (), - this->server_->get_praise ())); + praise.in ())); this->server_->drink (500); this->server_->crush (200); + praise = this->server_->get_praise (); ACE_DEBUG ((LM_DEBUG, "Cans: %d\n" "Praise: %s\n", this->server_->bookshelf_size (), - this->server_->get_praise ())); + praise.in ())); if (shutdown_server_) server_->shutdown(); diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc index 944ad98a87a..aba13d6261e 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*server): taoexe, portableserver, ifr_client, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { +project(*server): taoexe, portableserver, ifr_client, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro, svc_utils { exename = server Source_Files { test_i.cpp diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am index 6517b5c8c06..4aaef665047 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am @@ -84,7 +84,9 @@ server_CPPFLAGS = \ -I$(ACE_ROOT) \ -I$(ACE_BUILDDIR) \ -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) + -I$(TAO_BUILDDIR) \ + -I$(TAO_ROOT)/orbsvcs \ + -I$(TAO_BUILDDIR)/orbsvcs server_SOURCES = \ server.cpp \ @@ -98,6 +100,7 @@ server_SOURCES = \ test_i.h server_LDADD = \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp index 0b1c27df492..1b10ffa023a 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp @@ -3,11 +3,31 @@ #include "test_i.h" #include "ace/OS_NS_stdio.h" +#include "orbsvcs/Shutdown_Utilities.h" ACE_RCSID(Application_Test, server, "$Id$") static const ACE_TCHAR *ior_output_file = ACE_TEXT("iorfile"); +class Service_Shutdown_Functor : public Shutdown_Functor +{ +public: + Service_Shutdown_Functor (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate (orb)) + { + } + + void operator() (int which_signal) + { + ACE_DEBUG ((LM_DEBUG, + "shutting down on signal %d\n", which_signal)); + (void) this->orb_->shutdown (); + } + +private: + CORBA::ORB_var orb_; +}; + static int write_ior_to_file (const char *ior) { @@ -41,10 +61,13 @@ write_ior_to_file (const char *ior) int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - try - { + try + { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + Service_Shutdown_Functor killer (orb.in ()); + Service_Shutdown kill_contractor (killer); + CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA"); @@ -78,6 +101,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) root_poa->destroy (1, 1); + + orb->destroy (); } catch (const CORBA::Exception& ex) { diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp index c1fdcb889ee..08a803ea8d8 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp @@ -20,6 +20,8 @@ inventory_i::getCDinfo (const char * artist, price = 0.0f; ACE_CString name_key ("Beatles"); ACE_CString name (artist); + CORBA::String_var tmp = title; + ACE_UNUSED_ARG (tmp); if (name.strstr (name_key) != ACE_CString::npos) { diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp index d349656112e..af3c68e0cd8 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp @@ -10,7 +10,7 @@ const char *member_type_id= "IDL:arrayOfStruct:1.0"; int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - CORBA::ORB_ptr the_orb = CORBA::ORB_init (argc, argv); + CORBA::ORB_var the_orb = CORBA::ORB_init (argc, argv); CORBA::Object_var obj = the_orb->string_to_object (ifr_ior); if (CORBA::is_nil (obj.in())) @@ -57,8 +57,10 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) tc_content = orig_type->type (); const CORBA::ULong length= tc_content->length (); + CORBA::TypeCode_var + cont_type = tc_content->content_type (); const char - *name= tc_content->content_type ()->name (); + *name= cont_type->name (); ACE_DEBUG ((LM_DEBUG, " = %C [%u]\n", name, diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp index 5cd83c41ae5..a1a1980214a 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp @@ -1,8 +1,8 @@ // $Id$ +#include "tao/IFR_Client/IFR_ComponentsC.h" #include "ace/Get_Opt.h" #include "tao/ORB.h" -#include "tao/IFR_Client/IFR_ComponentsC.h" namespace { @@ -100,7 +100,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // get value type definition CORBA::ExtValueDef_var value_def = CORBA::ExtValueDef::_narrow (current_contained.in ()); - CORBA::ExtValueDef::ExtFullValueDescription * value_descr; + CORBA::ExtValueDef::ExtFullValueDescription_var value_descr; try { value_descr = value_def->describe_ext_value (); diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp index 78ac2742dfe..3b0c332f536 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp @@ -10,42 +10,40 @@ ACE_RCSID (IFR_Inheritance_Test, main, "$Id$") -void printContents( const CORBA::ContainedSeq& cont ) +void printContents (const CORBA::ContainedSeq& cont) { try { - for( unsigned int i=0; i<cont.length(); i++ ) + for (CORBA::ULong i = 0; i < cont.length(); ++i) { - if( cont[i]->describe()->kind == CORBA::dk_Interface ) + CORBA::Contained::Description_var topdesc = cont[i]->describe (); + if (topdesc->kind == CORBA::dk_Interface) { CORBA::InterfaceDef_var intDef = - CORBA::InterfaceDef::_narrow (cont[i] - ); + CORBA::InterfaceDef::_narrow (cont[i]); - CORBA::InterfaceDef::FullInterfaceDescription* desc = + CORBA::InterfaceDef::FullInterfaceDescription_var desc = intDef->describe_interface (); - //printf( "-- %s:\n", (const char*)(desc->name) ); + //printf ("-- %s:\n", desc->name.in ()); - for( unsigned int j1=0; j1 < desc->operations.length (); j1++ ) - ACE_OS::printf( "operation %s::%s\n", - (const char*)(desc->name), - (const char*)((desc->operations[j1]).name) ); + for (CORBA::ULong j1 = 0; j1 < desc->operations.length (); ++j1) + ACE_OS::printf ("operation %s::%s\n", + desc->name.in (), + desc->operations[j1].name.in ()); - for( unsigned int j2=0; j2 < desc->attributes.length (); j2++ ) - ACE_OS::printf( "attribute %s::%s\n", - (const char*)(desc->name), - (const char*)((desc->attributes[j2]).name) ); + for (CORBA::ULong j2 = 0; j2 < desc->attributes.length (); ++j2) + ACE_OS::printf ("attribute %s::%s\n", + desc->name.in (), + desc->attributes[j2].name.in ()); } - else if( cont[i]->describe ()->kind == CORBA::dk_Module ) + else if (topdesc->kind == CORBA::dk_Module) { CORBA::ModuleDef_var moduleDef = - CORBA::ModuleDef::_narrow (cont[i] - ); + CORBA::ModuleDef::_narrow (cont[i]); CORBA::ContainedSeq_var moduleContents = - moduleDef->contents (CORBA::dk_all,1 - ); + moduleDef->contents (CORBA::dk_all, 1); printContents (moduleContents.in ()); } } @@ -61,7 +59,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var object = orb->resolve_initial_references ("InterfaceRepository"); @@ -69,10 +67,8 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_ERROR_RETURN (( LM_ERROR, - "Null objref from resolve_initial_references\n" - ), - -1 - ); + "Null objref from resolve_initial_references\n"), + -1); } CORBA::Repository_var ifr = @@ -85,12 +81,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -1); } - CORBA::ContainedSeq_var cont = ifr->contents (CORBA::dk_all, 0); + CORBA::ContainedSeq_var cont = ifr->contents (CORBA::dk_all, 0); - printContents (cont.in ()); - - orb->shutdown (); + printContents (cont.in ()); + orb->destroy (); } catch (const CORBA::Exception& ex) { diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl index 7e43769cedf..ce9cf02cfaa 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl @@ -81,7 +81,7 @@ if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_cr exit 1; } -if( $TAO_IFR->SpawnWaitKill(10) != 0 ) +if( $TAO_IFR->SpawnWaitKill(20) != 0 ) { print STDERR "ERROR: can't compile IDL\n"; $TAO_IFR->Kill (); @@ -151,6 +151,6 @@ if ($server != 0) { } unlink $iorfile; +unlink $testoutputfilename; exit $status; - diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc new file mode 100644 index 00000000000..d900bd56fd6 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc @@ -0,0 +1,26 @@ +// -*- MPC -*- +// $Id$ + +project(*Consumer) : orbsvcsexe, notification, notification_skel, naming { + exename = consumer + Source_Files { + consumer.cpp + } +} + + +project(*Supplier) : orbsvcsexe, notification, notification_skel, naming { + exename = supplier + + Source_Files { + supplier.cpp + } +} + +project(*Filter) : orbsvcsexe, notification, notification_skel, naming { + exename = filter + + Source_Files { + filter.cpp + } +} diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h new file mode 100644 index 00000000000..18df456f8d4 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h @@ -0,0 +1,83 @@ +// $Id$ + +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h" +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h" +#include <iostream> +const char *ior = "file://ecf.ior"; + +CosNotifyChannelAdmin::EventChannel_var +get_event_channel(CORBA::ORB_ptr orb) + +{ + CosNotifyChannelAdmin::EventChannel_var ec; + CosNotifyChannelAdmin::ChannelID id; + CosNotification::QoSProperties init_qos(0); + CosNotification::AdminProperties init_admin(0); + + std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl; + std::cout << "IorEventChannelFactory=" << ior << std::endl; + CORBA::Object_var obj = orb->string_to_object(ior); + + if (CORBA::is_nil(obj.in ())) + { + std::cerr << "Bad ec_fact.ior " << std::endl; + ACE_OS::exit (1); + } + + CosNotifyChannelAdmin::EventChannelFactory_var factory = + CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ()); + if (CORBA::is_nil(factory.in())) + { + std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl; + ACE_OS::exit(1); + } + + //Get the first ec + CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq; + try + { + channelIdSeq = factory->get_all_channels(); + } + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during get_all_channels: " + << se << std::endl; + throw; + } + + if( channelIdSeq->length() == 0 ) + { + try + { + ec = factory->create_channel( init_qos, init_admin, id); + } + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during find_channel: " + << se << std::endl; + throw; + } + } + else { + try + { + ec = factory->get_event_channel(channelIdSeq[0]); + } + catch (CosNotifyChannelAdmin::ChannelNotFound& ) + { + std::cerr << "ChannelNotFound: " + << channelIdSeq[0] << std::endl; + throw; + } + + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during get_event_channel: " + << se << std::endl; + throw; + } + } + + return ec._retn(); +} + diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp new file mode 100644 index 00000000000..e95740fec0d --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp @@ -0,0 +1,205 @@ +// $Id$ + +#include "common.h" + +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdlib.h" + +int runtime = 5; //sec + + +namespace CosNotifyCommImpl{ + class StructuredPushConsumer: public virtual POA_CosNotifyComm:: StructuredPushConsumer + { + public: + StructuredPushConsumer () : received_ (false) {}; + virtual ~ StructuredPushConsumer () {}; + + void push_structured_event( + const CosNotification::StructuredEvent &event) + { + std::cout << "Received an event...," << std::endl; + std::cout << "event.header.fixed_header.event_type.domain_name = " + << event.header.fixed_header.event_type.domain_name + << std::endl; + std::cout << "event.header.fixed_header.event_type.type_name = " + << event.header.fixed_header.event_type.type_name + << std::endl; + + }; + + void disconnect_structured_push_consumer() + {}; + + void offer_change ( + const CosNotification::EventTypeSeq &, + const CosNotification::EventTypeSeq &) + {}; + + bool received_events () + { + return this->received_; + }; + + private: + bool received_; + }; +} + +int parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "t:"); + int x; + + while ((x = get_opts ()) != -1) + switch (x) + { + case 't': + runtime = ACE_OS::atoi (get_opts.optarg); + break; + + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %s -t <runtime>\n"), + argv [0]), + -1); + } + + return 0; // successful parse +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableServer::POAManager_var poa_manager; + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in()); + + poa_manager = root_poa->the_POAManager(); + + if (parse_args (argc, argv) != 0) + return 1; + + poa_manager->activate(); + + /*Get event_channel*/ + std::cout << "Get event_channel now" << std::endl; + CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in()); + + //Instanciating the Consumer + CosNotifyComm::StructuredPushConsumer_var spc = + CosNotifyComm::StructuredPushConsumer::_nil(); + + CosNotifyCommImpl::StructuredPushConsumer *pImpl_spc = new CosNotifyCommImpl::StructuredPushConsumer; + spc = pImpl_spc->_this(); + + //Obtain a Consumer Admin + CosNotifyChannelAdmin::AdminID adminid = 0; + CosNotifyChannelAdmin::ConsumerAdmin_var ca = + ec->new_for_consumers (CosNotifyChannelAdmin::AND_OP, adminid); + + if( ca.in() == CosNotifyChannelAdmin::ConsumerAdmin::_nil() ){ + std::cerr << "ca is nil!" << std::endl; + return 1; + } + + //Obtain a Proxy Consumer + CosNotifyChannelAdmin::ProxyID proxy_id; + CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT; + + CosNotifyChannelAdmin::ProxySupplier_var proxySupplier_obj; + try + { + proxySupplier_obj = ca->obtain_notification_push_supplier(ctype, proxy_id); + } + catch(CosNotifyChannelAdmin::AdminLimitExceeded err) + { + std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl; + throw; + } + + CosNotifyChannelAdmin::StructuredProxyPushSupplier_var pps = + CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(proxySupplier_obj.in()); + + + //Attaching a filter to pps + CosNotifyFilter::FilterFactory_var dff = + ec->default_filter_factory(); + + ACE_ASSERT(!CORBA::is_nil(dff.in())); + + CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL"); + + CosNotification::EventTypeSeq event_types(1); + event_types.length(2); + + event_types[0].domain_name = CORBA::string_dup("DomainA"); + event_types[0].type_name = CORBA::string_dup("TypeA"); + event_types[1].domain_name = CORBA::string_dup("DomainB"); + event_types[1].type_name = CORBA::string_dup("TypeB"); + + CosNotifyFilter::ConstraintExpSeq constraints(1); + constraints.length(1); + + constraints[0].event_types = event_types; + constraints[0].constraint_expr = CORBA::string_dup( + ""); + + filter->add_constraints(constraints); + + pps->add_filter(filter.in()); + + std::cout << "Attached a filter to ProxyPushSupplier" << std::endl; + std::cout << "The filter's event_types[0].domain_name=" << event_types[0].domain_name << std::endl; + std::cout << "The filter's event_types[0].type_name=" << event_types[0].type_name << std::endl; + std::cout << "The filter's event_types[1].domain_name=" << event_types[1].domain_name << std::endl; + std::cout << "The filter's event_types[1].type_name=" << event_types[1].type_name << std::endl; + + + //Connecting a Supplier to a Proxy Consumer + try + { + pps->connect_structured_push_consumer(spc.in()); + } + catch (CosEventChannelAdmin::AlreadyConnected ac) + { + std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl; + throw; + } + catch (CORBA::SystemException& se) + { + std::cerr << "System exception occurred during connect: " << + se << std::endl; + throw; + } + + + ACE_Time_Value tv (runtime); + orb->run (tv); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Consumer done.\n"))); + + if (pImpl_spc->received_events ()) + { + //Consumer should not receive any events as it's filtered with event type. + std::cerr << "Test failed - received test events." << std::endl; + return 1; + } + else + { + std::cerr << "Test passed - did not receive test events as expected." << std::endl; + } + } + catch(...) + { + std::cerr << "Consumer: Some exceptions was caught!" << std::endl; + return 1; + } + + + return 0; +} + diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf new file mode 100644 index 00000000000..8c29f3485b8 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf @@ -0,0 +1,2 @@ +dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v" + diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp new file mode 100644 index 00000000000..6be470f7276 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp @@ -0,0 +1,246 @@ +// $Id$ + +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h" +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h" + +#include <iostream> + + +const char *ior = "file://ecf.ior"; + +CosNotifyChannelAdmin::EventChannel_var +get_event_channel(CORBA::ORB_ptr orb) + +{ + CosNotifyChannelAdmin::EventChannel_var ec; + CosNotifyChannelAdmin::ChannelID id; + CosNotification::QoSProperties init_qos(0); + CosNotification::AdminProperties init_admin(0); + + + + std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl; + std::cout << "IorEventChannelFactory=" << ior << std::endl; + CORBA::Object_var obj = orb->string_to_object(ior); + + if (CORBA::is_nil(obj.in ())) + { + std::cerr << "Bad ec_fact.ior " << std::endl; + exit(1); + } + + + CosNotifyChannelAdmin::EventChannelFactory_var factory = + CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ()); + if (CORBA::is_nil(factory.in())) + { + std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl; + exit(1); + } + + //Get the first ec + CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq; + try + { + channelIdSeq = factory->get_all_channels(); + } + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during get_all_channels: " + << se << std::endl; + exit(1); + } + + if( channelIdSeq->length() == 0 ) + { + + try + { + ec = factory->create_channel( init_qos, init_admin, id); + } + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during find_channel: " + << se << std::endl; + exit(1); + } + } + else { + try + { + ec = factory->get_event_channel(channelIdSeq[0]); + } + catch (CosNotifyChannelAdmin::ChannelNotFound&) + { + std::cerr << "ChannelNotFound: " + << channelIdSeq[0] << std::endl; + exit(1); + } + + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during get_event_channel: " + << se << std::endl; + exit(1); + } + + } + + return ec._retn(); +} + + +void match_structure_test (const CosNotifyFilter::Filter_var& filter, + const CosNotification::StructuredEvent& event, + bool & expected_result) +{ + bool bResult = false; + try{ + bResult = filter->match_structured(event); + } + catch(CosNotifyFilter::UnsupportedFilterableData) + { + std::cerr << "UnsupportedFilterableData!" << std::endl; + } + catch (CORBA::SystemException& se ) + { + std::cerr << "System exception occurred during match_structured: " + << se << std::endl; + exit(1); + } + + std::cout << "The result is:" << (bResult?"Match":"Unmatch") << std::endl; + + if (bResult != expected_result) + { + // The result should be unmatched as it's filtered with event type. + std::cerr << "filter test failed." << std::endl; + exit(1); + } +} + + +void update_constraints (const CosNotifyFilter::Filter_var& filter, + const char* domain1, const char* type1, + const char* domain2, const char* type2) +{ + filter->remove_all_constraints (); + + CosNotification::EventTypeSeq event_types(2); + event_types.length(2); + + event_types[0].domain_name = CORBA::string_dup(domain1); + event_types[0].type_name = CORBA::string_dup(type1); + + event_types[1].domain_name = CORBA::string_dup(domain2); + event_types[1].type_name = CORBA::string_dup(type2); + + CosNotifyFilter::ConstraintExpSeq constraints(1); + constraints.length(1); + + constraints[0].event_types = event_types; + constraints[0].constraint_expr = CORBA::string_dup(""); + + CosNotifyFilter::ConstraintInfoSeq_var cons_info + = filter->add_constraints(constraints); + + std::cout << "Constructing a filter..." << std::endl; + + for (CORBA::ULong i = 0; i < event_types.length(); ++i) + { + std::cout << "\tevent_types[" << i << "].domain_name=" + << event_types[i].domain_name + << std::endl; + std::cout << "\tevent_types[" << i << "].type_name=" + << event_types[i].type_name + << std::endl; + } + + std::cout << "\tIts constraint =" + << constraints[0].constraint_expr.in () + << std::endl; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableServer::POAManager_var poa_manager; + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in()); + + poa_manager = root_poa->the_POAManager(); + + poa_manager->activate(); + + /*Get event_channel*/ + std::cout << "Get event_channel now" << std::endl; + CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in()); + + //Attaching a filter to pps + CosNotifyFilter::FilterFactory_var dff = + ec->default_filter_factory(); + + ACE_ASSERT(!CORBA::is_nil(dff.in())); + + std::cout << "Test CosNotifyFilter::Filter::match_structured" << std::endl; + + //Constructing a test event + CosNotification::StructuredEvent event; + + event.header.fixed_header.event_type.domain_name = + CORBA::string_dup("Test_domain"); + event.header.fixed_header.event_type.type_name = + CORBA::string_dup("Test_type_name"); + + event.header.variable_header.length(0); + event.remainder_of_body <<= ""; + + std::cout << "Constructing a test event" << std::endl; + std::cout << "\tIts header.fixed_header.event_type.domain_name=" + << event.header.fixed_header.event_type.domain_name + << std::endl; + std::cout << "\tIts header.fixed_header.event_type.type_name=" + << event.header.fixed_header.event_type.type_name + << std::endl; + + CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL"); + update_constraints (filter, "DomainA", "TypeA", "DomainB", "TypeB"); + + bool expected_result = false; + match_structure_test (filter, event, expected_result); + + update_constraints (filter, "*", "%ALL", "DomainB", "TypeB"); + expected_result = true; + match_structure_test (filter, event, expected_result); + + update_constraints (filter, "Test_domain", "%ALL", "DomainB", "TypeB"); + expected_result = true; + match_structure_test (filter, event, expected_result); + + update_constraints (filter, "*", "Test_type_name", "DomainB", "TypeB"); + expected_result = true; + match_structure_test (filter, event, expected_result); + + update_constraints (filter, "*", "*", "*", "*"); + expected_result = true; + match_structure_test (filter, event, expected_result); + + orb->shutdown(); + + } + catch(...) + { + std::cerr << "Filter: Some exceptions was caught!" << std::endl; + exit(1); + } + + + return 0; +} + + diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl new file mode 100755 index 00000000000..f40dd5eee68 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl @@ -0,0 +1,118 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; +use strict; + +my $persistent_test = 0; +my $notifyior = PerlACE::LocalFile("ecf.ior"); +my $notify2ior = PerlACE::LocalFile("ecf2.ior"); +my $notify_conf = PerlACE::LocalFile("ecf$PerlACE::svcconf_ext"); +my $port = PerlACE::uniqueid () + 10005; +my $nts_ref = "NotifyService=iioploc://localhost:$port/NotifyService"; +my $svcconf = ""; +my $consumer_runtime = 5; +my $persistent_file = PerlACE::LocalFile ("persistency.notif.xml"); +my $persistent_file_backup = PerlACE::LocalFile ("persistency.notif.000"); + + +if ($#ARGV >= 0 && $ARGV[0] eq '-p') { + $persistent_test = 1; + $svcconf = " -ORBSvcConf $notify_conf"; + $consumer_runtime = 20; +} + +my $NTS = new PerlACE::Process("../../../Notify_Service/Notify_Service", + "-ORBDebugLevel 1 ". + "-NoNameSvc -IORoutput $notifyior $svcconf " . + "-ORBEndpoint iiop://localhost:$port"); +my $SUPPLIER = new PerlACE::Process("supplier", "$nts_ref"); +my $CONSUMER = new PerlACE::Process("consumer", "$nts_ref -t $consumer_runtime"); +my $FILTER = new PerlACE::Process("filter", "$nts_ref"); + +unlink($notifyior, $persistent_file, $persistent_file_backup); + + +print "\n*********** Starting the Notify_Service ***********\n\n"; +$NTS->Spawn(); +if (PerlACE::waitforfile_timed($notifyior, 20) == -1) { + print STDERR "ERROR: waiting for the notify service to start\n"; + $NTS->Kill(); + exit(1); +} + +if ($persistent_test == 0) +{ + print "\n*********** Starting the filter test ***********\n\n"; + my $filter = $FILTER->SpawnWaitKill (10); + if ($filter != 0) { + $NTS->Kill(); + exit(1); + } + + print "\n*********** Filter test passed ***********\n\n"; +} + +print "\n*********** Starting the notification Consumer ***********\n\n"; +print STDERR $CONSUMER->CommandLine (). "\n"; + +my $client = $CONSUMER->Spawn(); +if ($client != 0) { + $NTS->Kill(); + exit(1); +} + +sleep(5); + +if ($persistent_test == 1) +{ + print "*********** Killing the first Notify_Service ***********\n"; + $NTS->Kill(); + sleep(1); + + unlink ($notifyior); + + print "*********** Starting the second Notify_Service ***********\n"; +print STDERR $NTS->CommandLine (). "\n"; + $NTS->Spawn(); + if (PerlACE::waitforfile_timed($notifyior, 20) == -1) { + print STDERR "ERROR: waiting for the notify service to start\n"; + $SUPPLIER->Kill(); + exit(1); + } + + sleep(5); +} + +print "\n*********** Starting the notification Supplier ***********\n\n"; +print STDERR $SUPPLIER->CommandLine (). "\n"; + +my $server = $SUPPLIER->Spawn(); +if ($server != 0) { + $NTS->Kill(); + $CONSUMER->Kill(); + exit(1); +} + +$server = $SUPPLIER->WaitKill(10); +if ($server != 0) { + $NTS->Kill(); + $CONSUMER->Kill(); + exit(1); +} + +$client = $CONSUMER->WaitKill($consumer_runtime + 10); +if ($client != 0) { + $NTS->Kill(); + exit(1); +} + +$NTS->Kill(); + +#unlink($notifyior, $persistent_file, $persistent_file_backup); +exit(0); diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp new file mode 100644 index 00000000000..5088b562343 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp @@ -0,0 +1,148 @@ +// $Id$ + +#include "common.h" +#include "ace/OS.h" + + +namespace CosNotifyCommImpl{ + class StructuredPushSupplier: public virtual POA_CosNotifyComm:: StructuredPushSupplier + { + public: + void disconnect_structured_push_supplier() + {}; + void subscription_change( const CosNotification::EventTypeSeq&, + const CosNotification::EventTypeSeq&) + {}; + + }; +} + + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableServer::POAManager_var poa_manager; + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in()); + + poa_manager = root_poa->the_POAManager(); + + poa_manager->activate(); + + /*Get event_channel*/ + std::cout << "Create event_channel now" << std::endl; + CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in()); + + //Instanciating the Supplier + CosNotifyComm::StructuredPushSupplier_var sps = + CosNotifyComm::StructuredPushSupplier::_nil(); + + + CosNotifyCommImpl::StructuredPushSupplier *pImpl_sps = new CosNotifyCommImpl::StructuredPushSupplier; + sps = pImpl_sps->_this(); + + //Obtain a Supplier Admin + CosNotifyChannelAdmin::SupplierAdmin_var sa = ec->default_supplier_admin(); + if( sa.in() == CosNotifyChannelAdmin::SupplierAdmin::_nil() ){ + std::cerr << "sa is nil!" << std::endl; + return 1; + } + + //Obtain a Proxy Consumer + CosNotifyChannelAdmin::ProxyID proxy_id; + CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT; + + CosNotifyChannelAdmin::ProxyConsumer_var proxyCon_obj; + try + { + proxyCon_obj = sa->obtain_notification_push_consumer(ctype, proxy_id); + } + catch(CosNotifyChannelAdmin::AdminLimitExceeded err) + { + std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl; + throw; + } + + CosNotifyChannelAdmin::StructuredProxyPushConsumer_var ppc = + CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(proxyCon_obj.in()); + + //Connecting a Supplier to a Proxy Consumer + try + { + ppc->connect_structured_push_supplier(sps.in()); + } + catch (CosEventChannelAdmin::AlreadyConnected ac) + { + std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl; + throw; + } + catch (CORBA::SystemException& se) + { + std::cerr << "System exception occurred during connect: " << + se << std::endl; + throw; + } + + + //Demo::demo_send_heart_beat(ppc); + //Send a Demo Notification + + CosNotification::StructuredEvent event; + + event.header.fixed_header.event_type.domain_name = + CORBA::string_dup("Test_domain"); + event.header.fixed_header.event_type.type_name = + CORBA::string_dup("Test_type_name"); + + event.header.variable_header.length(0); + event.remainder_of_body <<= ""; + + std::cout << "Sending a demo event...," << std::endl; + std::cout << "event.header.fixed_header.event_type.domain_name = " + << event.header.fixed_header.event_type.domain_name + << std::endl; + std::cout << "event.header.fixed_header.event_type.type_name = " + << event.header.fixed_header.event_type.type_name + << std::endl; + + + try{ + ppc->push_structured_event(event); + } + catch (CORBA::SystemException& se) + { + std::cerr << "System exception occurred during push: " + << se << std::endl; + throw; + } + catch (CORBA::Exception&) + { + std::cerr << "Unknown exception occurred during push" << std::endl; + throw; + } + + try{ + ppc->disconnect_structured_push_consumer(); + } + catch(CORBA::Exception&) + { + std::cerr << "Disconnect fail!" << std::endl; + } + + orb->shutdown(); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Supplier done.\n"))); + } + catch(...) + { + std::cerr << "Supplier: Some exceptions was caught!" << std::endl; + return 1; + } + + + return 0; +} + diff --git a/TAO/orbsvcs/tests/Notify/Makefile.am b/TAO/orbsvcs/tests/Notify/Makefile.am index 7411a1a6d95..fd57f40dcae 100644 --- a/TAO/orbsvcs/tests/Notify/Makefile.am +++ b/TAO/orbsvcs/tests/Notify/Makefile.am @@ -20,6 +20,7 @@ SUBDIRS = \ Sequence_Multi_ETCL_Filter \ Reconnecting \ RT_lib \ + Persistent_Filter \ Persistent_POA \ Ordering \ MT_Dispatching \ @@ -31,7 +32,8 @@ SUBDIRS = \ Bug_1385_Regression \ Blocking \ Basic \ - Timeout + Timeout \ + Validate_Client if BUILD_TESTS SUBDIRS += performance-tests diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.cpp b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.cpp new file mode 100644 index 00000000000..3176f89fcdd --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.cpp @@ -0,0 +1,752 @@ +/* -*- C++ -*- $Id$ */ + +#include "Filter.h" +#include "ace/Get_Opt.h" +#include "ace/OS.h" + +ACE_RCSID(Filter, Filter, "Filter.cpp,v 1.13 2002/05/28 20:24:16 pradeep Exp") + +#define NOTIFY_FACTORY_NAME "NotifyEventChannelFactory" +#define NAMING_SERVICE_NAME "NameService" +#define CA_FILTER "threshold < 20" +#define SA_FILTER "threshold > 10" + +#define MOD_CA_FILTER "threshold < 15" +#define MOD_SA_FILTER "threshold > 10" + +#define TCL_GRAMMAR "TCL" +#define EVENTS_TO_SEND 30 +int EVENTS_EXPECTED_TO_RECEIVE = 9*4; // 2 consumers get the same events from 2 suppliers +#define DOMAIN_NAME "*" +#define TYPE_NAME "*" + + ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> g_result_count = 0; + +FilterClient::FilterClient (void) + :consumer_1 (0), + consumer_2 (0), + supplier_1 (0), + supplier_2 (0), + adminid_1_id_ (0), + adminid_2_id_ (0), + channel_id_ (0), + use_persistent_ (false), + modify_constraint_ (false), + done_ (0) +{ + g_result_count = 0; + // No-Op. + ifgop_ = CosNotifyChannelAdmin::AND_OP; +} + +FilterClient::~FilterClient () +{ +} + + +int +FilterClient::parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt opts (argc, argv, ACE_TEXT("pm")); + int c; + + while ((c = opts ()) != -1) + switch (c) + { + case 'p': + this->use_persistent_ = true; + break; + case 'm': + this->modify_constraint_ = true; + EVENTS_EXPECTED_TO_RECEIVE = 4*4; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %C [-p] [-m]\n"), + argv [0]), + -1); + } + + return 0; +} + +void +FilterClient::init_supplier (int argc, ACE_TCHAR *argv []) +{ + init_ORB (argc, argv); + + if (parse_args (argc, argv) == -1) + { + ACE_OS::exit (1); + } + + resolve_naming_service (); + + resolve_Notify_factory (); + + if (this->use_persistent_) + { + get_EC (); + } + else + { + create_EC (); + } + + if (this->use_persistent_) + { + get_supplieradmin (); + } + else + { + create_supplieradmin (); + } + + create_suppliers (); +} + + +void +FilterClient::init_consumer (int argc, ACE_TCHAR *argv []) +{ + init_ORB (argc, argv); + + if (parse_args (argc, argv) == -1) + { + ACE_OS::exit (1); + } + + resolve_naming_service (); + + resolve_Notify_factory (); + + get_EC (); + + if (this->use_persistent_) + { + get_consumeradmin (); + } + else + { + create_consumeradmin (); + } + + create_consumers (); +} + +void +FilterClient::wait_ready () +{ + while ( 1 ) + { + CosNotifyChannelAdmin::AdminIDSeq_var cons_ids + = ec_->get_all_consumeradmins (); + + CosNotifyChannelAdmin::AdminIDSeq_var sup_ids + = ec_->get_all_supplieradmins (); + + if (cons_ids->length () + sup_ids->length () == 3) + break; + else + ACE_OS::sleep (1); + } +} + + +void +FilterClient::wait_consumer_complete () +{ + int i = 0; + const int TIMEOUT = 30; + + while ( i < TIMEOUT ) + { + try + { + CosNotifyChannelAdmin::AdminIDSeq_var ids + = this->ec_->get_all_consumeradmins(); + + if (ids->length () > 0) + { + ACE_OS::sleep (1); + ++i; + } + else + break; + } + catch (const CORBA::OBJECT_NOT_EXIST&) + { + break; + } + } +} + + +void +FilterClient::run_supplier () +{ + this->wait_ready (); + + //Add delay so consumer won't miss any events. + ACE_OS::sleep (5); + + send_events (); + + this->wait_consumer_complete (); +} + +void +FilterClient::run_consumer () +{ + this->wait_ready (); + + if (g_result_count != EVENTS_EXPECTED_TO_RECEIVE) + { // if we still need to wait for events, run the orb. + while (!this->done_) + if (this->orb_->work_pending ()) + this->orb_->perform_work (); + } + + //ACE_DEBUG ((LM_DEBUG, "(%P|%t)destroying consumer admins ... \n")); + + //this->consumer_admin_1_->destroy (); + //this->consumer_admin_2_->destroy (); +} + +void +FilterClient::done (void) +{ + this->done_ = 1; +} + +void +FilterClient::init_ORB (int& argc, ACE_TCHAR **& argv) +{ + this->orb_ = CORBA::ORB_init (argc, argv); + + + CORBA::Object_ptr poa_object = + this->orb_->resolve_initial_references("RootPOA"); + + if (CORBA::is_nil (poa_object)) + { + ACE_ERROR ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n")); + return; + } + this->root_poa_ = + PortableServer::POA::_narrow (poa_object); + + PortableServer::POAManager_var poa_manager = + root_poa_->the_POAManager (); + + poa_manager->activate (); +} + +void +FilterClient::resolve_naming_service () +{ + CORBA::Object_var naming_obj = + this->orb_->resolve_initial_references (NAMING_SERVICE_NAME); + + // Need to check return value for errors. + if (CORBA::is_nil (naming_obj.in ())) + throw CORBA::UNKNOWN (); + + this->naming_context_ = + CosNaming::NamingContext::_narrow (naming_obj.in ()); +} + +void +FilterClient::resolve_Notify_factory () +{ + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (NOTIFY_FACTORY_NAME); + + CORBA::Object_var obj = + this->naming_context_->resolve (name); + + this->notify_factory_ = + CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ()); +} + +void +FilterClient::create_EC () +{ + ec_ = notify_factory_->create_channel (initial_qos_, + initial_admin_, + channel_id_); + + ACE_ASSERT (!CORBA::is_nil (ec_.in ())); +} + +void +FilterClient::get_EC () +{ + int i = 0; + const int TIMEOUT = 20; + while (i < TIMEOUT) + { + CosNotifyChannelAdmin::ChannelIDSeq_var ids + = notify_factory_->get_all_channels (); + + if (ids->length () > 0) + { + //ACE_DEBUG ((LM_DEBUG, "(%P|%t)get_EC %d \n", ids->length ())); + ec_ = notify_factory_->get_event_channel (ids[0]); + + ACE_ASSERT (!CORBA::is_nil (ec_.in ())); + break; + } + else + { + ++ i; + ACE_OS::sleep (1); + } + } +} + +void +FilterClient::create_supplieradmin () +{ + CosNotifyChannelAdmin::AdminID adminid = 0; + + supplier_admin_ = + ec_->new_for_suppliers (this->ifgop_, adminid); + + ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ())); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)create_supplieradmin %d \n"), adminid)); + + CosNotifyFilter::FilterFactory_var ffact = + ec_->default_filter_factory (); + + // setup a filter at the consumer admin + CosNotifyFilter::Filter_var sa_filter = + ffact->create_filter (TCL_GRAMMAR); + + ACE_ASSERT (!CORBA::is_nil (sa_filter.in ())); + + CosNotifyFilter::ConstraintExpSeq constraint_list (2); + constraint_list.length (2); + + constraint_list[0].event_types.length (1); + constraint_list[0].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME); + constraint_list[0].event_types[0].type_name = CORBA::string_dup(TYPE_NAME); + + constraint_list[0].constraint_expr = CORBA::string_dup (SA_FILTER); + constraint_list[1].event_types.length (1); + constraint_list[1].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME); + constraint_list[1].event_types[0].type_name = CORBA::string_dup(TYPE_NAME); + constraint_list[1].constraint_expr = CORBA::string_dup (SA_FILTER); + + sa_filter->add_constraints (constraint_list); + + supplier_admin_->add_filter (sa_filter.in ()); +} + + +void +FilterClient::get_supplieradmin () +{ + CosNotifyChannelAdmin::AdminIDSeq_var ids + = ec_->get_all_supplieradmins(); + + ACE_ASSERT (ids->length () == 1); + + supplier_admin_ = ec_->get_supplieradmin (ids[0]); + + ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ())); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)get_supplieradmin %d \n"), ids[0])); + + CosNotifyFilter::FilterAdmin_var admin + = CosNotifyFilter::FilterAdmin::_narrow (supplier_admin_.in ()); + verify_filter (admin, SA_FILTER, MOD_SA_FILTER); +} + + +void +FilterClient::create_consumeradmin () +{ + consumer_admin_1_ = + ec_->new_for_consumers (this->ifgop_, this->adminid_1_id_); + + ACE_ASSERT (!CORBA::is_nil (consumer_admin_1_.in ())); + + consumer_admin_2_ = + ec_->new_for_consumers (this->ifgop_, this->adminid_2_id_); + + ACE_ASSERT (!CORBA::is_nil (consumer_admin_2_.in ())); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)create_consumeradmin %d %d\n"), + adminid_1_id_, adminid_2_id_)); + + CosNotifyFilter::FilterFactory_var ffact = + ec_->default_filter_factory (); + + // setup a filter at the consumer admin + CosNotifyFilter::Filter_var ca_filter_1 = + ffact->create_filter (TCL_GRAMMAR); + + ACE_ASSERT (!CORBA::is_nil (ca_filter_1.in ())); + + // setup a filter at the consumer admin + CosNotifyFilter::Filter_var ca_filter_2 = + ffact->create_filter (TCL_GRAMMAR); + + ACE_ASSERT (!CORBA::is_nil (ca_filter_2.in ())); + + /* struct ConstraintExp { + CosNotification::EventTypeSeq event_types; + string constraint_expr; + }; + */ + CosNotifyFilter::ConstraintExpSeq constraint_list (2); + constraint_list.length (2); + + constraint_list[0].event_types.length (1); + constraint_list[0].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME); + constraint_list[0].event_types[0].type_name = CORBA::string_dup(TYPE_NAME); + + constraint_list[0].constraint_expr = CORBA::string_dup (CA_FILTER); + constraint_list[1].event_types.length (1); + constraint_list[1].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME); + constraint_list[1].event_types[0].type_name = CORBA::string_dup(TYPE_NAME); + constraint_list[1].constraint_expr = CORBA::string_dup (CA_FILTER); + + ca_filter_1->add_constraints (constraint_list); + ca_filter_2->add_constraints (constraint_list); + + consumer_admin_1_->add_filter (ca_filter_1.in ()); + + consumer_admin_2_->add_filter (ca_filter_2.in ()); +} + +void +FilterClient::get_consumeradmin () +{ + CosNotifyChannelAdmin::AdminIDSeq_var ids + = ec_->get_all_consumeradmins(); + + ACE_ASSERT (ids->length () == 2); + + this->adminid_1_id_ = ids[0]; + this->adminid_2_id_ = ids[1]; + + consumer_admin_1_ = ec_->get_consumeradmin (this->adminid_1_id_); + consumer_admin_2_ = ec_->get_consumeradmin (this->adminid_2_id_); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)get_consumeradmin %d %d\n"), + adminid_1_id_, adminid_2_id_)); + + CosNotifyFilter::FilterAdmin_var admin + = CosNotifyFilter::FilterAdmin::_narrow (consumer_admin_1_.in ()); + verify_filter (admin, CA_FILTER, MOD_CA_FILTER); + admin = CosNotifyFilter::FilterAdmin::_narrow (consumer_admin_2_.in ()); + verify_filter (admin, CA_FILTER, MOD_CA_FILTER); +} + + +void +FilterClient::verify_filter (CosNotifyFilter::FilterAdmin_var& admin, + const char* constraint_expr, + const char* mod_constraint_expr) +{ + ACE_UNUSED_ARG (constraint_expr); + // only used to validate assert, which is + // compiled out for nondebug builds. + CosNotifyFilter::FilterIDSeq_var ids + = admin->get_all_filters (); + + ACE_ASSERT (ids->length () == 1); + + CosNotifyFilter::Filter_var filter + = admin->get_filter (ids[0]); + + ACE_ASSERT (! CORBA::is_nil (filter.in ())); + + CosNotifyFilter::ConstraintInfoSeq_var infos + = filter->get_all_constraints(); + + ACE_ASSERT (infos->length () == 2); + + u_int index = 0; + + for (index = 0; index < infos->length (); ++ index) + { + CosNotifyFilter::ConstraintID id = infos[index].constraint_id; + ACE_UNUSED_ARG (id); + // only used to validate assert, which is + // compiled out for nondebug builds. + ACE_ASSERT (id != 0); + ACE_ASSERT (ACE_OS::strcmp (infos[index].constraint_expression.constraint_expr.in (), constraint_expr) == 0); + + CosNotification::EventTypeSeq& events = infos[index].constraint_expression.event_types; + ACE_UNUSED_ARG (events); + // only used to validate assert, which is + // compiled out for nondebug builds. + ACE_ASSERT (events.length () == 1); + + ACE_ASSERT (ACE_OS::strcmp (events[0].domain_name.in (), DOMAIN_NAME) == 0); + ACE_ASSERT (ACE_OS::strcmp (events[0].type_name.in (), TYPE_NAME) == 0); + } + + if (modify_constraint_) + { + CosNotifyFilter::ConstraintIDSeq_var ids = new CosNotifyFilter::ConstraintIDSeq (2); + ids->length (2); + for (index = 0; index < infos->length (); ++ index) + { + ids[index] = infos[index].constraint_id; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t)modify constraint %d \n"), ids[index])); + + infos[index].constraint_expression.constraint_expr + = CORBA::string_dup (mod_constraint_expr); + } + + filter->modify_constraints (ids.in (), infos.in()); + } +} + + +void +FilterClient::create_consumers () +{ + // startup the first consumer. + ACE_NEW_THROW_EX (consumer_1, + Filter_StructuredPushConsumer (this, "consumer1"), + CORBA::NO_MEMORY ()); + + consumer_1->connect (consumer_admin_1_.in ()); + + // startup the second consumer. + ACE_NEW_THROW_EX (consumer_2, + Filter_StructuredPushConsumer (this, "consumer2"), + CORBA::NO_MEMORY ()); + + consumer_2->connect (consumer_admin_2_.in ()); +} + +void +FilterClient::create_suppliers () +{ + // startup the first supplier + ACE_NEW_THROW_EX (supplier_1, + Filter_StructuredPushSupplier ("supplier1"), + CORBA::NO_MEMORY ()); + + supplier_1->connect (supplier_admin_.in ()); + + // startup the second supplier + ACE_NEW_THROW_EX (supplier_2, + Filter_StructuredPushSupplier ("supplier2"), + CORBA::NO_MEMORY ()); + + supplier_2->connect (supplier_admin_.in ()); +} + +void +FilterClient::send_events () +{ + // operations: + CosNotification::StructuredEvent event; + + // EventHeader + + // FixedEventHeader + // EventType + // string + event.header.fixed_header.event_type.domain_name = CORBA::string_dup(DOMAIN_NAME); + // string + event.header.fixed_header.event_type.type_name = CORBA::string_dup(TYPE_NAME); + // string + event.header.fixed_header.event_name = CORBA::string_dup("myevent"); + + // OptionalHeaderFields + // PropertySeq + // sequence<Property>: string name, any value + event.header.variable_header.length (1); // put nothing here + + // FilterableEventBody + // PropertySeq + // sequence<Property>: string name, any value + event.filterable_data.length (3); + event.filterable_data[0].name = CORBA::string_dup("threshold"); + + event.filterable_data[1].name = CORBA::string_dup("temperature"); + event.filterable_data[1].value <<= (CORBA::Long)70; + + event.filterable_data[2].name = CORBA::string_dup("pressure"); + event.filterable_data[2].value <<= (CORBA::Long)80; + + event.filterable_data[0].value <<= (CORBA::Long)4; + + // any + event.remainder_of_body <<= (CORBA::Long)4; + + for (int i = 0; i < EVENTS_TO_SEND; i++) + { + event.filterable_data[0].value <<= (CORBA::Long)i; + + // any + event.remainder_of_body <<= (CORBA::Long)i; + + supplier_1->send_event (event); + + supplier_2->send_event (event); + } +} + + +Filter_StructuredPushConsumer::Filter_StructuredPushConsumer (FilterClient* filter, const char* my_name) + :filter_ (filter), + my_name_ (my_name) +{ +} + +Filter_StructuredPushConsumer::~Filter_StructuredPushConsumer (void) +{ +} + +void +Filter_StructuredPushConsumer::connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin) +{ + // Activate the consumer with the default_POA_ + CosNotifyComm::StructuredPushConsumer_var objref = + this->_this (); + + CosNotifyChannelAdmin::ProxySupplier_var proxysupplier = + consumer_admin->obtain_notification_push_supplier (CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_supplier_id_); + + ACE_ASSERT (!CORBA::is_nil (proxysupplier.in ())); + + // narrow + this->proxy_supplier_ = + CosNotifyChannelAdmin::StructuredProxyPushSupplier:: + _narrow (proxysupplier.in ()); + + ACE_ASSERT (!CORBA::is_nil (proxy_supplier_.in ())); + + proxy_supplier_->connect_structured_push_consumer (objref.in ()); +} + +void +Filter_StructuredPushConsumer::disconnect () +{ + this->proxy_supplier_-> + disconnect_structured_push_supplier(); +} + +void +Filter_StructuredPushConsumer::offer_change + (const CosNotification::EventTypeSeq & /*added*/, + const CosNotification::EventTypeSeq & /*removed*/) +{ + // No-Op. +} + +void +Filter_StructuredPushConsumer::push_structured_event + (const CosNotification::StructuredEvent & notification) +{ + CORBA::Long val; + + notification.remainder_of_body >>= val; + + // @@ Pradeep: for your tests try to make sure that you count the + // number of expected and sent events to verify that things work + // correctly in an automatic way... + + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%C received event, %d\n"), + my_name_.fast_rep (), val)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("event count %d\n"), g_result_count.value ())); + + if (++g_result_count == EVENTS_EXPECTED_TO_RECEIVE) + this->filter_->done (); // all events received, we're done. +} + +void +Filter_StructuredPushConsumer::disconnect_structured_push_consumer () +{ + // No-Op. +} + + +/*****************************************************************/ + +Filter_StructuredPushSupplier::Filter_StructuredPushSupplier (const char* my_name) + :my_name_ (my_name) +{ +} + +Filter_StructuredPushSupplier::~Filter_StructuredPushSupplier () +{ +} + +void +Filter_StructuredPushSupplier::connect (CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin) +{ + CosNotifyComm::StructuredPushSupplier_var objref = + this->_this (); + + CosNotifyChannelAdmin::ProxyConsumer_var proxyconsumer = + supplier_admin->obtain_notification_push_consumer (CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_consumer_id_); + + ACE_ASSERT (!CORBA::is_nil (proxyconsumer.in ())); + + // narrow + this->proxy_consumer_ = + CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (proxyconsumer.in ()); + + ACE_ASSERT (!CORBA::is_nil (proxy_consumer_.in ())); + + proxy_consumer_->connect_structured_push_supplier (objref.in ()); +} + +void +Filter_StructuredPushSupplier::disconnect () +{ + ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ())); + + this->proxy_consumer_->disconnect_structured_push_consumer(); +} + +void +Filter_StructuredPushSupplier::subscription_change + (const CosNotification::EventTypeSeq & /*added*/, + const CosNotification::EventTypeSeq & /*removed */) +{ + //No-Op. +} + +void +Filter_StructuredPushSupplier::send_event + (const CosNotification::StructuredEvent& event) +{ + ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ())); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%C is sending an event \n"), my_name_.fast_rep ())); + + proxy_consumer_->push_structured_event (event); +} + +void +Filter_StructuredPushSupplier::disconnect_structured_push_supplier () +{ + // No-Op. +} + + diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h new file mode 100644 index 00000000000..98c27a6d436 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h @@ -0,0 +1,270 @@ +/* -*- C++ -*- */ +// $Id$ +// ========================================================================== +// +// = FILENAME +// Filter.h +// +// = DESCRIPTION +// Class to demo structured event filtering. +// +// = AUTHOR +// Pradeep Gore <pradeep@cs.wustl.edu> +// +// ========================================================================== + +#ifndef NOTIFY_FILTER_CLIENT_H +#define NOTIFY_FILTER_CLIENT_H + +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h" +#include "orbsvcs/orbsvcs/CosNotifyCommC.h" +#include "orbsvcs/orbsvcs/CosNamingC.h" +#include "ace/SString.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class Filter_StructuredPushConsumer; +class Filter_StructuredPushSupplier; + +class FilterClient +{ + // = TITLE + // Filter Client + // = DESCRIPTION + // Client example that shows how to do Structured Event filtering + // in the Notification Service. + + public: + // = Initialization and Termination + FilterClient (void); + // Constructor + + ~FilterClient (); + // Destructor + + void init_supplier (int argc, ACE_TCHAR *argv []); + void init_consumer (int argc, ACE_TCHAR *argv []); + // Init the Client. + + void run_supplier (); + void run_consumer (); + // Run the demo. + + void done (void); + // Consumer calls done, We're done. + + protected: + + int parse_args (int argc, + ACE_TCHAR *argv[]); + + void init_ORB (int& argc, ACE_TCHAR **& argv); + // Initializes the ORB. + + void resolve_naming_service (); + // Try to get hold of a running naming service. + + void resolve_Notify_factory (); + // Try to resolve the Notify factory from the Naming service. + + void create_EC (); + void get_EC (); + // Create an EC. + + void create_supplieradmin(); + // Create the Supplier Admin. + void get_supplieradmin(); + + void create_consumeradmin (); + // Create the Consumer Admin. + void get_consumeradmin (); + + void create_consumers (); + // Create and initialize the consumers. + + void create_suppliers (); + // create and initialize the suppliers. + + void send_events (); + // send the events. + + void wait_ready (); + + void wait_consumer_complete (); + + void verify_filter (CosNotifyFilter::FilterAdmin_var& admin, + const char* constraint_expr, + const char* mod_constraint_expr); + + // = Data Members + PortableServer::POA_var root_poa_; + // Reference to the root poa. + + CORBA::ORB_var orb_; + // The ORB that we use. + + CosNaming::NamingContext_var naming_context_; + // Handle to the name service. + + CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_; + // Channel factory. + + CosNotifyChannelAdmin::EventChannel_var ec_; + // The one channel that we create using the factory. + + CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_; + // The group operator between admin-proxy's. + + CosNotification::QoSProperties initial_qos_; + // Initial qos specified to the factory when creating the EC. + + CosNotification::AdminProperties initial_admin_; + // Initial admin props specified to the factory when creating the EC. + + CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_1_; + CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_2_; + // The consumer admin used by consumers. + + CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_; + // The supplier admin used by suppliers. + + Filter_StructuredPushConsumer* consumer_1; + // Consumer #1 + + Filter_StructuredPushConsumer* consumer_2; + // Consumer #2 + + Filter_StructuredPushSupplier* supplier_1; + // Supplier #1 + + Filter_StructuredPushSupplier* supplier_2; + // Supplier #2 + + CosNotifyChannelAdmin::AdminID adminid_1_id_; + CosNotifyChannelAdmin::AdminID adminid_2_id_; + + CosNotifyChannelAdmin::ChannelID channel_id_; + + bool use_persistent_; + + bool modify_constraint_; + + // Set this flag to exit the run loop. + CORBA::Boolean done_; +}; + +/*****************************************************************/ +class Filter_StructuredPushConsumer : public POA_CosNotifyComm::StructuredPushConsumer +{ + // = TITLE + // Filter_StructuredPushConsumer + // + // = DESCRIPTION + // Consumer for the Filter example. + // + + public: + // = Initialization and Termination code + Filter_StructuredPushConsumer (FilterClient* filter, const char *my_name); + // Constructor. + + void connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin); + // Connect the Consumer to the EventChannel. + // Creates a new proxy supplier and connects to it. + + virtual void disconnect (); + // Disconnect from the supplier. + +protected: + // = Data members + + FilterClient* filter_; + // The callback for <done> + + ACE_CString my_name_; + // The name of this consumer. + + CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier_; + // The proxy that we are connected to. + + CosNotifyChannelAdmin::ProxyID proxy_supplier_id_; + // The proxy_supplier id. + + // = Methods + virtual ~Filter_StructuredPushConsumer (void); + // Destructor + + // = NotifyPublish method + virtual void offer_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ); + + // = StructuredPushSupplier methods + virtual void push_structured_event ( + const CosNotification::StructuredEvent & notification + ); + + virtual void disconnect_structured_push_consumer (); +}; + +/*****************************************************************/ + +class Filter_StructuredPushSupplier : public POA_CosNotifyComm::StructuredPushSupplier +{ + // = TITLE + // Filter_StructuredPushSupplier + // + // = DESCRIPTION + // Supplier for the filter example. + // + public: + // = Initialization and Termination code + Filter_StructuredPushSupplier (const char* my_name); + // Constructor. + + void connect (CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin); + // Connect the Supplier to the EventChannel. + // Creates a new proxy supplier and connects to it. + + void disconnect (); + // Disconnect from the supplier. + + virtual void send_event (const CosNotification::StructuredEvent& event); + // Send one event. + +protected: + // = Data members + ACE_CString my_name_; + // The name of this consumer. + + CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_; + // The proxy that we are connected to. + + CosNotifyChannelAdmin::ProxyID proxy_consumer_id_; + // This supplier's id. + + // = Protected Methods + virtual ~Filter_StructuredPushSupplier (); + // Destructor + + // = NotifySubscribe + virtual void subscription_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ); + + // = StructuredPushSupplier method + virtual void disconnect_structured_push_supplier (); +}; + +/***************************************************************************/ + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* NOTIFY_FILTER_CLIENT_H */ diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am new file mode 100644 index 00000000000..83d7ba78ff8 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am @@ -0,0 +1,95 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ../bin/mwc.pl -type automake -noreldefs TAO.mwc + +ACE_BUILDDIR = $(top_builddir)/.. +ACE_ROOT = $(top_srcdir)/.. +TAO_BUILDDIR = $(top_builddir) +TAO_ROOT = $(top_srcdir) + +noinst_PROGRAMS = + +## Makefile.consumer.am + +if BUILD_EXCEPTIONS + +noinst_PROGRAMS += consumer + +consumer_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) \ + -I$(TAO_ROOT)/orbsvcs \ + -I$(TAO_BUILDDIR)/orbsvcs \ + -DTAO_HAS_TYPED_EVENT_CHANNEL + +consumer_SOURCES = \ + Filter.cpp \ + consumer.cpp \ + Filter.h + +consumer_LDADD = \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif BUILD_EXCEPTIONS + +## Makefile.supplier.am + +if BUILD_EXCEPTIONS + +noinst_PROGRAMS += supplier + +supplier_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) \ + -I$(TAO_ROOT)/orbsvcs \ + -I$(TAO_BUILDDIR)/orbsvcs \ + -DTAO_HAS_TYPED_EVENT_CHANNEL + +supplier_SOURCES = \ + Filter.cpp \ + supplier.cpp \ + Filter.h + +supplier_LDADD = \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif BUILD_EXCEPTIONS + + +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = -I m4 +AUTOMAKE_OPTIONS = foreign + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/NS.conf b/TAO/orbsvcs/tests/Notify/Persistent_Filter/NS.conf new file mode 100644 index 00000000000..b5fc33c0af7 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/NS.conf @@ -0,0 +1,5 @@ +static TAO_CosNotify_Service "-AllocateTaskPerProxy -DispatchingThreads 1 -SourceThreads 1 -AllowReconnect -ValidateClient -ValidateClientDelay 1 -ValidateClientInterval 10 " + +dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v" + +#dynamic Logging_Strategy Service_Object* ACE:_make_ACE_Logging_Strategy() "-s NS -f OSTREAM -t 0 -m 1024 -w" diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc new file mode 100644 index 00000000000..64f8381180d --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc @@ -0,0 +1,19 @@ +// -*- MPC -*- +// $Id$ + + +project(supplier) : orbsvcsexe, notification, notification_skel, naming { + Source_Files { + supplier.cpp + Filter.cpp + } +} + + +project(consumer) : orbsvcsexe, notification, notification_skel, naming { + Source_Files { + consumer.cpp + Filter.cpp + } +} + diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/README b/TAO/orbsvcs/tests/Notify/Persistent_Filter/README new file mode 100644 index 00000000000..c3963500c29 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/README @@ -0,0 +1,10 @@ +This test is based on the Filter example. +It tests the persistent filter changes. The filter constraints +are saved to persistent data instead of filter IOR. + +The run_test.pl starts NotificationService, consumer and supplier. +After they complete, restart them again with using the persistent +data. The restarted consumer and supplier will verify the filters +and modify the constraints. The test finally should pass with no +errors. + diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp b/TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp new file mode 100644 index 00000000000..33f0e181f1d --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp @@ -0,0 +1,30 @@ +// -*- C++ -*- +// $Id$ + +#include "Filter.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + FilterClient client; + + try + { + client.init_consumer (argc, argv); //Init the Client + + client.run_consumer (); + } + catch (const CORBA::UserException& ue) + { + ue._tao_print_exception ( + "TLS_Client user error: "); + return 1; + } + catch (const CORBA::SystemException& se) + { + se._tao_print_exception ("Consumer system error: "); + return 1; + } + + return 0; +} diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl b/TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl new file mode 100755 index 00000000000..d22a0800507 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl @@ -0,0 +1,132 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; + + +$experiment_timeout = 60; +$startup_timeout = 60; + +$notify_ior = PerlACE::LocalFile ("notify.ior"); + +$naming_ior = PerlACE::LocalFile ("naming.ior"); + +$svc_conf = PerlACE::LocalFile ("NS.conf"); + +$persistent_prefix = "persistency.notif"; + +$status = 0; + +$Naming = new PerlACE::Process ("../../../Naming_Service/Naming_Service", + "-o $naming_ior"); + +$Notification = new PerlACE::Process ("../../../Notify_Service/Notify_Service"); +#-ORBDebugLevel 10 -ORBVerboseLogging 1 +$Notify_Args = "-ORBSvcConf $svc_conf -ORBInitRef NameService=file://$naming_ior -IORoutput $notify_ior "; + +$Supplier = new PerlACE::Process ("supplier"); + +$Supplier_Args = "-ORBInitRef NameService=file://$naming_ior"; + +$Consumer = new PerlACE::Process ("consumer"); + +$Consumer_Args = "-ORBInitRef NameService=file://$naming_ior"; + +unlink $naming_ior; +$Naming->Spawn (); + +if (PerlACE::waitforfile_timed ($naming_ior, $startup_timeout) == -1) { + print STDERR "ERROR: waiting for the naming service to start\n"; + $Naming->Kill (); + exit 1; +} + +sub run_test +{ + my $client_args = shift; + + unlink $notify_ior; + $Notification->Arguments ($Notify_Args); + $args = $Notification->Arguments (); + print STDERR "Running Notification with arguments: $args\n"; + $Notification->Spawn (); + + if (PerlACE::waitforfile_timed ($notify_ior, $startup_timeout) == -1) { + print STDERR "ERROR: waiting for the notify service to start\n"; + $Notification->Kill (); + $Naming->Kill (); + exit 1; + } + + sleep (5); + + $Supplier->Arguments ($client_args . $Supplier_Args); + $Consumer->Arguments ($client_args . $Consumer_Args); + $args = $Supplier->Arguments (); + print STDERR "Running Supplier with arguments: $args\n"; + $args = $Consumer->Arguments (); + print STDERR "Running Consumer with arguments: $args\n"; + + $status = $Supplier->Spawn (); + + if ($status != 0) + { + print STDERR "ERROR: Supplier Spawn returned $status\n"; + $Notification->Kill (); + $Naming->Kill (); + exit 1; + } + + $status = $Consumer->Spawn (); + + if ($status != 0) + { + print STDERR "ERROR: Consumer returned $status\n"; + $Supplier->Kill (); + $Notification->Kill (); + $Naming->Kill (); + exit 1; + } + + $status = $Consumer->WaitKill ($experiment_timeout); + + if ($status != 0) + { + print STDERR "ERROR: Consumer WaitKill returned $status\n"; + $Consumer->Kill (); + $Supplier->Kill (); + $Notification->Kill (); + $Naming->Kill (); + exit 1; + } + + $status = $Supplier->WaitKill ($experiment_timeout); + + if ($status != 0) + { + print STDERR "ERROR: Supplier WaitKill returned $status\n"; + $Supplier->Kill (); + $Notification->Kill (); + $Naming->Kill (); + exit 1; + } + + $Notification->Kill (); + unlink $notify_ior; +} + +unlink <$persistent_prefix.*>; + +run_test (); +run_test ("-m -p "); + + +$Naming->Kill (); +unlink $naming_ior; + +exit $status; diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp b/TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp new file mode 100644 index 00000000000..c2aca21a2c1 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp @@ -0,0 +1,29 @@ +// -*- C++ -*- +// $Id$ + +#include "Filter.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + FilterClient client; + + try + { + client.init_supplier (argc, argv); //Init the Client + + client.run_supplier (); + } + catch (const CORBA::UserException& ue) + { + ue._tao_print_exception ("TLS_Client user error: "); + return 1; + } + catch (const CORBA::SystemException& se) + { + se._tao_print_exception ("Supplier system error: "); + return 1; + } + + return 0; +} diff --git a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp index e4ba6c4b92e..f5a5401b6d2 100644 --- a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp +++ b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp @@ -21,8 +21,6 @@ TAO_Notify_Tests_RT_Test_FilterFactory::create (PortableServer::POA_ptr filter_p { this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); // save the filter poa. - PortableServer::ServantBase_var servant_var (this); - PortableServer::ObjectId_var id = filter_poa->activate_object (this); CORBA::Object_var object = filter_poa->id_to_reference (id.in ()); @@ -32,6 +30,24 @@ TAO_Notify_Tests_RT_Test_FilterFactory::create (PortableServer::POA_ptr filter_p return filter._retn(); } +void +TAO_Notify_Tests_RT_Test_FilterFactory::destroy (void) +{ + if (CORBA::is_nil(this->filter_poa_.in ())) + return; + PortableServer::ServantBase_var guard(this); + try + { + PortableServer::ObjectId_var id = + this->filter_poa_->servant_to_id (this); + this->filter_poa_->deactivate_object (id.in()); + } + catch (CORBA::Exception&) + { + } + +} + CosNotifyFilter::Filter_ptr TAO_Notify_Tests_RT_Test_FilterFactory::create_filter (const char *constraint_grammar) { @@ -70,4 +86,29 @@ TAO_Notify_Tests_RT_Test_FilterFactory::create_mapping_filter (const char * /*co throw CORBA::NO_IMPLEMENT (); } +TAO_Notify_Object::ID +TAO_Notify_Tests_RT_Test_FilterFactory::get_filter_id (CosNotifyFilter::Filter_ptr /*filter*/) +{ + throw CORBA::NO_IMPLEMENT (); +} + +CosNotifyFilter::Filter_ptr +TAO_Notify_Tests_RT_Test_FilterFactory::get_filter (const TAO_Notify_Object::ID& /*id*/) +{ + throw CORBA::NO_IMPLEMENT (); +} + +void +TAO_Notify_Tests_RT_Test_FilterFactory::release (void) +{ + delete this; + //@@ inform factory +} + +void +TAO_Notify_Tests_RT_Test_FilterFactory::save_persistent (TAO_Notify::Topology_Saver& /*saver*/) +{ + throw CORBA::NO_IMPLEMENT (); +} + ACE_FACTORY_DEFINE (TAO_RT_Test_Filter, TAO_Notify_Tests_RT_Test_FilterFactory) diff --git a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h index 734b409a9e1..34d0240c104 100644 --- a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h +++ b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h @@ -47,6 +47,7 @@ public: ///= TAO_Notify_Tests_FilterFactory methods. virtual CosNotifyFilter::FilterFactory_ptr create (PortableServer::POA_ptr filter_poa); + virtual void destroy (void); ///= CosNotifyFilter::FilterFactory methods @@ -55,7 +56,14 @@ public: virtual CosNotifyFilter::MappingFilter_ptr create_mapping_filter (const char * constraint_grammar, const CORBA::Any & default_value); + virtual TAO_Notify_Object::ID get_filter_id (CosNotifyFilter::Filter_ptr filter); + virtual CosNotifyFilter::Filter_ptr get_filter (const TAO_Notify_Object::ID& id); + virtual void save_persistent (TAO_Notify::Topology_Saver& saver); + protected: + /// Release this object. + virtual void release (void); + /// The POA in which to activate the Filters. PortableServer::POA_var filter_poa_; }; diff --git a/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc b/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc index 75e32c6a6fa..5ea99aa09d5 100644 --- a/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc +++ b/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(TAO_RT_NotifyTests_Filter): orbsvcslib, notification_skel, rtcorba, etcl, dynamicany, portableserver, iortable { +project(TAO_RT_NotifyTests_Filter): orbsvcslib, notification_skel, notify_serv, rtcorba, etcl, dynamicany, portableserver, iortable { sharedname = TAO_RT_NotifyTests_Filter dynamicflags = TAO_RT_Test_Filter_BUILD_DLL IDL_Files { diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am b/TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am new file mode 100644 index 00000000000..93b3f902784 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am @@ -0,0 +1,51 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## /tao_builds/phil/wustl/ACE+TAO+CIAO/ACE_wrappers/build/native/bin/mwc.pl -type automake + +ACE_BUILDDIR = $(top_builddir)/.. +ACE_ROOT = $(top_srcdir)/.. +TAO_BUILDDIR = $(top_builddir) +TAO_ROOT = $(top_srcdir) + + +## Makefile.Validate_Client_Proxy_Dummy.am + +if BUILD_EXCEPTIONS + +noinst_PROGRAMS = proxy_dummy + +proxy_dummy_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) + +proxy_dummy_SOURCES = \ + proxy_dummy.cpp + +proxy_dummy_LDADD = \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif BUILD_EXCEPTIONS + + +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = -I m4 +AUTOMAKE_OPTIONS = foreign + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/README b/TAO/orbsvcs/tests/Notify/Validate_Client/README new file mode 100644 index 00000000000..4bf085ce6e9 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/README @@ -0,0 +1,13 @@ +This test is to verify the Notification Service client connection +validation feature. + +The test synthesizes a persistency file that points to a dummy +service. The Notify service is then run so that it uses the +persistency file to restore a topology and eventually reap the +proxies because the "ping" yields an OBJECT_NOT_EXIST exception. + +The result should be that after a few seconds, a new persistence +file is created that contains no proxy references. + +Run ./run_test.pl and it should output "test passed". + diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc b/TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc new file mode 100644 index 00000000000..1ebcf636372 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc @@ -0,0 +1,11 @@ +// -*- MPC -*- +// $Id$ + +project(*proxy_dummy): taoserver { + exename=proxy_dummy + Source_Files { + proxy_dummy.cpp + } +} + + diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/notify.conf b/TAO/orbsvcs/tests/Notify/Validate_Client/notify.conf new file mode 100644 index 00000000000..2d7e425ac16 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/notify.conf @@ -0,0 +1,4 @@ +static TAO_CosNotify_Service "-AllocateTaskPerProxy -DispatchingThreads 1 -SourceThreads 1 -AllowReconnect -ValidateClient -ValidateClientDelay 1 -ValidateClientInterval 2" + +dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v" + diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp b/TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp new file mode 100644 index 00000000000..79f179f8bfb --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp @@ -0,0 +1,202 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" +#include "tao/ORB.h" +#include "tao/PortableServer/POAC.h" +#include "tao/PortableServer/POAManagerC.h" + +ACE_RCSID (Validate_Client, + gen_data, + "$Id$") + +const ACE_TCHAR *output_filename = ACE_TEXT ("persistence.notify.xml"); + +// must be char +const char *format = + "<?xml version=\"1.0\"?>\n" + "<notification_service version=\"1.0\" timestamp=\"197568243541\">\n" + " <channel_factory>\n" + " <channel TopologyID=\"2\" MaxQueueLength=\"0\" MaxConsumers=\"0\" MaxSuppliers=\"0\" RejectNewEvents=\"false\">\n" + " <filter_factory>\n" + " <filter FilterId=\"1\" Grammar=\"TCL\">\n" + " <constraint ConstraintId=\"3\" Expression=\"threshold > 10\">\n" + " <EventType Domain=\"*\" Type=\"*\">\n" + " </EventType>\n" + " </constraint>\n" + " <constraint ConstraintId=\"4\" Expression=\"threshold > 10\">\n" + " <EventType Domain=\"*\" Type=\"*\">\n" + " </EventType>\n" + " </constraint>\n" + " </filter>\n" + " <filter FilterId=\"2\" Grammar=\"TCL\">\n" + " <constraint ConstraintId=\"3\" Expression=\"threshold < 15\">\n" + " <EventType Domain=\"*\" Type=\"*\">\n" + " </EventType>\n" + " </constraint>\n" + " <constraint ConstraintId=\"4\" Expression=\"threshold < 15\">\n" + " <EventType Domain=\"*\" Type=\"*\">\n" + " </EventType>\n" + " </constraint>\n" + " </filter>\n" + " <filter FilterId=\"3\" Grammar=\"TCL\">\n" + " <constraint ConstraintId=\"3\" Expression=\"threshold < 15\">\n" + " <EventType Domain=\"*\" Type=\"*\">\n" + " </EventType>\n" + " </constraint>\n" + " <constraint ConstraintId=\"4\" Expression=\"threshold < 15\">\n" + " <EventType Domain=\"*\" Type=\"*\">\n" + " </EventType>\n" + " </constraint>\n" + " </filter>\n" + " </filter_factory>\n" + " <consumer_admin TopologyID=\"6\" InterFilterGroupOperator=\"0\">\n" + " <filter_admin>\n" + " <filter TopologyID=\"1\" MapId=\"2\">\n" + " </filter>\n" + " </filter_admin>\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " <structured_proxy_push_supplier TopologyID=\"11\" PeerIOR=\"%s\">\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " </structured_proxy_push_supplier>\n" + " </consumer_admin>\n" + " <consumer_admin TopologyID=\"7\" InterFilterGroupOperator=\"0\">\n" + " <filter_admin>\n" + " <filter TopologyID=\"1\" MapId=\"3\">\n" + " </filter>\n" + " </filter_admin>\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " <structured_proxy_push_supplier TopologyID=\"12\" PeerIOR=\"%s\">\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " </structured_proxy_push_supplier>\n" + " </consumer_admin>\n" + " <supplier_admin TopologyID=\"3\" InterFilterGroupOperator=\"0\">\n" + " <filter_admin>\n" + " <filter TopologyID=\"1\" MapId=\"1\">\n" + " </filter>\n" + " </filter_admin>\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " <structured_proxy_push_consumer TopologyID=\"9\" PeerIOR=\"%s\">\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " </structured_proxy_push_consumer>\n" + " <structured_proxy_push_consumer TopologyID=\"10\" PeerIOR=\"%s\">\n" + " <subscriptions>\n" + " <subscription Domain=\"*\" Type=\"%%ALL\">\n" + " </subscription>\n" + " </subscriptions>\n" + " </structured_proxy_push_consumer>\n" + " </supplier_admin>\n" + " </channel>\n" + " <reconnect_registry>\n" + " </reconnect_registry>\n" + " </channel_factory>\n" + "</notification_service>\n" + ; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output_filename = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %s ") + ACE_TEXT ("-o <output file> ") + ACE_TEXT ("\n"), + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::String_var repo_id = + "IDL:omg.org/CosNotifyComm/StructuredPushConsumer:1.0"; + + CORBA::Object_var object = + root_poa->create_reference (repo_id.in()); + + CORBA::String_var ior = orb->object_to_string (object.in ()); + + FILE *output_file= ACE_OS::fopen (output_filename, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Cannot open output file for writing IOR: %C\n"), + output_file), + 1); + const char * dummy_consumer_proxy = ior.in(); + + ACE_OS::fprintf (output_file, format, + dummy_consumer_proxy, dummy_consumer_proxy, + dummy_consumer_proxy, dummy_consumer_proxy); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + orb->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl b/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl new file mode 100755 index 00000000000..14e3e0632ac --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl @@ -0,0 +1,80 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; +use File::Copy; + +PerlACE::check_privilege_group(); + +$notifyior = PerlACE::LocalFile ("notify.ior"); +$notify_conf = PerlACE::LocalFile ("notify$PerlACE::svcconf_ext"); + +$persistent_file_prefix = "persistency.notif"; +$persistent_file = PerlACE::LocalFile ("persistency.notif.xml"); + +$status = 0; + +$port = PerlACE::uniqueid () + 10001; +$TS = new PerlACE::Process ("../../../Notify_Service/Notify_Service", + "-NoNameSvc " . + "-IORoutput $notifyior -ORBSvcConf " . + "$notify_conf"); + +unlink $notifyior; +unlink <$persistent_file_prefix.*>; + +$DUMMY = new PerlACE::Process ("proxy_dummy", "-o $persistent_file"); +$DUMMY->Spawn(); +if (PerlACE::waitforfile_timed ($persistent_file, $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: waiting for the proxy_dummy to start\n"; + $DUMMY->Kill (); + exit 1; +} + + +$TS->Spawn (); + +if (PerlACE::waitforfile_timed ($notifyior, $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: waiting for the notify service to start\n"; + $TS->Kill (); + $DUMMY->Kill (); + exit 1; +} + +sleep (10); + +$found = 0 ; +open (I_FILE, "$persistent_file") ; +while( <I_FILE> ) +{ + chomp ; + if( $_ =~ /proxy/ ) + { + $found = 1 ; + last ; + } +} +if( $found == 1 ) +{ + print STDERR "ERROR: validate consumer/supplier test failed.\n" ; + $status = 1 ; +} +else +{ + print STDOUT "validate consumer/supplier test succeeded.\n"; +} + +$TS->Kill (); +$DUMMY->Kill (); + +unlink <$persistent_file_prefix.*>; +unlink $notifyior; + + +exit $status; + diff --git a/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp b/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp index ed2b89e645e..2615b696aa4 100644 --- a/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp +++ b/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp @@ -71,14 +71,14 @@ init_and_setup (int& argc, TAO::SL2::AccessDecision_var& sl2ad) { orb = CORBA::ORB_init (argc, argv); - rootpoa = rir<PortableServer::POA> (orb, "RootPOA"); + rootpoa = rir<PortableServer::POA> (orb.in (), "RootPOA"); poamgr = rootpoa->the_POAManager(); sl3current = - rir<SecurityLevel3::SecurityCurrent>(orb, "SecurityLevel3:SecurityCurrent"); + rir<SecurityLevel3::SecurityCurrent>(orb.in (), "SecurityLevel3:SecurityCurrent"); SecurityLevel2::SecurityManager_var sl2sm = - rir<SecurityLevel2::SecurityManager> (orb, + rir<SecurityLevel2::SecurityManager> (orb.in (), "SecurityLevel2:SecurityManager"); SecurityLevel2::AccessDecision_var ad = sl2sm->access_decision (); @@ -172,9 +172,9 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "non-secure invocations\n")); // 5. publish references to #1 and #2 to distinct files - publish_ior (orb, server1_obj, + publish_ior (orb.in (), server1_obj.in (), TAO_Mixed_Security_Test::restricted_ior_file); - publish_ior (orb, server2_obj, + publish_ior (orb.in (), server2_obj.in (), TAO_Mixed_Security_Test::permitted_ior_file); ACE_DEBUG ((LM_DEBUG, "mixed_security/server: " "published IORs for objects\n")); diff --git a/TAO/rules.tao.GNU b/TAO/rules.tao.GNU index 759164dd203..0f8d42d7800 100644 --- a/TAO/rules.tao.GNU +++ b/TAO/rules.tao.GNU @@ -25,18 +25,6 @@ ifeq ($(exceptions),0) echo "ERROR: Emulated exceptions are not safe to use anymore, see the NEWS file" endif # exceptions -ifdef COMSPEC - #### Assume we're on a WIN32 host. - ifndef TAO_IDL_PREPROCESSOR - #### Assume we have Bourne shell and sed. Otherwise, the user - #### should find out here that the TAO_IDL_PREPROCESSOR environment - #### variable must be set explicitly! - ifeq ($(mingw32),1) - TAO_IDL_PREPROCESSOR := $(shell type $(CXX) | sed 's/.* is //') - endif # mingw32 - endif # ! TAO_IDL_PREPROCESSOR -endif # COMSPEC - #### #### Macro customization. #### diff --git a/TAO/tao/Adapter_Registry.h b/TAO/tao/Adapter_Registry.h index e253c38cd01..a6d6affba88 100644 --- a/TAO/tao/Adapter_Registry.h +++ b/TAO/tao/Adapter_Registry.h @@ -104,6 +104,10 @@ private: size_t adapters_count_; TAO_Adapter **adapters_; //@} + +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Adapter_Registry &)) + ACE_UNIMPLEMENTED_FUNC (TAO_Adapter_Registry (const TAO_Adapter_Registry &)) }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/AnyTypeCode.mpc b/TAO/tao/AnyTypeCode.mpc index cd75bae9730..d311bb23a37 100644 --- a/TAO/tao/AnyTypeCode.mpc +++ b/TAO/tao/AnyTypeCode.mpc @@ -1,14 +1,32 @@ //$Id$ -project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, tao_versioning_idl_defaults, nolink_codecfactory, gen_ostream { - sharedname = TAO_AnyTypeCode - dynamicflags = TAO_ANYTYPECODE_BUILD_DLL +project(*idl) : tao_versioning_idl_defaults, gen_ostream { + custom_only = 1 idlflags += -Gp -Gd -Sci -SS -GA \ -Wb,export_macro=TAO_AnyTypeCode_Export \ -Wb,export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h \ -o AnyTypeCode idlflags -= -Sa -St + IDL_Files { + idlflags += -Sorb + AnyTypeCode/AnySeq.pidl + AnyTypeCode/Dynamic_Parameter.pidl + AnyTypeCode/ValueModifier.pidl + AnyTypeCode/Visibility.pidl + AnyTypeCode/Dynamic.pidl + } + + IDL_Files { + AnyTypeCode/Bounds.pidl + } +} + +project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, taoidldefaults, nolink_codecfactory, gen_ostream { + after += *idl + sharedname = TAO_AnyTypeCode + dynamicflags = TAO_ANYTYPECODE_BUILD_DLL + Source_Files(TAO_ANYTYPECODE_COMPONENTS) { AnyTypeCode/Alias_TypeCode_Static.cpp AnyTypeCode/Any.cpp @@ -150,19 +168,10 @@ project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, tao_versi } PIDL_Files { + AnyTypeCode } IDL_Files { - idlflags += -Sorb - AnyTypeCode/AnySeq.pidl - AnyTypeCode/Dynamic_Parameter.pidl - AnyTypeCode/ValueModifier.pidl - AnyTypeCode/Visibility.pidl - AnyTypeCode/Dynamic.pidl - } - - IDL_Files { - AnyTypeCode/Bounds.pidl } Pkgconfig_Files { diff --git a/TAO/tao/Asynch_Queued_Message.h b/TAO/tao/Asynch_Queued_Message.h index 4834cc2a7b4..62f29a5eb59 100644 --- a/TAO/tao/Asynch_Queued_Message.h +++ b/TAO/tao/Asynch_Queued_Message.h @@ -102,6 +102,11 @@ protected: const ACE_Time_Value &abs_timeout, ACE_Allocator *alloc, bool is_heap_allocated); + +private: + void operator= (const TAO_Asynch_Queued_Message &); + TAO_Asynch_Queued_Message (const TAO_Asynch_Queued_Message &); + private: /// The number of bytes in the buffer size_t const size_; diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp b/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp index f2d00f91526..1ed5613102e 100644 --- a/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp +++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp @@ -19,9 +19,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Constructor. TAO_Asynch_Reply_Dispatcher_Base::TAO_Asynch_Reply_Dispatcher_Base ( TAO_ORB_Core *orb_core, - ACE_Allocator *allocator - ) - : db_ (sizeof buf_, + ACE_Allocator *allocator) + : TAO_Reply_Dispatcher (allocator) + , db_ (sizeof buf_, ACE_Message_Block::MB_DATA, this->buf_, orb_core->input_cdr_buffer_allocator (), @@ -36,9 +36,7 @@ TAO_Asynch_Reply_Dispatcher_Base::TAO_Asynch_Reply_Dispatcher_Base ( orb_core) , transport_ (0) , lock_ (0) - , refcount_ (1) , is_reply_dispatched_ (false) - , allocator_ (allocator) { // @@ NOTE: Need a seperate option for this.. this->lock_ = @@ -67,42 +65,6 @@ TAO_Asynch_Reply_Dispatcher_Base::transport (TAO_Transport *t) this->transport_->add_reference (); } -void -TAO_Asynch_Reply_Dispatcher_Base::incr_refcount (void) -{ - ACE_GUARD (ACE_Lock, - mutex, - *this->lock_); - ++this->refcount_; -} - -void -TAO_Asynch_Reply_Dispatcher_Base::decr_refcount (void) -{ - { - ACE_GUARD (ACE_Lock, - mutex, - *this->lock_); - --this->refcount_; - - if (this->refcount_ > 0) - return; - } - - if (this->allocator_) - { - ACE_DES_FREE (this, - this->allocator_->free, - TAO_Asynch_Reply_Dispatcher_Base); - } - else - { - delete this; - } - - return; -} - bool TAO_Asynch_Reply_Dispatcher_Base::try_dispatch_reply (void) { diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.h b/TAO/tao/Asynch_Reply_Dispatcher_Base.h index c6a8d635d6e..5366382b5f5 100644 --- a/TAO/tao/Asynch_Reply_Dispatcher_Base.h +++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.h @@ -56,11 +56,6 @@ public: /// Install the timeout handler virtual long schedule_timer (CORBA::ULong , const ACE_Time_Value &) = 0; - /// @name Mutators for refcount - //@{ - void incr_refcount (void); - void decr_refcount (void); - //@} /// A helper method that can be used by the subclasses /** @@ -84,6 +79,10 @@ protected: /// Destructor. virtual ~TAO_Asynch_Reply_Dispatcher_Base (void); +private: + void operator= (const TAO_Asynch_Reply_Dispatcher_Base &); + TAO_Asynch_Reply_Dispatcher_Base (const TAO_Asynch_Reply_Dispatcher_Base &); + protected: /// The service context list. /** @@ -109,18 +108,11 @@ protected: TAO_Transport *transport_; private: - /// Lock to protect refcount and @c is_reply_dispatched_ flag. + /// Lock to protect @c is_reply_dispatched_ flag. ACE_Lock *lock_; - /// Refcount paraphernalia for this class - CORBA::ULong refcount_; - /// Has the reply been dispatched? bool is_reply_dispatched_; - - /// Allocator that was used to allocate this reply dispatcher. In case of - /// zero we come from the heap. - ACE_Allocator *allocator_; }; namespace TAO diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.inl b/TAO/tao/Asynch_Reply_Dispatcher_Base.inl index 77f9bbd831d..6ce1e3f556f 100644 --- a/TAO/tao/Asynch_Reply_Dispatcher_Base.inl +++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.inl @@ -10,7 +10,7 @@ namespace TAO ARDB_Refcount_Functor::operator () ( TAO_Asynch_Reply_Dispatcher_Base *ardb) throw () { - (void) ardb->decr_refcount (); + (void) ardb->intrusive_remove_ref (ardb); } } diff --git a/TAO/tao/BiDir_GIOP.mpc b/TAO/tao/BiDir_GIOP.mpc index bad9d250dd8..b1716e27a59 100644 --- a/TAO/tao/BiDir_GIOP.mpc +++ b/TAO/tao/BiDir_GIOP.mpc @@ -1,5 +1,19 @@ //$Id$ -project(BiDir_GIOP) : taolib, tao_output, install, pi, tao_versioning_idl_defaults { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb -Sa -St \ + -Wb,export_macro=TAO_BiDirGIOP_Export \ + -Wb,export_include=tao/BiDir_GIOP/bidirgiop_export.h \ + -Wb,include_guard=TAO_BIDIRGIOP_SAFE_INCLUDE \ + -Wb,safe_include=tao/BiDir_GIOP/BiDirGIOP.h \ + -o BiDir_GIOP + BiDir_GIOP/BiDirPolicy.pidl + } +} + +project(BiDir_GIOP) : taolib, tao_output, install, pi, taoidldefaults { + after += *idl sharedname = TAO_BiDirGIOP dynamicflags = TAO_BIDIRGIOP_BUILD_DLL @@ -7,6 +21,10 @@ project(BiDir_GIOP) : taolib, tao_output, install, pi, tao_versioning_idl_defaul BiDir_GIOP } + Source_Files { + BiDir_GIOP/BiDirPolicyC.cpp + } + Header_Files { BiDir_GIOP } @@ -28,13 +46,6 @@ project(BiDir_GIOP) : taolib, tao_output, install, pi, tao_versioning_idl_defaul } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb -Sa -St \ - -Wb,export_macro=TAO_BiDirGIOP_Export \ - -Wb,export_include=tao/BiDir_GIOP/bidirgiop_export.h \ - -Wb,include_guard=TAO_BIDIRGIOP_SAFE_INCLUDE \ - -Wb,safe_include=tao/BiDir_GIOP/BiDirGIOP.h \ - -o BiDir_GIOP - BiDir_GIOP/BiDirPolicy.pidl } Pkgconfig_Files { diff --git a/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp index 3a008c59d5f..447b62f147e 100644 --- a/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp +++ b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp @@ -9,6 +9,10 @@ ACE_RCSID (BiDir_GIOP, #include "tao/CDR.h" #include "tao/TAO_Server_Request.h" #include "tao/Transport.h" +#include "tao/ORB_Core.h" +#include "tao/GIOP_Message_Base.h" +#include "tao/operation_details.h" +#include "tao/Transport_Mux_Strategy.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -23,4 +27,32 @@ TAO_BiDIR_Service_Context_Handler::process_service_context ( return transport.tear_listen_point_list (cdr); } +int +TAO_BiDIR_Service_Context_Handler::generate_service_context ( + TAO_Stub *, + TAO_Transport& transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &, + TAO_OutputCDR &msg) +{ + if (transport.orb_core ()->bidir_giop_policy () && + transport.messaging_object ()->is_ready_for_bidirectional (msg) && + transport.bidirectional_flag () < 0) + { + transport.set_bidir_context_info (opdetails); + + // Set the flag to 1 (i.e., originating side) + transport.bidirectional_flag (1); + + // At the moment we enable BiDIR giop we have to get a new + // request id to make sure that we follow the even/odd rule + // for request id's. We only need to do this when enabled + // it, after that the Transport Mux Strategy will make sure + // that the rule is followed + opdetails.request_id (transport.tms ()->request_id ()); + } + + return 0; +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h index fe81d85889e..dd6999505fd 100644 --- a/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h +++ b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h @@ -23,11 +23,20 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Stub; + class TAO_BiDIR_Service_Context_Handler : public TAO_Service_Context_Handler { +public: virtual int process_service_context (TAO_Transport& transport, const IOP::ServiceContext& context); + virtual int generate_service_context ( + TAO_Stub* stub, + TAO_Transport &transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Bounded_Array_Sequence_T.h b/TAO/tao/Bounded_Array_Sequence_T.h index d5ebeddca26..1702cd41dfe 100644 --- a/TAO/tao/Bounded_Array_Sequence_T.h +++ b/TAO/tao/Bounded_Array_Sequence_T.h @@ -79,6 +79,9 @@ public: static value_type * allocbuf(CORBA::ULong maximum) { return implementation_type::allocbuf(maximum); } + static value_type * allocbuf() { + return implementation_type::allocbuf(MAX); + } static void freebuf(value_type * buffer) { implementation_type::freebuf(buffer); } diff --git a/TAO/tao/Bounded_Basic_String_Sequence_T.h b/TAO/tao/Bounded_Basic_String_Sequence_T.h index c056bc2c60c..14ca643f6e3 100644 --- a/TAO/tao/Bounded_Basic_String_Sequence_T.h +++ b/TAO/tao/Bounded_Basic_String_Sequence_T.h @@ -14,6 +14,7 @@ #include "tao/Generic_Sequence_T.h" #include "tao/String_Sequence_Element_T.h" #include "tao/String_Const_Sequence_Element_T.h" +#include "tao/MM_Sequence_Iterator_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -105,6 +106,77 @@ public: implementation_type::freebuf(buffer); } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO unbounded basic + /// string sequences. + /// + + // = Traits and factory methods that create iterators. + typedef MM_Sequence_Iterator<bounded_basic_string_sequence<charT, MAX> > iterator; + typedef Const_MM_Sequence_Iterator<bounded_basic_string_sequence<charT, MAX> > const_iterator; + typedef MM_Sequence_Reverse_Iterator<bounded_basic_string_sequence<charT, MAX> > reverse_iterator; + typedef Const_MM_Sequence_Reverse_Iterator<bounded_basic_string_sequence<charT, MAX> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + inline iterator begin (void) + { + return iterator (&this->impl_); + } + + // Get a const iterator that points to the beginning of the sequence. + inline const_iterator begin (void) const + { + return const_iterator (&this->impl_); + } + + // Get an iterator that points to the end of the sequence. + inline iterator end (void) + { + return iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a const iterator that points to the end of the sequence. + inline const_iterator end (void) const + { + return const_iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a reverse iterator that points to the end of the sequence. + inline reverse_iterator rbegin (void) + { + return reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + inline const_reverse_iterator rbegin (void) const + { + return const_reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + inline reverse_iterator rend (void) + { + return reverse_iterator (&this->impl_, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + inline const_reverse_iterator rend (void) const + { + return const_reverse_iterator (&this->impl_, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; }; diff --git a/TAO/tao/Bounded_Object_Reference_Sequence_T.h b/TAO/tao/Bounded_Object_Reference_Sequence_T.h index 5d367a816e2..1a7860d0efa 100644 --- a/TAO/tao/Bounded_Object_Reference_Sequence_T.h +++ b/TAO/tao/Bounded_Object_Reference_Sequence_T.h @@ -14,6 +14,7 @@ #include "Generic_Sequence_T.h" #include "Object_Reference_Sequence_Element_T.h" #include "Object_Reference_Const_Sequence_Element_T.h" +#include "tao/MM_Sequence_Iterator_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -100,12 +101,87 @@ public: { return implementation_type::allocbuf(maximum); } + static value_type * allocbuf() + { + return implementation_type::allocbuf(MAX); + } static void freebuf(value_type * buffer) { implementation_type::freebuf(buffer); } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO bounded object + /// reference sequences. + /// + + // = Traits and factory methods that create iterators. + typedef MM_Sequence_Iterator<bounded_object_reference_sequence<object_t, object_t_var, MAX> > iterator; + typedef Const_MM_Sequence_Iterator<bounded_object_reference_sequence<object_t, object_t_var, MAX> > const_iterator; + typedef MM_Sequence_Reverse_Iterator<bounded_object_reference_sequence<object_t, object_t_var, MAX> > reverse_iterator; + typedef Const_MM_Sequence_Reverse_Iterator<bounded_object_reference_sequence<object_t, object_t_var, MAX> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + iterator begin (void) + { + return iterator (&this->impl_); + } + + // Get a const iterator that points to the beginning of the sequence. + const_iterator begin (void) const + { + return const_iterator (&this->impl_); + } + + // Get an iterator that points to the end of the sequence. + iterator end (void) + { + return iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a const iterator that points to the end of the sequence. + const_iterator end (void) const + { + return const_iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a reverse iterator that points to the end of the sequence. + reverse_iterator rbegin (void) + { + return reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + const_reverse_iterator rbegin (void) const + { + return const_reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + reverse_iterator rend (void) + { + return reverse_iterator (&this->impl_, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + const_reverse_iterator rend (void) const + { + return const_reverse_iterator (&this->impl_, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; }; diff --git a/TAO/tao/Bzip2Compressor.mpc b/TAO/tao/Bzip2Compressor.mpc index 3c71f406f92..177c9ef2658 100644 --- a/TAO/tao/Bzip2Compressor.mpc +++ b/TAO/tao/Bzip2Compressor.mpc @@ -1,5 +1,5 @@ //$Id$ -project(Bzip2Compressor) : taolib, tao_output, install, compression, tao_versioning_idl_defaults, ace_bzip2 { +project(Bzip2Compressor) : taolib, tao_output, install, compression, taoidldefaults, ace_bzip2 { requires += bzip2 sharedname = TAO_Bzip2Compressor dynamicflags = TAO_BZIP2COMPRESSOR_BUILD_DLL diff --git a/TAO/tao/CSD_Framework.mpc b/TAO/tao/CSD_Framework.mpc index 22fe980d240..a47226dd4ab 100644 --- a/TAO/tao/CSD_Framework.mpc +++ b/TAO/tao/CSD_Framework.mpc @@ -1,5 +1,18 @@ //$Id$ -project(CSD_Framework) : taolib, tao_output, portableserver, install, pi, avoids_corba_e_micro, tao_versioning_idl_defaults { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Sci -SS -Gp -Gd -Sorb -GA -Sal \ + -Wb,export_macro=TAO_CSD_FW_Export \ + -Wb,export_include=tao/CSD_Framework/CSD_FW_Export.h \ + -o CSD_Framework + idlflags -= -Sa -St + CSD_Framework/CSD_Framework.pidl + } +} + +project(CSD_Framework) : taolib, tao_output, portableserver, install, pi, avoids_corba_e_micro, taoidldefaults { + after += *idl sharedname = TAO_CSD_Framework dynamicflags = TAO_CSD_FW_BUILD_DLL includes += $(TAO_ROOT)/tao @@ -8,6 +21,10 @@ project(CSD_Framework) : taolib, tao_output, portableserver, install, pi, avoids CSD_Framework } + Source_Files { + CSD_Framework/CSD_FrameworkC.cpp + } + Header_Files { CSD_Framework } @@ -33,12 +50,6 @@ project(CSD_Framework) : taolib, tao_output, portableserver, install, pi, avoids } IDL_Files { - idlflags += -Sci -SS -Gp -Gd -Sorb -GA -Sal \ - -Wb,export_macro=TAO_CSD_FW_Export \ - -Wb,export_include=tao/CSD_Framework/CSD_FW_Export.h \ - -o CSD_Framework - idlflags -= -Sa -St - CSD_Framework/CSD_Framework.pidl } Pkgconfig_Files { diff --git a/TAO/tao/CodecFactory.mpc b/TAO/tao/CodecFactory.mpc index 78d34cc389b..6910f91a9d9 100644 --- a/TAO/tao/CodecFactory.mpc +++ b/TAO/tao/CodecFactory.mpc @@ -1,5 +1,29 @@ //$Id$ -project(CodecFactory) : taolib, tao_output, install, core_anytypecode, tao_versioning_idl_defaults, nolink_codecfactory { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb -Sal -GX \ + -Wb,export_macro=TAO_CodecFactory_Export \ + -Wb,export_include=tao/CodecFactory/codecfactory_export.h \ + -Wb,include_guard=TAO_CODECFACTORY_SAFE_INCLUDE \ + -Wb,safe_include=tao/CodecFactory/CodecFactory.h \ + -o CodecFactory + idlflags -= -Sa -St + CodecFactory/IOP_Codec.pidl + } + + IDL_Files { + idlflags += -Sci -SS -Sorb -Sa -GX \ + -Wb,export_macro=TAO_CodecFactory_Export \ + -Wb,export_include=tao/CodecFactory/codecfactory_export.h \ + -Wb,unique_include=tao/CodecFactory/CodecFactory.h \ + -o CodecFactory + CodecFactory/IOP_Codec_include.pidl + } +} + +project(CodecFactory) : taolib, tao_output, install, anytypecode, taoidldefaults, nolink_codecfactory { + after += *idl sharedname = TAO_CodecFactory dynamicflags = TAO_CODECFACTORY_BUILD_DLL @@ -7,6 +31,11 @@ project(CodecFactory) : taolib, tao_output, install, core_anytypecode, tao_versi CodecFactory } + Source_Files { + CodecFactory/IOP_CodecC.cpp + CodecFactory/IOP_Codec_includeC.cpp + } + Header_Files { CodecFactory } @@ -28,23 +57,6 @@ project(CodecFactory) : taolib, tao_output, install, core_anytypecode, tao_versi } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb -Sal -GX \ - -Wb,export_macro=TAO_CodecFactory_Export \ - -Wb,export_include=tao/CodecFactory/codecfactory_export.h \ - -Wb,include_guard=TAO_CODECFACTORY_SAFE_INCLUDE \ - -Wb,safe_include=tao/CodecFactory/CodecFactory.h \ - -o CodecFactory - idlflags -= -Sa -St - CodecFactory/IOP_Codec.pidl - } - - IDL_Files { - idlflags += -Sci -SS -Sorb -Sa -GX \ - -Wb,export_macro=TAO_CodecFactory_Export \ - -Wb,export_include=tao/CodecFactory/codecfactory_export.h \ - -Wb,unique_include=tao/CodecFactory/CodecFactory.h \ - -o CodecFactory - CodecFactory/IOP_Codec_include.pidl } Pkgconfig_Files { diff --git a/TAO/tao/Codeset.mpc b/TAO/tao/Codeset.mpc index f57a6cee265..27fa1c45d22 100644 --- a/TAO/tao/Codeset.mpc +++ b/TAO/tao/Codeset.mpc @@ -1,19 +1,30 @@ //$Id$ +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + idlflags += -SS -Sci -Sorb \ + -Wb,export_macro=TAO_Codeset_Export \ + -Wb,export_include=tao/Codeset/codeset_export.h \ + -o Codeset + IDL_Files { + Codeset/CodeSetContext.pidl + } +} -project(Codeset) : taolib, tao_output, install, tao_versioning_idl_defaults, nolink_codecfactory { +project(Codeset) : taolib, tao_output, install, taoidldefaults, nolink_codecfactory { sharedname = TAO_Codeset + after += *idl dynamicflags = TAO_CODESET_BUILD_DLL pch_header = pch_source = - idlflags += -SS -Sci -Sorb \ - -Wb,export_macro=TAO_Codeset_Export \ - -Wb,export_include=tao/Codeset/codeset_export.h \ - -o Codeset Source_Files { Codeset } + Source_Files { + Codeset/CodeSetContextC.cpp + } + Header_Files { Codeset } @@ -30,9 +41,9 @@ project(Codeset) : taolib, tao_output, install, tao_versioning_idl_defaults, nol } PIDL_Files { + Codeset } IDL_Files { - Codeset/CodeSetContext.pidl } } diff --git a/TAO/tao/Codeset/Codeset.cpp b/TAO/tao/Codeset/Codeset.cpp index c946ad4c3b5..ce56549d729 100644 --- a/TAO/tao/Codeset/Codeset.cpp +++ b/TAO/tao/Codeset/Codeset.cpp @@ -42,6 +42,7 @@ TAO_Codeset_Initializer::init (void) result += ACE_Service_Config::process_directive (ace_svc_desc_TAO_Codeset_Manager_Factory,1); // force replacement + return result; } diff --git a/TAO/tao/Codeset/Codeset_Manager_i.cpp b/TAO/tao/Codeset/Codeset_Manager_i.cpp index 012c101dea4..0e4b1fb706b 100644 --- a/TAO/tao/Codeset/Codeset_Manager_i.cpp +++ b/TAO/tao/Codeset/Codeset_Manager_i.cpp @@ -14,6 +14,7 @@ #include "tao/Codeset/Codeset_Translator_Factory.h" #include "tao/Codeset/Codeset.h" #include "tao/Codeset/CodeSetContextC.h" +#include "tao/Codeset/Codeset_Service_Context_Handler.h" #include "ace/Dynamic_Service.h" #include "ace/Codeset_Registry.h" @@ -207,11 +208,15 @@ TAO_Codeset_Manager_i::process_service_context (TAO_ServerRequest &request) } if (TAO_debug_level > 2) { + ACE_CString tcs_c_locale; + ACE_CString tcs_w_locale; + ACE_Codeset_Registry::registry_to_locale (tcs_c, tcs_c_locale, 0, 0); + ACE_Codeset_Registry::registry_to_locale (tcs_w, tcs_w_locale, 0, 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::") ACE_TEXT ("process_service_context, ") - ACE_TEXT ("using tcsc = %08x, tcsw = %08x\n"), - tcs_c,tcs_w)); + ACE_TEXT ("using tcsc <%C> (%08x), tcsw <%C> (%08x)\n"), + tcs_c_locale.c_str (), tcs_c, tcs_w_locale.c_str (), tcs_w)); } request.transport()->char_translator(this->get_char_trans (tcs_c)); @@ -241,19 +246,26 @@ TAO_Codeset_Manager_i::generate_service_context (TAO_Operation_Details &opd, if (TAO_debug_level > 2) { + ACE_CString tcs_c_locale; + ACE_CString tcs_w_locale; + ACE_Codeset_Registry::registry_to_locale (codeset_cntx.char_data, tcs_c_locale, 0, 0); + ACE_Codeset_Registry::registry_to_locale (codeset_cntx.wchar_data, tcs_w_locale, 0, 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::") ACE_TEXT ("generate_service_context, ") - ACE_TEXT ("using tcs_c = %08x, tcs_w = %08x\n"), + ACE_TEXT ("using tcs_c <%C> (%08x), tcs_w <%C> (%08x)\n"), + tcs_c_locale.c_str (), codeset_cntx.char_data, + tcs_w_locale.c_str (), codeset_cntx.wchar_data)); } TAO_OutputCDR codeset_cdr; - codeset_cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); - codeset_cdr << codeset_cntx; - - service_cntx.set_context (IOP::CodeSets,codeset_cdr); + if ((codeset_cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) && + (codeset_cdr << codeset_cntx)) + { + service_cntx.set_context (IOP::CodeSets,codeset_cdr); + } } /// Checks whether the NCS is a part of CCS @@ -336,7 +348,7 @@ TAO_Codeset_Manager_i::computeTCS (CONV_FRAME::CodeSetComponent &remote, } void -TAO_Codeset_Manager_i::open(void) +TAO_Codeset_Manager_i::open(TAO_ORB_Core& core) { #if 0 // These translators help comply with the CORBA 3.0.2 specifcation @@ -375,6 +387,11 @@ TAO_Codeset_Manager_i::open(void) )); } #endif + // + TAO_Codeset_Service_Context_Handler* h = 0; + ACE_NEW (h, + TAO_Codeset_Service_Context_Handler()); + core.service_context_registry ().bind (IOP::CodeSets, h); // add in from the service configurator this->codeset_info_.ForCharData.native_code_set = diff --git a/TAO/tao/Codeset/Codeset_Manager_i.h b/TAO/tao/Codeset/Codeset_Manager_i.h index a9167804b1c..3efbbfb8d51 100644 --- a/TAO/tao/Codeset/Codeset_Manager_i.h +++ b/TAO/tao/Codeset/Codeset_Manager_i.h @@ -94,7 +94,7 @@ public: /// initialization. This will traverse the list of named codeset /// translator factories and add any of those that have a native /// codeset id matching the manager's native codeset id. - void open(void); + void open(TAO_ORB_Core& core); virtual TAO_Codeset_Descriptor_Base *char_codeset_descriptor (void); virtual TAO_Codeset_Descriptor_Base *wchar_codeset_descriptor (void); diff --git a/TAO/tao/Codeset/Codeset_Service_Context_Handler.cpp b/TAO/tao/Codeset/Codeset_Service_Context_Handler.cpp new file mode 100644 index 00000000000..58b0aa53c46 --- /dev/null +++ b/TAO/tao/Codeset/Codeset_Service_Context_Handler.cpp @@ -0,0 +1,45 @@ +// $Id$ + +#include "tao/Codeset/Codeset_Service_Context_Handler.h" + +ACE_RCSID (Codeset, + Codeset_Service_Context_Handler, + "$Id$") + +#include "tao/CDR.h" +#include "tao/Transport.h" +#include "tao/ORB_Core.h" +#include "tao/operation_details.h" +#include "tao/Codeset_Manager.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_Codeset_Service_Context_Handler::process_service_context ( + TAO_Transport&, + const IOP::ServiceContext&) +{ + return 0; +} + +int +TAO_Codeset_Service_Context_Handler::generate_service_context ( + TAO_Stub *, + TAO_Transport& transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &, + TAO_OutputCDR &) +{ + if (transport.first_request ()) + { + TAO_Codeset_Manager * const csm = transport.orb_core ()->codeset_manager (); + if (csm) + { + csm->generate_service_context (opdetails, transport); + } + } + + return 0; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Codeset/Codeset_Service_Context_Handler.h b/TAO/tao/Codeset/Codeset_Service_Context_Handler.h new file mode 100644 index 00000000000..381dbb0d480 --- /dev/null +++ b/TAO/tao/Codeset/Codeset_Service_Context_Handler.h @@ -0,0 +1,45 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file Codeset_Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_CODESET_SERVICE_CONTEXT_HANDLER_H +#define TAO_CODESET_SERVICE_CONTEXT_HANDLER_H +#include /**/ "ace/pre.h" +#include "tao/Codeset/codeset_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Service_Context_Handler.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_Stub; + +class TAO_Codeset_Service_Context_Handler : + public TAO_Service_Context_Handler +{ +public: + virtual int process_service_context (TAO_Transport& transport, + const IOP::ServiceContext& context); + virtual int generate_service_context ( + TAO_Stub* stub, + TAO_Transport &transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* TAO_CODESET_SERVICE_CONTEXT_HANDLER_H */ diff --git a/TAO/tao/Codeset_Manager.h b/TAO/tao/Codeset_Manager.h index 292ad53fb8d..0afbde23a4f 100644 --- a/TAO/tao/Codeset_Manager.h +++ b/TAO/tao/Codeset_Manager.h @@ -87,7 +87,7 @@ public: virtual TAO_Codeset_Translator_Base * get_wchar_trans (CONV_FRAME::CodeSetId tcs) = 0; - virtual void open (void) = 0; + virtual void open (TAO_ORB_Core& core) = 0; virtual TAO_Codeset_Descriptor_Base *char_codeset_descriptor (void) = 0; virtual TAO_Codeset_Descriptor_Base *wchar_codeset_descriptor (void) = 0; diff --git a/TAO/tao/Compression.mpc b/TAO/tao/Compression.mpc index 9097fcb40e9..89d04d53704 100644 --- a/TAO/tao/Compression.mpc +++ b/TAO/tao/Compression.mpc @@ -1,15 +1,43 @@ //$Id$ -project(Compression) : taolib, tao_output, install, tao_versioning_idl_defaults, core_anytypecode { - sharedname = TAO_Compression - dynamicflags = TAO_COMPRESSION_BUILD_DLL +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 idlflags += -SS -Sorb -Sci -GA \ -Wb,export_macro=TAO_Compression_Export \ -o Compression + IDL_Files { + idlflags -= -Sa -St + idlflags += -Gp -Gd -Sal\ + -Wb,export_macro=TAO_Compression_Export \ + -Wb,export_include=tao/Compression/compression_export.h \ + -Wb,include_guard=TAO_COMPRESSION_SAFE_INCLUDE \ + -Wb,safe_include=tao/Compression/Compression.h + Compression/Compression.pidl + } + + IDL_Files { + idlflags += \ + -Wb,export_include=tao/Compression/compression_export.h \ + -Wb,unique_include=tao/Compression/Compression.h + Compression/Compression_include.pidl + } +} + +project(Compression) : taolib, tao_output, install, taoidldefaults, anytypecode { + after += *idl + sharedname = TAO_Compression + dynamicflags = TAO_COMPRESSION_BUILD_DLL Source_Files { Compression } + Source_Files { + Compression/CompressionC.cpp + Compression/Compression_includeC.cpp + Compression/CompressionA.cpp + Compression/Compression_includeA.cpp + } + Header_Files { Compression } @@ -31,20 +59,7 @@ project(Compression) : taolib, tao_output, install, tao_versioning_idl_defaults, } IDL_Files { - idlflags -= -Sa -St - idlflags += -Gp -Gd -Sal\ - -Wb,export_macro=TAO_Compression_Export \ - -Wb,export_include=tao/Compression/compression_export.h \ - -Wb,include_guard=TAO_COMPRESSION_SAFE_INCLUDE \ - -Wb,safe_include=tao/Compression/Compression.h - Compression/Compression.pidl - } - - IDL_Files { - idlflags += \ - -Wb,export_include=tao/Compression/compression_export.h \ - -Wb,unique_include=tao/Compression/Compression.h - Compression/Compression_include.pidl + Compression } Pkgconfig_Files { diff --git a/TAO/tao/Compression/Base_Compressor.cpp b/TAO/tao/Compression/Base_Compressor.cpp index 480ab34cd73..d949a3c9b49 100644 --- a/TAO/tao/Compression/Base_Compressor.cpp +++ b/TAO/tao/Compression/Base_Compressor.cpp @@ -63,8 +63,10 @@ namespace TAO ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); if (this->uncompressed_bytes_ > 0) { - return_value = static_cast < ::Compression::CompressionRatio> - (100 - (this->compressed_bytes_ / this->uncompressed_bytes_) * 100); + return_value = + static_cast < ::Compression::CompressionRatio>(100 - + (((CORBA::Double)this->uncompressed_bytes_ / this->compressed_bytes_) * + (CORBA::Double)100)); } } return return_value; diff --git a/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp b/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp index fcfd6a83a0d..7750e6f5962 100644 --- a/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp +++ b/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp @@ -23,18 +23,17 @@ Bzip2Compressor::compress ( ::Compression::Buffer & target ) { - unsigned int max_length = - static_cast <unsigned int> (source.length () * 1.1) + TAO_GIOP_MESSAGE_HEADER_LEN; + unsigned int max_length = + static_cast <unsigned int> (source.length () * 1.01) + 600; target.length (static_cast <CORBA::ULong> (max_length)); - // todo, check 0,1 values int const retval = ::BZ2_bzBuffToBuffCompress (reinterpret_cast <char*>(target.get_buffer ()), &max_length, reinterpret_cast <char*>(const_cast<CORBA::Octet*>(source.get_buffer ())), source.length (), - 0, + 9, 1, - this->compression_level ()); + this->compression_level () * 25); if (retval != BZ_OK) { diff --git a/TAO/tao/Compression/lzo/LzoCompressor.cpp b/TAO/tao/Compression/lzo/LzoCompressor.cpp index c67b4a25ec8..6a3dbd16f13 100644 --- a/TAO/tao/Compression/lzo/LzoCompressor.cpp +++ b/TAO/tao/Compression/lzo/LzoCompressor.cpp @@ -4,8 +4,8 @@ ACE_RCSID (LZO, LzoCompressor, "$Id$") -#include <lzo/lzo1x.h> -#include <lzo/lzoutil.h> +#include <lzo1x.h> +#include <lzoutil.h> TAO_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/lzo/LzoCompressor_Factory.cpp b/TAO/tao/Compression/lzo/LzoCompressor_Factory.cpp index a34d07a6ca5..543c1064372 100644 --- a/TAO/tao/Compression/lzo/LzoCompressor_Factory.cpp +++ b/TAO/tao/Compression/lzo/LzoCompressor_Factory.cpp @@ -5,7 +5,7 @@ ACE_RCSID (LZO, Lzo_Compressor_Factory, "$Id$") -#include <lzo/lzo1x.h> +#include <lzo1x.h> TAO_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/zlib/ZlibCompressor.cpp b/TAO/tao/Compression/zlib/ZlibCompressor.cpp index 85ce653b9a5..b2c7a558fc5 100644 --- a/TAO/tao/Compression/zlib/ZlibCompressor.cpp +++ b/TAO/tao/Compression/zlib/ZlibCompressor.cpp @@ -24,7 +24,7 @@ ZlibCompressor::compress ( ) { uLongf max_length = - static_cast <uLongf> (source.length () * 1.1); + static_cast <uLongf> (source.length () * 1.001) + 12; target.length (static_cast <CORBA::ULong> (max_length)); int const retval = ::compress2 (reinterpret_cast <Bytef*>(target.get_buffer ()), @@ -35,7 +35,7 @@ ZlibCompressor::compress ( if (retval != Z_OK) { - throw ::Compression::CompressionException (retval, ""); + throw ::Compression::CompressionException (retval, ::zError (retval)); } else { diff --git a/TAO/tao/Connection_Handler.h b/TAO/tao/Connection_Handler.h index 8d3acc3a416..39dfd6e7fae 100644 --- a/TAO/tao/Connection_Handler.h +++ b/TAO/tao/Connection_Handler.h @@ -198,6 +198,10 @@ protected: //@} private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Connection_Handler &)) + ACE_UNIMPLEMENTED_FUNC (TAO_Connection_Handler (const TAO_Connection_Handler &)) + +private: /// Pointer to the TAO_ORB_Core TAO_ORB_Core * const orb_core_; diff --git a/TAO/tao/DiffServPolicy.mpc b/TAO/tao/DiffServPolicy.mpc index e2922ad8c82..a5fafb47d06 100644 --- a/TAO/tao/DiffServPolicy.mpc +++ b/TAO/tao/DiffServPolicy.mpc @@ -1,5 +1,20 @@ //$Id$ -project(DiffServPolicy) : taolib, tao_output, install, portableserver, pi, tao_versioning_idl_defaults, tao_no_iiop, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { +project(*idl) : tao_versioning_idl_defaults, tao_no_iiop { + custom_only = 1 + IDL_Files { + idlflags += -GA -SS -Sci -Sorb \ + -Wb,export_macro=TAO_DiffServPolicy_Export \ + -Wb,export_include=tao/DiffServPolicy/DiffServPolicy_Export.h \ + -Wb,include_guard=TAO_DIFFSERVPOLICY_SAFE_INCLUDE \ + -Wb,safe_include=tao/DiffServPolicy/DiffServPolicy.h \ + -o DiffServPolicy + idlflags -= -St + DiffServPolicy/DiffServPolicy.pidl + } +} + +project(DiffServPolicy) : taolib, tao_output, install, portableserver, pi, taoidldefaults, tao_no_iiop, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { + after += *idl sharedname = TAO_DiffServPolicy dynamicflags = TAO_DIFFSERVPOLICY_BUILD_DLL @@ -7,6 +22,10 @@ project(DiffServPolicy) : taolib, tao_output, install, portableserver, pi, tao_v DiffServPolicy } + Source_Files { + DiffServPolicy/DiffServPolicyC.cpp + } + Header_Files { DiffServPolicy } @@ -24,17 +43,10 @@ project(DiffServPolicy) : taolib, tao_output, install, portableserver, pi, tao_v } PIDL_Files { + DiffServPolicy } IDL_Files { - idlflags += -GA -SS -Sci -Sorb \ - -Wb,export_macro=TAO_DiffServPolicy_Export \ - -Wb,export_include=tao/DiffServPolicy/DiffServPolicy_Export.h \ - -Wb,include_guard=TAO_DIFFSERVPOLICY_SAFE_INCLUDE \ - -Wb,safe_include=tao/DiffServPolicy/DiffServPolicy.h \ - -o DiffServPolicy - idlflags -= -St - DiffServPolicy/DiffServPolicy.pidl } Pkgconfig_Files { diff --git a/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp b/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp index 88ee37f6d69..100053ff8de 100644 --- a/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp +++ b/TAO/tao/DiffServPolicy/DiffServPolicy_ORBInitializer.cpp @@ -3,6 +3,7 @@ #include "tao/DiffServPolicy/DiffServPolicy_ORBInitializer.h" #include "tao/DiffServPolicy/DiffServPolicy.h" #include "tao/DiffServPolicy/DiffServPolicy_Factory.h" +#include "tao/DiffServPolicy/DiffServ_Service_Context_Handler.h" #include "tao/DiffServPolicy/DiffServ_Protocols_Hooks.h" #include "tao/ORB_Core.h" #include "tao/PI/ORBInitInfo.h" @@ -15,8 +16,29 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL void TAO_DiffServPolicy_ORBInitializer::pre_init ( - PortableInterceptor::ORBInitInfo_ptr) + PortableInterceptor::ORBInitInfo_ptr info) { + // Narrow to a TAO_ORBInitInfo object to get access to the + // orb_core() TAO extension. + TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info); + + if (CORBA::is_nil (tao_info.in ())) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + "(%P|%t) TAO_RT_ORBInitializer::pre_init:\n" + "(%P|%t) Unable to narrow " + "\"PortableInterceptor::ORBInitInfo_ptr\" to\n" + "(%P|%t) \"TAO_ORBInitInfo *.\"\n")); + + throw ::CORBA::INTERNAL (); + } + + // Bind the service context handler for Diffserv + TAO_DiffServ_Service_Context_Handler* h = 0; + ACE_NEW (h, + TAO_DiffServ_Service_Context_Handler()); + tao_info->orb_core ()->service_context_registry ().bind (IOP::REP_NWPRIORITY, h); } void diff --git a/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp b/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp index 117e4757961..e6157404590 100644 --- a/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp +++ b/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp @@ -32,57 +32,12 @@ TAO_DS_Network_Priority_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core) this->orb_core_ = orb_core; } -void -TAO_DS_Network_Priority_Protocols_Hooks::np_service_context ( - TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart) -{ - // If the restart flag is true, then this call for a - // reinvocation. We need not prepare the Service Context List once - // again. We can use the already existing one. - if (!restart) - { - CORBA::Policy_var cnpp = - stub->get_cached_policy (TAO_CACHED_POLICY_CLIENT_NETWORK_PRIORITY); - - if (!CORBA::is_nil (cnpp.in ())) - { - TAO::NetworkPriorityPolicy_var cnp = - TAO::NetworkPriorityPolicy::_narrow (cnpp.in ()); - - TAO::DiffservCodepoint reply_diffserv_codepoint; - reply_diffserv_codepoint = cnp->reply_diffserv_codepoint (); - - CORBA::Long rep_dscp_codepoint = reply_diffserv_codepoint; - - this->add_rep_np_service_context_hook (service_context, - rep_dscp_codepoint); - } - } -} - -void -TAO_DS_Network_Priority_Protocols_Hooks::add_rep_np_service_context_hook ( - TAO_Service_Context &service_context, - CORBA::Long &dscp_codepoint) -{ - TAO_OutputCDR cdr; - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << dscp_codepoint) == 0) - { - throw CORBA::MARSHAL (); - } - - service_context.set_context (IOP::REP_NWPRIORITY, cdr); -} - CORBA::Long TAO_DS_Network_Priority_Protocols_Hooks::get_dscp_codepoint ( TAO_Service_Context &sc) { CORBA::Long dscp_codepoint = 0; - const IOP::ServiceContext *context; + const IOP::ServiceContext *context = 0; if (sc.get_context (IOP::REP_NWPRIORITY, &context) == 1) { diff --git a/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h b/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h index 9e935fac90e..6645bc01ce5 100644 --- a/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h +++ b/TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h @@ -49,7 +49,7 @@ public: CORBA::Long get_dscp_codepoint (TAO_Stub *stub, CORBA::Object *object); /// This function is used by the server side to figure out the - /// DiffServ codepoint that is attached and sent as part of the + /// DiffServ codepoint that is attached and sent as part of the /// service context of the request from the client side. /// Specifically, when CLIENT_PROPAGATED networ priority model /// is followed, the clients sent the DiffServ codepoint, they @@ -58,23 +58,6 @@ public: /// CORBA::Long get_dscp_codepoint (TAO_Service_Context &sc); - /// This function is called from the ORB_Core to add - /// network priority policy specific information on the request - /// service context. Specifically, when CLIENT_PROPAGATED network - /// priority model is used, the DiffServ codepoint that needs to be used - /// by the server side in the reply, is specified as a service context - /// entry, just like how RT-CORBA's CLIENT_PROPAGATED priority model works. - /// - void np_service_context (TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart); - - /// Helper function that is used by the np_service_context () method. - /// - void add_rep_np_service_context_hook ( - TAO_Service_Context &service_context, - CORBA::Long &dscp_codepoint); - protected: TAO_ORB_Core *orb_core_; diff --git a/TAO/tao/DiffServPolicy/DiffServ_Service_Context_Handler.cpp b/TAO/tao/DiffServPolicy/DiffServ_Service_Context_Handler.cpp new file mode 100644 index 00000000000..6bd71b8a674 --- /dev/null +++ b/TAO/tao/DiffServPolicy/DiffServ_Service_Context_Handler.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#include "tao/DiffServPolicy/DiffServ_Service_Context_Handler.h" + +ACE_RCSID (DiffServPolicy, + DiffServ_Service_Context_Handler, + "$Id$") + +#include "tao/DiffServPolicy/Client_Network_Priority_Policy.h" +#include "tao/CDR.h" +#include "tao/TAO_Server_Request.h" +#include "tao/Transport.h" +#include "tao/ORB_Core.h" +#include "tao/GIOP_Message_Base.h" +#include "tao/operation_details.h" +#include "tao/Transport_Mux_Strategy.h" +#include "tao/Stub.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_DiffServ_Service_Context_Handler::process_service_context ( + TAO_Transport&, + const IOP::ServiceContext&) +{ + return 0; +} + +int +TAO_DiffServ_Service_Context_Handler::generate_service_context ( + TAO_Stub *stub, + TAO_Transport&, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &, + TAO_OutputCDR &) +{ + if (stub) + { + CORBA::Policy_var cnpp = + stub->get_cached_policy (TAO_CACHED_POLICY_CLIENT_NETWORK_PRIORITY); + + TAO::NetworkPriorityPolicy_var cnp = + TAO::NetworkPriorityPolicy::_narrow (cnpp.in ()); + + if (!CORBA::is_nil (cnp.in ())) + { + TAO::DiffservCodepoint const reply_diffserv_codepoint = + cnp->reply_diffserv_codepoint (); + + CORBA::Long const rep_dscp_codepoint = reply_diffserv_codepoint; + + TAO_OutputCDR cdr; + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(cdr << rep_dscp_codepoint)) + { + throw CORBA::MARSHAL (); + } + + opdetails.request_service_context ().set_context (IOP::REP_NWPRIORITY, cdr); + } + } + + return 0; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DiffServPolicy/DiffServ_Service_Context_Handler.h b/TAO/tao/DiffServPolicy/DiffServ_Service_Context_Handler.h new file mode 100644 index 00000000000..8df73fa9dca --- /dev/null +++ b/TAO/tao/DiffServPolicy/DiffServ_Service_Context_Handler.h @@ -0,0 +1,43 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file DiffServ_Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_DIFFSERV_SERVICE_CONTEXT_HANDLER_H +#define TAO_DIFFSERV_SERVICE_CONTEXT_HANDLER_H +#include /**/ "ace/pre.h" +#include "tao/DiffServPolicy/DiffServPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Service_Context_Handler.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_DiffServ_Service_Context_Handler : + public TAO_Service_Context_Handler +{ +public: + virtual int process_service_context (TAO_Transport& transport, + const IOP::ServiceContext& context); + virtual int generate_service_context ( + TAO_Stub *stub, + TAO_Transport &transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* TAO_DIFFSERV_SERVICE_CONTEXT_HANDLER_H */ diff --git a/TAO/tao/DynamicAny.mpc b/TAO/tao/DynamicAny.mpc index 6c344c9afb4..c098117114b 100644 --- a/TAO/tao/DynamicAny.mpc +++ b/TAO/tao/DynamicAny.mpc @@ -1,6 +1,19 @@ //$Id$ +project(*idl) : tao_versioning_idl_defaults, valuetype { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb \ + -Wb,export_macro=TAO_DynamicAny_Export \ + -Wb,export_include=tao/DynamicAny/dynamicany_export.h \ + -Wb,include_guard=TAO_DYNAMICANY_SAFE_INCLUDE \ + -Wb,safe_include=tao/DynamicAny/DynamicAny.h \ + -o DynamicAny + DynamicAny/DynamicAny.pidl + } +} -project(DynamicAny) : install, tao_output, valuetype, tao_versioning_idl_defaults { +project(DynamicAny) : install, tao_output, valuetype, taoidldefaults { + after += *idl sharedname = TAO_DynamicAny dynamicflags = TAO_DYNAMICANY_BUILD_DLL @@ -20,6 +33,10 @@ project(DynamicAny) : install, tao_output, valuetype, tao_versioning_idl_default DynamicAny/DynAnyFactory.cpp } + Source_Files { + DynamicAny/DynamicAnyC.cpp + } + Header_Files { DynamicAny } @@ -41,13 +58,6 @@ project(DynamicAny) : install, tao_output, valuetype, tao_versioning_idl_default } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb \ - -Wb,export_macro=TAO_DynamicAny_Export \ - -Wb,export_include=tao/DynamicAny/dynamicany_export.h \ - -Wb,include_guard=TAO_DYNAMICANY_SAFE_INCLUDE \ - -Wb,safe_include=tao/DynamicAny/DynamicAny.h \ - -o DynamicAny - DynamicAny/DynamicAny.pidl } Pkgconfig_Files { diff --git a/TAO/tao/DynamicInterface.mpc b/TAO/tao/DynamicInterface.mpc index b02dd2ee2cd..13bb25ddf09 100644 --- a/TAO/tao/DynamicInterface.mpc +++ b/TAO/tao/DynamicInterface.mpc @@ -24,6 +24,7 @@ project(DynamicInterface) : taolib, tao_output, install, messaging, minimum_corb } PIDL_Files { + DynamicInterface } IDL_Files { diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp index ae7736c018c..efcc31ba283 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp @@ -244,6 +244,9 @@ namespace TAO throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); } + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, transport->output_cdr_lock (), + TAO_INVOKE_FAILURE); + transport->messaging_object ()->out_stream ().reset_byte_order ( request_->_tao_byte_order ()); @@ -254,6 +257,8 @@ namespace TAO this->rd_, this->request_); + ace_mon.release (); + Invocation_Status status = synch.remote_invocation (max_wait_time); if (status == TAO_INVOKE_RESTART) diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp index e8734e54b21..4d28e8f3b51 100644 --- a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp +++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp @@ -90,7 +90,7 @@ TAO_DII_Deferred_Reply_Dispatcher::dispatch_reply ( } // This was dynamically allocated. Now the job is done. - (void) this->decr_refcount (); + this->intrusive_remove_ref (this); return 1; } @@ -122,7 +122,7 @@ TAO_DII_Deferred_Reply_Dispatcher::connection_closed (void) } } - (void) this->decr_refcount (); + this->intrusive_remove_ref (this); } TAO_DII_Asynch_Reply_Dispatcher::TAO_DII_Asynch_Reply_Dispatcher ( @@ -202,7 +202,7 @@ TAO_DII_Asynch_Reply_Dispatcher::dispatch_reply ( } } // This was dynamically allocated. Now the job is done. - (void) this->decr_refcount (); + this->intrusive_remove_ref (this); return 1; } @@ -236,6 +236,6 @@ TAO_DII_Asynch_Reply_Dispatcher::connection_closed (void) } } - (void) this->decr_refcount (); + this->intrusive_remove_ref (this); } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h index 3ac767ff576..65db3c87dc3 100644 --- a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h +++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h @@ -51,8 +51,6 @@ public: TAO_DII_Deferred_Reply_Dispatcher (const CORBA::Request_ptr req, TAO_ORB_Core *orb_core); - - /// The Reply_Dispatcher methods virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶m); diff --git a/TAO/tao/EndpointPolicy.mpc b/TAO/tao/EndpointPolicy.mpc index d5ef7438812..7a69dfd92bb 100644 --- a/TAO/tao/EndpointPolicy.mpc +++ b/TAO/tao/EndpointPolicy.mpc @@ -1,5 +1,20 @@ //$Id$ -project(EndpointPolicy) : taolib, tao_output, install, portableserver, pi, tao_versioning_idl_defaults, tao_no_iiop, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { +project(*core_idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -GA -SS -Sci -Sorb \ + -Wb,export_macro=TAO_EndpointPolicy_Export \ + -Wb,export_include=tao/EndpointPolicy/EndpointPolicy_Export.h \ + -o EndpointPolicy + idlflags -= -Sa -St + EndpointPolicy/EndpointPolicy.pidl + EndpointPolicy/IIOPEndpointValue.pidl + EndpointPolicy/EndpointPolicyType.pidl + } +} + +project(EndpointPolicy) : taolib, tao_output, install, portableserver, pi, taoidldefaults, tao_no_iiop, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { + after += *core_idl sharedname = TAO_EndpointPolicy dynamicflags = TAO_ENDPOINTPOLICY_BUILD_DLL @@ -7,6 +22,15 @@ project(EndpointPolicy) : taolib, tao_output, install, portableserver, pi, tao_v EndpointPolicy } + Source_Files { + EndpointPolicy/EndpointPolicyC.cpp + EndpointPolicy/IIOPEndpointValueC.cpp + EndpointPolicy/EndpointPolicyTypeC.cpp + EndpointPolicy/EndpointPolicyA.cpp + EndpointPolicy/EndpointPolicyTypeA.cpp + EndpointPolicy/IIOPEndpointValueA.cpp + } + Header_Files { EndpointPolicy } @@ -24,17 +48,10 @@ project(EndpointPolicy) : taolib, tao_output, install, portableserver, pi, tao_v } PIDL_Files { + EndpointPolicy } IDL_Files { - idlflags += -GA -SS -Sci -Sorb \ - -Wb,export_macro=TAO_EndpointPolicy_Export \ - -Wb,export_include=tao/EndpointPolicy/EndpointPolicy_Export.h \ - -o EndpointPolicy - idlflags -= -St - EndpointPolicy/EndpointPolicy.pidl - EndpointPolicy/IIOPEndpointValue.pidl - EndpointPolicy/EndpointPolicyType.pidl } Pkgconfig_Files { diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp index e8290268c23..baa57006a0c 100644 --- a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp @@ -34,7 +34,7 @@ TAO_EndpointPolicy_Factory::create_policy ( { if (type == EndpointPolicy::ENDPOINT_POLICY_TYPE) { - const EndpointPolicy::EndpointList* endpoint_list; + const EndpointPolicy::EndpointList* endpoint_list = 0; if (!(value >>= endpoint_list)) throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE); diff --git a/TAO/tao/Exclusive_TMS.cpp b/TAO/tao/Exclusive_TMS.cpp index 8f9da78eec5..f8077d17ba8 100644 --- a/TAO/tao/Exclusive_TMS.cpp +++ b/TAO/tao/Exclusive_TMS.cpp @@ -55,10 +55,10 @@ TAO_Exclusive_TMS::request_id (void) // Bind the handler with the request id. int TAO_Exclusive_TMS::bind_dispatcher (CORBA::ULong request_id, - TAO_Reply_Dispatcher *rd) + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd) { this->request_id_ = request_id; - this->rd_ = rd; + this->rd_ = rd.get (); return 0; } @@ -74,8 +74,8 @@ TAO_Exclusive_TMS::unbind_dispatcher (CORBA::ULong request_id) { if (!this->rd_ || this->request_id_ != request_id) return -1; - this->request_id_ = 0; - this->rd_ = 0; + + this->rd_.release (); return 0; } @@ -96,9 +96,9 @@ TAO_Exclusive_TMS::dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) return 0; } - TAO_Reply_Dispatcher *rd = this->rd_; + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd (this->rd_.get ()); this->request_id_ = 0; // @@ What is a good value??? - this->rd_ = 0; + this->rd_.release (); // Dispatch the reply. // Returns 1 on success, -1 on failure. @@ -120,10 +120,10 @@ TAO_Exclusive_TMS::reply_timed_out (CORBA::ULong request_id) // did not find the right reply handler. return 0; } - - TAO_Reply_Dispatcher *rd = this->rd_; + + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd (this->rd_.get ()); this->request_id_ = 0; // @@ What is a good value??? - this->rd_ = 0; + this->rd_.release (); rd->reply_timed_out (); diff --git a/TAO/tao/Exclusive_TMS.h b/TAO/tao/Exclusive_TMS.h index 439da9cfd1e..751b00e3f80 100644 --- a/TAO/tao/Exclusive_TMS.h +++ b/TAO/tao/Exclusive_TMS.h @@ -25,6 +25,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_Pluggable_Reply_Params; +class TAO_Reply_Dispatcher; /** * @class TAO_Exclusive_TMS @@ -55,7 +56,7 @@ public: //@{ virtual CORBA::ULong request_id (void); virtual int bind_dispatcher (CORBA::ULong request_id, - TAO_Reply_Dispatcher *rh); + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd); virtual int unbind_dispatcher (CORBA::ULong request_id); virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms); @@ -77,7 +78,7 @@ protected: /// Reply Dispatcher corresponding to the request. If this is zero we don't /// have a reply, if it not zero we have one - TAO_Reply_Dispatcher *rd_; + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Fault_Tolerance_Service.h b/TAO/tao/Fault_Tolerance_Service.h index fc955831b91..db12a2286a3 100644 --- a/TAO/tao/Fault_Tolerance_Service.h +++ b/TAO/tao/Fault_Tolerance_Service.h @@ -56,6 +56,10 @@ public: TAO_Service_Callbacks *service_callback (void); private: + void operator= (const TAO_Fault_Tolerance_Service &); + TAO_Fault_Tolerance_Service (const TAO_Fault_Tolerance_Service &); + +private: /// hook to callback on to the service TAO_Service_Callbacks *ft_service_callback_; diff --git a/TAO/tao/FlResource.mpc b/TAO/tao/FlResource.mpc index 6b3b0e1cd0c..2ea160ffee7 100644 --- a/TAO/tao/FlResource.mpc +++ b/TAO/tao/FlResource.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- now wouldn't this be cool... // $Id$ -project(TAO_FlResource) : acelib, taolib, install, tao_output, taodefaults, ace_flreactor, tao_versioning_idl_defaults { +project(TAO_FlResource) : acelib, taolib, install, tao_output, taodefaults, ace_flreactor, taoidldefaults { sharedname = TAO_FlResource dynamicflags += TAO_FLRESOURCE_BUILD_DLL diff --git a/TAO/tao/FoxResource.mpc b/TAO/tao/FoxResource.mpc index 402fe472fad..003be73e201 100644 --- a/TAO/tao/FoxResource.mpc +++ b/TAO/tao/FoxResource.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- now wouldn't this be cool... // $Id$ -project(TAO_FoxResource) : acelib, taolib, install, tao_output, taodefaults, ace_foxreactor, tao_versioning_idl_defaults { +project(TAO_FoxResource) : acelib, taolib, install, tao_output, taodefaults, ace_foxreactor, taoidldefaults { sharedname = TAO_FoxResource dynamicflags += TAO_FOCRESOURCE_BUILD_DLL diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 6911348398f..6e3d3fbf3bc 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -237,7 +237,7 @@ TAO_GIOP_Message_Base::generate_fragment_header (TAO_OutputCDR & cdr, } int -TAO_GIOP_Message_Base::dump_consolidated_msg (TAO_OutputCDR &stream, bool hex_dump_only) +TAO_GIOP_Message_Base::dump_consolidated_msg (TAO_OutputCDR &stream) { // Check whether the output cdr stream is build up of multiple // messageblocks. If so, consolidate them to one block that can be @@ -251,13 +251,12 @@ TAO_GIOP_Message_Base::dump_consolidated_msg (TAO_OutputCDR &stream, bool hex_du ACE_CDR::consolidate (consolidated_block, stream.begin ()); buf = (char *) (consolidated_block->rd_ptr ()); } - /// - this->dump_msg ("send", reinterpret_cast <u_char *> (buf), total_len, hex_dump_only); - // + this->dump_msg ("send", reinterpret_cast <u_char *> (buf), total_len); + delete consolidated_block; consolidated_block = 0; - // + return 0; } @@ -265,17 +264,18 @@ int TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream, TAO_Stub* stub) { this->set_giop_flags (stream); + + bool log_msg = TAO_debug_level > 9; #if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 TAO_ZIOP_Adapter* ziop_adapter = this->orb_core_->ziop_adapter (); - //ziop adapter found and not compressed yet + // Ziop adapter found and not compressed yet if (ziop_adapter) { - if (TAO_debug_level >= 5) + if (TAO_debug_level > 9) { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Before compression: "))); - this->dump_consolidated_msg (stream, true); + this->dump_consolidated_msg (stream); } bool compressed; if (stub) @@ -287,11 +287,18 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream, TAO_Stub* stub) compressed = ziop_adapter->marshal_data (stream, *this->orb_core_); } - if (TAO_debug_level >= 5) + if (TAO_debug_level > 9) { if (!compressed) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("GIOP message not compressed"))); + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("TAO_GIOP_Message_Base::format_message, ") + ACE_TEXT ("GIOP message not compressed\n"))); + // no need to log. If compressed->ZIOP library dumps message + // if not compressed (due to failure or policy settings) + // message hasn't changed and was allready dumped + // prior to compression... + log_msg = false; } } #else @@ -325,9 +332,9 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream, TAO_Stub* stub) buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ - if (TAO_debug_level >= 5) + if (log_msg) { - this->dump_consolidated_msg (stream, false); + this->dump_consolidated_msg (stream); } return 0; @@ -645,13 +652,6 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, size_t wr_pos = qd->msg_block ()->wr_ptr () - qd->msg_block ()->base (); rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN; - if (TAO_debug_level >= 5) - { - this->dump_msg ("recv", - reinterpret_cast <u_char *> (qd->msg_block ()->rd_ptr ()), - qd->msg_block ()->length ()); - } - // Create a input CDR stream. We do the following // 1 - If the incoming message block has a data block with a flag // DONT_DELETE (for the data block) we create an input CDR @@ -678,14 +678,24 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, // heap. db = qd->msg_block ()->data_block ()->duplicate (); } + db->size (qd->msg_block ()->length ()); #if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 - if (!this->decompress (&db, *qd, rd_pos, wr_pos)) - return -1; + if (qd->state ().compressed ()) + { + if (!this->decompress (&db, *qd, rd_pos, wr_pos)) + return -1; + } #endif + if (TAO_debug_level > 9) + { //due to alignment data block has an offset which needs to be corrected + this->dump_msg ("recv", + reinterpret_cast <u_char *> (db->base () + rd_pos - TAO_GIOP_MESSAGE_HEADER_LEN), + db->size () + rd_pos - TAO_GIOP_MESSAGE_HEADER_LEN); + } - TAO_InputCDR input_cdr (db, - flg, + TAO_InputCDR input_cdr (db, + db->flags (), rd_pos, wr_pos, qd->byte_order (), @@ -693,7 +703,6 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, qd->giop_version ().minor_version (), this->orb_core_); - transport->assign_translators(&input_cdr,&output); // We know we have some request message. Check whether it is a @@ -729,33 +738,22 @@ bool TAO_GIOP_Message_Base::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, size_t& rd_pos, size_t& wr_pos) { - if (qd.state().compressed ()) + TAO_ZIOP_Adapter* adapter = this->orb_core_->ziop_adapter (); + if (adapter) { - TAO_ZIOP_Adapter* adapter = this->orb_core_->ziop_adapter (); - if (adapter) - { - if (!adapter->decompress (db, qd, *this->orb_core_)) - return false; - rd_pos = TAO_GIOP_MESSAGE_HEADER_LEN; - ACE_Data_Block *tmp = *db; - wr_pos = tmp->size(); - if (TAO_debug_level >= 5) - { - ACE_HEX_DUMP ((LM_DEBUG, - const_cast <char*> (tmp->base ()), - tmp->size (), - ACE_TEXT ("GIOP message after decompression"))); - } - } - else - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) ERROR: Unable to decompress ") - ACE_TEXT ("data.\n"))); + if (!adapter->decompress (db, qd, *this->orb_core_)) + return false; + rd_pos = TAO_GIOP_MESSAGE_HEADER_LEN; + wr_pos = (*db)->size(); + } + else + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) ERROR: Unable to decompress ") + ACE_TEXT ("data.\n"))); - return false; - } + return false; } return true; } @@ -775,25 +773,44 @@ TAO_GIOP_Message_Base::process_reply_message ( size_t wr_pos = qd->msg_block ()->wr_ptr () - qd->msg_block ()->base (); rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN; - if (TAO_debug_level >= 5) + ACE_Data_Block *db = 0; + + // Get the flag in the message block + ACE_Message_Block::Message_Flags flg = qd->msg_block ()->self_flags (); + + if (ACE_BIT_ENABLED (flg, ACE_Message_Block::DONT_DELETE)) { - this->dump_msg ("recv", - reinterpret_cast <u_char *> (qd->msg_block ()->rd_ptr ()), - qd->msg_block ()->length ()); + // Use the same datablock + db = qd->msg_block ()->data_block (); } - - ACE_Data_Block *db = qd->msg_block ()->data_block ();; + else + { + // Use a duplicated datablock as the datablock has come off the + // heap. + db = qd->msg_block ()->data_block ()->duplicate (); + } + db->size (qd->msg_block ()->length ()); #if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 - if (!this->decompress (&db, *qd, rd_pos, wr_pos)) - return -1; + if (qd->state ().compressed ()) + { + if (!this->decompress (&db, *qd, rd_pos, wr_pos)) + return -1; + } #endif + if (TAO_debug_level > 9) + { + this->dump_msg ("recv", + reinterpret_cast <u_char *> (db->base () + rd_pos - TAO_GIOP_MESSAGE_HEADER_LEN), + db->size () + rd_pos - TAO_GIOP_MESSAGE_HEADER_LEN); + } + // Create a empty buffer on stack // NOTE: We use the same data block in which we read the message and // we pass it on to the higher layers of the ORB. So we dont to any // copies at all here. TAO_InputCDR input_cdr (db, - ACE_Message_Block::DONT_DELETE, + db->flags (), rd_pos, wr_pos, qd->byte_order (), @@ -840,7 +857,6 @@ TAO_GIOP_Message_Base::process_reply_message ( ACE_TEXT ("dispatch reply failed\n"), params.transport_->id ())); } - return retval; } @@ -1304,7 +1320,7 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) 0, 0, 0, 0 }; - if (TAO_debug_level >= 5) + if (TAO_debug_level > 9) { this->dump_msg ("send_error", reinterpret_cast <const u_char *> (error_message), @@ -1414,7 +1430,7 @@ TAO_GIOP_Message_Base:: // @@ should recv and discard queued data for portability; note // that this won't block (long) since we never set SO_LINGER - if (TAO_debug_level >= 5) + if (TAO_debug_level > 9) { this->dump_msg ("send_close_connection", reinterpret_cast <const u_char *> (close_message), @@ -1507,8 +1523,7 @@ TAO_GIOP_Message_Base::send_reply_exception ( void TAO_GIOP_Message_Base::dump_msg (const char *label, const u_char *ptr, - size_t len, - bool hex_dump_only) + size_t len) { if (TAO_debug_level < 10) { @@ -1536,9 +1551,6 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, // Byte order. int const byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; - ACE_TCHAR message_type[15]; - ACE_OS::sprintf(message_type, ACE_TEXT("%c%c%c%c message"), - ptr[0], ptr[1], ptr[2], ptr[3]); // Get the version info CORBA::Octet const major = ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]; @@ -1578,25 +1590,21 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, } // Print. - if (!hex_dump_only) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - GIOP_Message_Base::dump_msg, ") - ACE_TEXT("%C %s v%c.%c, %d data bytes, %s endian, ") - ACE_TEXT("Type %C[%u]\n"), - label, - message_type, - digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]], - digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]], - len - TAO_GIOP_MESSAGE_HEADER_LEN , - (byte_order == TAO_ENCAP_BYTE_ORDER) ? ACE_TEXT("my") : ACE_TEXT("other"), - message_name, - *id)); - } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - GIOP_Message_Base::dump_msg, ") + ACE_TEXT("%C GIOP message v%c.%c, %d data bytes, %s endian, ") + ACE_TEXT("Type %C[%u]\n"), + label, + digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]], + digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]], + len - TAO_GIOP_MESSAGE_HEADER_LEN , + (byte_order == TAO_ENCAP_BYTE_ORDER) ? ACE_TEXT("my") : ACE_TEXT("other"), + message_name, + *id)); ACE_HEX_DUMP ((LM_DEBUG, (const char *) ptr, len, - message_type)); + ACE_TEXT ("GIOP message"))); } int @@ -1872,7 +1880,7 @@ TAO_GIOP_Message_Base::consolidate_fragmented_message ( return -1; } - const CORBA::ULong request_id = tmp_request_id; + CORBA::ULong const request_id = tmp_request_id; while (this->fragment_stack_.pop (head) != -1) { diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index 9ca13c3bfe1..527be65126c 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -159,6 +159,8 @@ public: private: #if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 /// Decompresses a ZIOP message and turns it into a GIOP message + /// When decompressed, db contains a complete new ACE_Data_Block and + /// therefore qd its data block is alse replaced. bool decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, size_t& rd_pos, size_t& wr_pos); #endif @@ -181,11 +183,11 @@ private: const TAO_GIOP_Message_Version &version) const; /// Print out consolidate messages - int dump_consolidated_msg (TAO_OutputCDR &stream, bool hex_dump_only); + int dump_consolidated_msg (TAO_OutputCDR &stream); /// Print out a debug messages.. void dump_msg (const char *label, const u_char *ptr, - size_t len, bool hex_dump_only = false); + size_t len); /// Writes the GIOP header in to @a msg /// @note If the GIOP header happens to change in the future, we can diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp index 6c7fc8e9285..42919d6b40e 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp @@ -121,10 +121,12 @@ TAO_GIOP_Message_Generator_Parser_12::write_reply_header ( TAO_Pluggable_Reply_Params_Base &reply) { // Write the request ID - output.write_ulong (reply.request_id_); + if (!(output.write_ulong (reply.request_id_))) + return false; // Write the reply status - output.write_ulong (reply.reply_status ()); + if (!(output.write_ulong (reply.reply_status ()))) + return false; if (!(output << reply.service_context_notowned ())) return false; @@ -147,10 +149,12 @@ TAO_GIOP_Message_Generator_Parser_12::write_locate_reply_mesg ( CORBA::ULong request_id, TAO_GIOP_Locate_Status_Msg &status_info) { - output.write_ulong (request_id); + if (!(output.write_ulong (request_id))) + return false; // Make the header for the locate request - output.write_ulong (status_info.status); + if (!(output.write_ulong (status_info.status))) + return false; // Note: We dont align the pointer to an 8 byte boundary for a // locate reply body. This is due to an urgent issue raised by Michi @@ -177,7 +181,7 @@ TAO_GIOP_Message_Generator_Parser_12::write_locate_reply_mesg ( CORBA::Object_ptr object_ptr = status_info.forward_location_var.in (); - if ( ! (output << object_ptr)) + if (!(output << object_ptr)) { if (TAO_debug_level > 0) { diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp index 6826fef374a..288a224bb88 100644 --- a/TAO/tao/GIOP_Message_State.cpp +++ b/TAO/tao/GIOP_Message_State.cpp @@ -180,10 +180,7 @@ TAO_GIOP_Message_State::get_byte_order_info (char *buf) this->more_fragments_ = ((buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET]& 0x02) == 2); -#if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 - // Read the compressed flag this->compressed_ = (buf[0] == 0x5A); -#endif } return 0; diff --git a/TAO/tao/GIOP_Message_State.h b/TAO/tao/GIOP_Message_State.h index 5815b1b0afe..5e631805c18 100644 --- a/TAO/tao/GIOP_Message_State.h +++ b/TAO/tao/GIOP_Message_State.h @@ -72,10 +72,8 @@ public: /// Get the GIOP version TAO_GIOP_Message_Version const &giop_version (void) const; -#if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 /// Return the compressed information CORBA::Boolean compressed (void) const; -#endif private: /// Parse the message header. @@ -121,10 +119,8 @@ private: /// fragments. CORBA::Boolean more_fragments_; -#if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 /// Compressed CORBA::Boolean compressed_; -#endif }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/GIOP_Message_State.inl b/TAO/tao/GIOP_Message_State.inl index bec93790aad..3298ee8d319 100644 --- a/TAO/tao/GIOP_Message_State.inl +++ b/TAO/tao/GIOP_Message_State.inl @@ -11,10 +11,8 @@ TAO_GIOP_Message_State::TAO_GIOP_Message_State (void) byte_order_ (0), message_type_ (GIOP::Request), payload_size_ (0), - more_fragments_ (false) -#if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP ==1 - , compressed_ (false) -#endif + more_fragments_ (false), + compressed_ (false) { } diff --git a/TAO/tao/Generic_Sequence_T.h b/TAO/tao/Generic_Sequence_T.h index 34b817b12ba..c29dcf9ee22 100644 --- a/TAO/tao/Generic_Sequence_T.h +++ b/TAO/tao/Generic_Sequence_T.h @@ -68,11 +68,38 @@ namespace TAO namespace details { +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +// Forward declare the iterators +template<typename T> +class Generic_Sequence_Iterator; + +template<typename T> +class Const_Generic_Sequence_Iterator; + +template<typename T> +class Generic_Sequence_Reverse_Iterator; + +template<typename T> +class Const_Generic_Sequence_Reverse_Iterator; + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + template<typename T, class ALLOCATION_TRAITS, class ELEMENT_TRAITS> class generic_sequence { + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + friend class Generic_Sequence_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> >; + friend class Const_Generic_Sequence_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> >; + friend class Generic_Sequence_Reverse_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> >; + friend class Const_Generic_Sequence_Reverse_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> >; + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + public: typedef T value_type; typedef ALLOCATION_TRAITS allocation_traits; @@ -116,10 +143,17 @@ public: , buffer_(0) , release_(false) { - if (rhs.maximum_ == 0) return; + if (rhs.maximum_ == 0 || rhs.buffer_ == 0) + { + maximum_ = rhs.maximum_; + length_ = rhs.length_; + return; + } generic_sequence tmp(rhs.maximum_, rhs.length_, allocation_traits::allocbuf_noinit(rhs.maximum_), true); + element_traits::initialize_range( + tmp.buffer_ + tmp.length_, tmp.buffer_ + tmp.maximum_); element_traits::copy_range( rhs.buffer_, rhs.buffer_ + rhs.length_, @@ -177,7 +211,9 @@ public: return; } - if (length < length_) + // When sequence doesn't own a buffer it's not allowed + // to change it in any way. + if (length < length_ && release_) { // TODO This code does not provide the strong-exception // guarantee, but it does provide the weak-exception @@ -198,12 +234,14 @@ public: generic_sequence tmp(length, length, allocation_traits::allocbuf_noinit(length), true); + // First do initialize_range. If it will throw then tmp will be + // destructed but *this will remain unchanged. + element_traits::initialize_range( + tmp.buffer_ + length_, tmp.buffer_ + length); element_traits::copy_swap_range( buffer_, buffer_ + length_, ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_)); - element_traits::initialize_range( - tmp.buffer_ + length_, tmp.buffer_ + length); swap(tmp); } @@ -325,6 +363,80 @@ public: allocation_traits::freebuf(buffer); } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO sequences. + /// + + // = Traits and factory methods that create iterators. + typedef Generic_Sequence_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> > iterator; + typedef Const_Generic_Sequence_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> > const_iterator; + typedef Generic_Sequence_Reverse_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> > reverse_iterator; + typedef Const_Generic_Sequence_Reverse_Iterator<generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + iterator begin (void) + { + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::iterator (this); + } + + // Get a const iterator that points to the beginning of the sequence. + const_iterator begin (void) const + { + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::const_iterator (this); + } + + // Get an iterator that points to the end of the sequence. + iterator end (void) + { + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::iterator (this, + this->length_); + } + + // Get a const iterator that points to the end of the sequence. + const_iterator end (void) const + { + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::const_iterator (this, + this->length_); + } + + // Get a reverse iterator that points to the end of the sequence. + reverse_iterator rbegin (void) + { + // Here we need to be at the last element - not one past. + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::reverse_iterator (this, + this->length_ - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + const_reverse_iterator rbegin (void) const + { + // Here we need to be at the last element - not one past. + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::const_reverse_iterator (this, + this->length_ - 1); + } + + // Get a reverse iterator that points to one before the + // beginning of the sequence. + reverse_iterator rend (void) + { + // Here we need to be at one before the first element - not the first. + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::reverse_iterator (this, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + const_reverse_iterator rend (void) const + { + // Here we need to be at one before the first element - not the first. + return typename generic_sequence<T, ALLOCATION_TRAITS, ELEMENT_TRAITS>::const_reverse_iterator (this, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: /// The maximum number of elements the buffer can contain. CORBA::ULong maximum_; @@ -337,6 +449,890 @@ private: mutable CORBA::Boolean release_; }; +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +/** + * @class Generic_Sequence_Iterator + * @brief Implements a random access iterator for generic sequence type + * classes. + */ +template <typename SEQUENCE_T> + class Generic_Sequence_Iterator +{ + friend class Const_Generic_Sequence_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef CORBA::Long difference_type; + + /// Construct a Generic_Sequence_Iterator at position pos. + Generic_Sequence_Iterator (generic_sequence<value_type, + allocation_traits, + element_traits> *sequence, + size_t pos = 0) + : sequence_ (sequence), + pos_ (pos) + { + } + + /// Copy constructor + Generic_Sequence_Iterator (Generic_Sequence_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + Generic_Sequence_Iterator & operator= ( + Generic_Sequence_Iterator<SEQUENCE_T> const & rhs) + { + Generic_Sequence_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(Generic_Sequence_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// typecast operator to Const_Generic_Sequence_Iterator + operator Const_Generic_Sequence_Iterator<SEQUENCE_T> () + { + return Const_Generic_Sequence_Iterator<SEQUENCE_T> (*this); + } + + /// Dereference operator returns a reference to the item contained + /// at the current position + value_type & operator* (void) + { + // Access the underlying element in the sequence. + return (*(this->sequence_))[this->pos_]; + } + + /// Returns a const reference to the item contained at the current position + const value_type & operator* (void) const + { + // Access the underlying element in the sequence. + return (*(this->sequence_))[this->pos_]; + } + + /// Preincrement operator + Generic_Sequence_Iterator<SEQUENCE_T> &operator++ (void) + { + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return *this; + } + + /// Postincrement operator + Generic_Sequence_Iterator<SEQUENCE_T> operator++ (int) + { + // Create a temporary to return so that it's not modified. + Generic_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return temp_iter; + } + + /// Predecrement operator + Generic_Sequence_Iterator<SEQUENCE_T> &operator-- (void) + { + --this->pos_; + return *this; + } + + /// Postdecrement operator + Generic_Sequence_Iterator<SEQUENCE_T> operator-- (int) + { + // Create a temporary to return so that it's not modified. + Generic_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + --this->pos_; + return temp_iter; + } + + /// Iterator addition + Generic_Sequence_Iterator<SEQUENCE_T> &operator+= (difference_type n) + { + // Move ahead n elements. + this->pos_ += n; + return *this; + } + + /// Iterator addition + Generic_Sequence_Iterator<SEQUENCE_T> operator+ (difference_type n) + { + // Create a temporary to return and move it ahead n elements. + return Generic_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Iterator subtraction + Generic_Sequence_Iterator<SEQUENCE_T> &operator-= (difference_type n) + { + // Move back n elements. + this->pos_ -= n; + return *this; + } + + /// Iterator subtraction + Generic_Sequence_Iterator<SEQUENCE_T> operator- (difference_type n) + { + // Create a temporary to return and move it back n elements. + return Generic_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Difference + difference_type operator- (const Generic_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., rhs before this). + return this->pos_ - rhs.pos_; + } + + /// Difference + difference_type operator- (const Const_Generic_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., rhs before this). + return this->pos_ - rhs.pos_; + } + + + /// Element operator/assignment + value_type & operator[] (difference_type n) + { + // Return the element at position n + return (*(this->sequence_))[this->pos_ + n]; + } + + /// Less than + bool operator< (const Generic_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + return this->pos_ < rhs.pos_; + } + + /// Less than + bool operator< (const Const_Generic_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + return this->pos_ < rhs.pos_; + } + + + /// Equality operator + bool operator== (const Generic_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const Generic_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// the sequence with which we are dealing + generic_sequence<value_type, allocation_traits, element_traits> *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + Generic_Sequence_Iterator<SEQUENCE_T> + operator+ (typename Generic_Sequence_Iterator<SEQUENCE_T>::difference_type n, + const Generic_Sequence_Iterator<SEQUENCE_T> & iter) + { + // Create an iter and move it ahead n elements. + return Generic_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + Generic_Sequence_Iterator<SEQUENCE_T> operator- + (typename Generic_Sequence_Iterator<SEQUENCE_T>::difference_type n, + Generic_Sequence_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements. + return Generic_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + + +/** + * @class Const_Generic_Sequence_Iterator + * @brief Implements a constant random access iterator for generic sequence + * type classes. + * + * Note: Having a const Iterator does not guarantee that the current + * *position* that it points to will not change, it only guarantees that + * you cannot change the underlying array! + */ +template <typename SEQUENCE_T> +class Const_Generic_Sequence_Iterator +{ + friend class Generic_Sequence_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef int difference_type; + + /// Construct a Const_Generic_Sequence_Iterator at position pos from + /// a const sequence. + Const_Generic_Sequence_Iterator (const generic_sequence<value_type, + allocation_traits, + element_traits> *sequence, + size_t pos = 0) + : sequence_ (sequence), + pos_ (pos) + { + } + + virtual ~Const_Generic_Sequence_Iterator () + { + } + + /// Copy constructor + Const_Generic_Sequence_Iterator ( + Const_Generic_Sequence_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Copy constructor initializing by a Generic_Sequence_Iterator + explicit Const_Generic_Sequence_Iterator ( + Generic_Sequence_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + Const_Generic_Sequence_Iterator & operator= ( + Const_Generic_Sequence_Iterator<SEQUENCE_T> const & rhs) + { + Const_Generic_Sequence_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(Const_Generic_Sequence_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// Dereference operator returns a reference to the item contained + /// at the current position + const value_type & operator* (void) const + { + // Access the underlying element in the sequence. + return (*(this->sequence_))[this->pos_]; + } + + /// Preincrement operator + const Const_Generic_Sequence_Iterator<SEQUENCE_T> &operator++ (void) const + { + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return * this; + } + + /// Postincrement operator + Const_Generic_Sequence_Iterator<SEQUENCE_T> operator++ (int) const + { + // Create a temporary to return so that it's not modified. + Const_Generic_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return temp_iter; + } + + /// Predecrement operator + const Const_Generic_Sequence_Iterator<SEQUENCE_T> &operator-- (void) const + { + --this->pos_; + return * this; + } + + /// Postdecrement operator + Const_Generic_Sequence_Iterator<SEQUENCE_T> operator-- (int) const + { + // Create a temporary to return so that it's not modified. + Const_Generic_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + --this->pos_; + return temp_iter; + } + + /// Iterator addition + const Const_Generic_Sequence_Iterator<SEQUENCE_T> &operator+= (difference_type n) const + { + // Move ahead n elements. + this->pos_ += n; + return * this; + } + + /// Iterator addition + Const_Generic_Sequence_Iterator<SEQUENCE_T> operator+ (difference_type n) const + { + // Create a temporary to return and move it ahead n elements. + return Const_Generic_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Iterator subtraction + const Const_Generic_Sequence_Iterator<SEQUENCE_T> &operator-= (difference_type n) const + { + // Move back n elements. + this->pos_ -= n; + return * this; + } + + /// Iterator subtraction + Const_Generic_Sequence_Iterator<SEQUENCE_T> operator- (difference_type n) const + { + // Create a temporary to return and move it back n elements. + return Const_Generic_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Difference + difference_type operator- (const Const_Generic_Sequence_Iterator<SEQUENCE_T> & rhs) const + { + // I think the order is important here (i.e., rhs before this). + return this->pos_ - rhs.pos_; + } + + /// Element operator/assignment + const value_type & operator[] (difference_type n) const + { + // Return the element at position n + return (*(this->sequence_))[this->pos_ + n]; + } + + /// Less than + virtual bool operator< (const Const_Generic_Sequence_Iterator<SEQUENCE_T> & rhs) const + { + // Return if this iterator is less than the passed in iterator. + return this->pos_ < rhs.pos_; + } + + /// Equality operator + bool operator== (const Const_Generic_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const Const_Generic_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// the array we are dealing with + const generic_sequence<value_type, allocation_traits, element_traits> *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_Generic_Sequence_Iterator<SEQUENCE_T> operator+ + (typename Generic_Sequence_Iterator<SEQUENCE_T>::difference_type n, + Const_Generic_Sequence_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it ahead n elements. + return Const_Generic_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_Generic_Sequence_Iterator<SEQUENCE_T> operator- + (typename Generic_Sequence_Iterator<SEQUENCE_T>::difference_type n, + Const_Generic_Sequence_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements. + return Const_Generic_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + + +/** + * @class Generic_Sequence_Reverse_Iterator + * @brief Implements a reverse random access iterator for generic sequence + * type classes. + */ +template <typename SEQUENCE_T> +class Generic_Sequence_Reverse_Iterator +{ + friend class Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef int difference_type; + + /// Construct a Generic_Sequence_Reverse_Iterator at position pos with before_start flag. + Generic_Sequence_Reverse_Iterator (generic_sequence<value_type, + allocation_traits, + element_traits> *sequence, + size_t pos) + : sequence_ (sequence), + pos_ (pos) + { + } + + /// Copy constructor + Generic_Sequence_Reverse_Iterator ( + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + Generic_Sequence_Reverse_Iterator & operator= ( + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + { + Generic_Sequence_Reverse_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// Dereference operator returns a reference to the item contained + /// at the current position + value_type & operator* (void) + { + // Access the underlying element in the sequence. + return (*(this->sequence_))[this->pos_]; + } + + /// Returns a const reference to the item contained at the current position + const value_type& operator* (void) const + { + // Access the underlying element in the sequence. + return (*(this->sequence_))[this->pos_]; + } + + /// Preincrement operator + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator++ (void) + { + // Decrement the position for reverse iterators. + // We also need to check if we're now before the start. + --this->pos_; + return *this; + } + + /// Postincrement operator + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator++ (int) + { + // Create a temporary to return so that it's not modified. + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Decrement the position for reverse iterators. + // We also need to check if we're now past the end. + --this->pos_; + return temp_iter; + } + + /// Predecrement operator + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-- (void) + { + // Increment the position for reverse iterators. + ++this->pos_; + return *this; + } + + /// Postdecrement operator + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator-- (int) + { + // Create a temporary to return so that it's not modified. + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position for reverse iterators. + ++this->pos_; + return temp_iter; + } + + /// Iterator addition + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator+= (difference_type n) + { + // Move back n elements for reverse iterators. + this->pos_ -= n; + return *this; + } + + /// Iterator addition + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ (difference_type n) + { + // Create a temporary to return and move it back n elements for + // reverse iterators. + return Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Iterator subtraction + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-= (difference_type n) + { + // Move ahead n elements for reverse iterators. + this->pos_ += n; + return *this; + } + + /// Iterator subtraction + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator- (difference_type n) + { + // Create a temporary to return and move it ahead n elements for + // reverse iterators. + return Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Difference + difference_type operator- (const Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., rhs before this). + return rhs.pos_ - this->pos_; + } + + /// Difference + difference_type operator- (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., rhs before this). + return rhs.pos_ - this->pos_; + } + + + /// Element operator/assignment + value_type & operator[] (difference_type n) + { + // Return the element at position n + return (*(this->sequence_))[this->pos_ - n]; + } + + /// Less than + bool operator< (const Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + // For reverse iterators reverse the logic. + return this->pos_ > rhs.pos_; + } + + /// Less than + bool operator< (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + // For reverse iterators reverse the logic. + return this->pos_ > rhs.pos_; + } + + + /// Equality operator + bool operator== (const Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Equality operator + bool operator== (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + + /// Nonequality operator + bool operator!= (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// The sequence with which we are dealing + generic_sequence<value_type, allocation_traits, element_traits> *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ + (typename Generic_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements for reverse iterators. + return Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator- + (typename Generic_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it ahead n elements for reverse iterators. + return Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + + +/** + * @class Const_Generic_Sequence_Reverse_Iterator + * @brief Implements a constant reverse random access iterator for generic + * sequence type classes. + * + * Note: Having a const Iterator does not guarantee that the current + * *position* that it points to will not change, it only guarantees that + * you cannot change the underlying array! + */ +template <typename SEQUENCE_T> +class Const_Generic_Sequence_Reverse_Iterator +{ + friend class Generic_Sequence_Reverse_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef int difference_type; + + /// Construct a Const_Generic_Sequence_Reverse_Iterator at position pos + /// using a const sequence. + Const_Generic_Sequence_Reverse_Iterator (const generic_sequence<value_type, + allocation_traits, + element_traits> *sequence, + size_t pos) + : sequence_ (sequence), + pos_ (pos) + { + } + + /// Copy constructor + Const_Generic_Sequence_Reverse_Iterator ( + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Copy constructor + Const_Generic_Sequence_Reverse_Iterator ( + Generic_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + Const_Generic_Sequence_Reverse_Iterator & operator= ( + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + { + Const_Generic_Sequence_Reverse_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// typecast operator to Generic_Sequence_Reverse_Iterator + + /// Dereference operator returns a reference to the item contained + /// at the current position + const value_type& operator* (void) const + { + // Access the underlying element in the sequence. + return (*this->sequence_)[this->pos_]; + } + + /// Preincrement operator + const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator++ (void) const + { + // Decrement the position for reveres iterators. + // We also need to check if we're now before the start. + --this->pos_; + return *this; + } + + /// Postincrement operator + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator++ (int) const + { + // Create a temporary to return so that it's not modified. + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Decrement the position for reverse iterators. + // We also need to check if we're now before the start. + --this->pos_; + return temp_iter; + } + + /// Predecrement operator + const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-- (void) const + { + // Increment the position for reverse iterators. + ++this->pos_; + return *this; + } + + /// Postdecrement operator + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator-- (int) const + { + // Create a temporary to return so that it's not modified. + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position for reverse iterators. + ++this->pos_; + return temp_iter; + } + + /// Iterator addition + const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator+= (difference_type n) const + { + // Move back n elements for reverse iterators. + this->pos_ -= n; + return *this; + } + + /// Iterator addition + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ (difference_type n) const + { + // Create a temporary to return and move it back n elements for + // reverse iterators. + return Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Iterator subtraction + const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-= (difference_type n) const + { + // Move ahead n elements for reverse iterators. + this->pos_ += n; + return *this; + } + + /// Iterator subtraction + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator- (difference_type n) const + { + // Create a temporary to return and move it ahead n elements for + // reverse iterators. + return Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Difference + difference_type operator- (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) const + { + // I think order is important here (i.e., rhs before this). + return rhs.pos_ - this->pos_; + } + + /// Element operator/assignment + const value_type & operator[] (difference_type n) const + { + // Return the element at position n + return (*(this->sequence_))[this->pos_ - n]; + } + + /// Less than + bool operator< (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) const + { + // Return if this iterator is less than the passed in iterator. + // For reverse iterators reverse the logic. + return this->pos_ > rhs.pos_; + } + + /// Equality operator + bool operator== (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// the array we are dealing with + const generic_sequence<value_type, allocation_traits, element_traits> *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ + (typename Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements for reverse iterators. + return Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> operator- + (typename Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it ahead n elements for reverse iterators. + return Const_Generic_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + } // namespace details } // namespace TAO diff --git a/TAO/tao/IFR_Client.mpc b/TAO/tao/IFR_Client.mpc index 876c157ebaf..c56e937ce7e 100644 --- a/TAO/tao/IFR_Client.mpc +++ b/TAO/tao/IFR_Client.mpc @@ -1,5 +1,21 @@ //$Id$ -project(IFR_Client) : taolib, tao_output, install, core_anytypecode, tao_versioning_idl_defaults { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -SS -GX \ + -Wb,stub_export_macro=TAO_IFR_Client_Export \ + -Wb,stub_export_include=tao/IFR_Client/ifr_client_export.h \ + -o IFR_Client + idlflags -= -Sa -St + IFR_Client/IFR_Base.pidl + IFR_Client/IFR_Basic.pidl + IFR_Client/IFR_Components.pidl + IFR_Client/IFR_Extended.pidl + } +} + +project(IFR_Client) : taolib, tao_output, install, anytypecode, taoidldefaults { + after += *idl sharedname = TAO_IFR_Client dynamicflags = TAO_IFR_CLIENT_BUILD_DLL @@ -7,6 +23,13 @@ project(IFR_Client) : taolib, tao_output, install, core_anytypecode, tao_version IFR_Client } + Source_Files { + IFR_Client/IFR_BaseC.cpp + IFR_Client/IFR_BasicC.cpp + IFR_Client/IFR_ComponentsC.cpp + IFR_Client/IFR_ExtendedC.cpp + } + Header_Files { IFR_Client } @@ -28,15 +51,6 @@ project(IFR_Client) : taolib, tao_output, install, core_anytypecode, tao_version } IDL_Files { - idlflags += -SS -GX \ - -Wb,stub_export_macro=TAO_IFR_Client_Export \ - -Wb,stub_export_include=tao/IFR_Client/ifr_client_export.h \ - -o IFR_Client - idlflags -= -Sa -St - IFR_Client/IFR_Base.pidl - IFR_Client/IFR_Basic.pidl - IFR_Client/IFR_Components.pidl - IFR_Client/IFR_Extended.pidl } Pkgconfig_Files { diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index 36119813bba..2cdceb4f300 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -213,6 +213,10 @@ protected: CORBA::Short priority); //@@ TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_END +private: + void operator= (const TAO_IIOP_Acceptor &); + TAO_IIOP_Acceptor (const TAO_IIOP_Acceptor &); + //@@ TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_START protected: diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 477ef3e9443..9af59831d91 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -412,6 +412,9 @@ namespace private: TAO_Transport** tlist_; + private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const TList_Holder &)) + ACE_UNIMPLEMENTED_FUNC (TList_Holder (const TList_Holder &)) }; } diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp index e181620a8e9..dca3bace0b9 100644 --- a/TAO/tao/IIOP_Endpoint.cpp +++ b/TAO/tao/IIOP_Endpoint.cpp @@ -112,16 +112,19 @@ TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host, TAO_IIOP_Endpoint & TAO_IIOP_Endpoint::operator= (const TAO_IIOP_Endpoint &other) { - this->host_ = other.host_; - this->port_ = other.port_; + if (this != &other) + { + this->host_ = other.host_; + this->port_ = other.port_; #if defined (ACE_HAS_IPV6) - this->is_ipv6_decimal_ = other.is_ipv6_decimal_; + this->is_ipv6_decimal_ = other.is_ipv6_decimal_; #endif /* ACE_HAS_IPV6 */ - this->is_encodable_ = other.is_encodable_; - this->object_addr_set_ = other.object_addr_set_; - this->object_addr_ = other.object_addr_; - this->preferred_path_ = other.preferred_path_; - this->next_ = 0; // do not copy list membership, since we are only cloning the values + this->is_encodable_ = other.is_encodable_; + this->object_addr_set_ = other.object_addr_set_; + this->object_addr_ = other.object_addr_; + this->preferred_path_ = other.preferred_path_; + this->next_ = 0; // do not copy list membership, since we are only cloning the values + } return *this; } diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index d034d12372e..1d096a191fb 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -578,7 +578,6 @@ TAO_IIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const #endif /* ACE_HAS_IPV6 */ encap.write_string (this->endpoint_.host ()); - // UNSIGNED SHORT port number encap.write_ushort (this->endpoint_.port ()); @@ -592,8 +591,7 @@ TAO_IIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const "no object key marshalled\n")); } - if (this->version_.major > 1 - || this->version_.minor > 0) + if (this->version_.major > 1 || this->version_.minor > 0) this->tagged_components ().encode (encap); } @@ -631,17 +629,17 @@ TAO_IIOP_Profile::encode_alternate_endpoints (void) ACE_CString tmp; size_t len = pos - host; tmp.set (endpoint->host (), len, 1); - if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (out_cdr << tmp.c_str () == 0) - || (out_cdr << endpoint->port () == 0)) + if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(out_cdr << tmp.c_str ()) + || !(out_cdr << endpoint->port ())) return -1; out_cdr.write_string (len, endpoint->host ()); } else #endif /* ACE_HAS_IPV6 */ - if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (out_cdr << endpoint->host () == 0) - || (out_cdr << endpoint->port () == 0)) + if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(out_cdr << endpoint->host ()) + || !(out_cdr << endpoint->port ())) return -1; IOP::TaggedComponent tagged_component; @@ -732,9 +730,8 @@ TAO_IIOP_Profile::encode_endpoints (void) // Encode the data structure. TAO_OutputCDR out_cdr; - if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) - == 0) - || (out_cdr << endpoints) == 0) + if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(out_cdr << endpoints)) return -1; this->set_tagged_components (out_cdr); @@ -759,14 +756,14 @@ TAO_IIOP_Profile::decode_endpoints (void) // Extract the Byte Order. CORBA::Boolean byte_order; - if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order))) return -1; in_cdr.reset_byte_order (static_cast<int> (byte_order)); // Extract endpoints sequence. TAO::IIOPEndpointSequence endpoints; - if ((in_cdr >> endpoints) == 0) + if (!(in_cdr >> endpoints)) return -1; // Get the priority of the first endpoint (head of the list. @@ -811,7 +808,7 @@ TAO_IIOP_Profile::decode_endpoints (void) // Extract the Byte Order. CORBA::Boolean byte_order; - if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order))) return -1; in_cdr.reset_byte_order (static_cast<int>(byte_order)); @@ -819,8 +816,7 @@ TAO_IIOP_Profile::decode_endpoints (void) CORBA::String_var host; CORBA::Short port; - if ((in_cdr >> host.out()) == 0 || - (in_cdr >> port) == 0) + if (!(in_cdr >> host.out()) || !(in_cdr >> port)) return -1; TAO_IIOP_Endpoint *endpoint = 0; diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index fb5912c5528..79f184cf52b 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -258,39 +258,10 @@ TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream, } int -TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) -{ - // Check whether we have a Bi Dir IIOP policy set, whether the - // messaging objects are ready to handle bidirectional connections - // and also make sure that we have not recd. or sent any information - // regarding this before... - if (this->orb_core ()->bidir_giop_policy () && - this->messaging_object ()->is_ready_for_bidirectional (msg) && - this->bidirectional_flag () < 0) - { - this->set_bidir_context_info (opdetails); - - // Set the flag to 1 (i.e., originating side) - this->bidirectional_flag (1); - - // At the moment we enable BiDIR giop we have to get a new - // request id to make sure that we follow the even/odd rule - // for request id's. We only need to do this when enabled - // it, after that the Transport Mux Strategy will make sure - // that the rule is followed - opdetails.request_id (this->tms ()->request_id ()); - } - - return TAO_Transport::generate_request_header (opdetails, spec, msg); -} - -int TAO_IIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr) { CORBA::Boolean byte_order; - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) return -1; cdr.reset_byte_order (static_cast<int> (byte_order)); @@ -322,7 +293,7 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) ++acceptor) { // Check whether it is an IIOP acceptor - if ((*acceptor)->tag () == IOP::TAG_INTERNET_IOP) + if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) { @@ -352,8 +323,8 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) TAO_OutputCDR cdr; // Marshal the information into the stream - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << listen_point_list) == 0) + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || (!(cdr << listen_point_list))) return; // Add this info in to the svc_list @@ -433,7 +404,7 @@ TAO_IIOP_Transport::get_listen_point ( #endif /* ACE_HAS_IPV6 */ // Get the count of the number of elements - const CORBA::ULong len = listen_point_list.length (); + CORBA::ULong const len = listen_point_list.length (); // Increase the length by 1 listen_point_list.length (len + 1); @@ -447,7 +418,7 @@ TAO_IIOP_Transport::get_listen_point ( if (TAO_debug_level >= 5) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - Listen_Point_List[%d] = <%s:%d>\n"), + ACE_TEXT("TAO (%P|%t) - Listen_Point_List[%d] = <%C:%d>\n"), len, point.host.in (), point.port)); diff --git a/TAO/tao/IIOP_Transport.h b/TAO/tao/IIOP_Transport.h index 7669ee38584..65147cc9557 100644 --- a/TAO/tao/IIOP_Transport.h +++ b/TAO/tao/IIOP_Transport.h @@ -112,10 +112,6 @@ public: TAO_Message_Semantics message_semantics = TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait = 0); - virtual int generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg); - virtual int tear_listen_point_list (TAO_InputCDR &cdr); virtual TAO_Connection_Handler * connection_handler_i (void); diff --git a/TAO/tao/IORInterceptor.mpc b/TAO/tao/IORInterceptor.mpc index 016b30f6e7c..11de75651b0 100644 --- a/TAO/tao/IORInterceptor.mpc +++ b/TAO/tao/IORInterceptor.mpc @@ -1,12 +1,39 @@ //$Id$ -project(IORInterceptor) : taolib, tao_output, portableserver, objreftemplate, pi, install, tao_versioning_idl_defaults { - sharedname = TAO_IORInterceptor - dynamicflags = TAO_IORINTERCEPTOR_BUILD_DLL +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb -Sa -St \ + -Wb,export_macro=TAO_IORInterceptor_Export \ + -Wb,export_include=tao/IORInterceptor/iorinterceptor_export.h \ + -Wb,include_guard=TAO_IORINTERCEPTOR_SAFE_INCLUDE \ + -Wb,safe_include=tao/IORInterceptor/IORInterceptor.h \ + -o IORInterceptor + IORInterceptor/IORInterceptor.pidl + } + + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb -Sa -St \ + -Wb,export_macro=TAO_IORInterceptor_Export \ + -Wb,export_include=tao/IORInterceptor/iorinterceptor_export.h \ + -o IORInterceptor + IORInterceptor/IORInfo.pidl + } +} + +project(IORInterceptor) : taolib, tao_output, portableserver, objreftemplate, pi, install, taoidldefaults { + after += *idl + sharedname = TAO_IORInterceptor + dynamicflags = TAO_IORINTERCEPTOR_BUILD_DLL Source_Files { IORInterceptor } + Source_Files { + IORInterceptor/IORInterceptorC.cpp + IORInterceptor/IORInfoC.cpp + } + Header_Files { IORInterceptor } @@ -28,21 +55,6 @@ project(IORInterceptor) : taolib, tao_output, portableserver, objreftemplate, pi } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb -Sa -St \ - -Wb,export_macro=TAO_IORInterceptor_Export \ - -Wb,export_include=tao/IORInterceptor/iorinterceptor_export.h \ - -Wb,include_guard=TAO_IORINTERCEPTOR_SAFE_INCLUDE \ - -Wb,safe_include=tao/IORInterceptor/IORInterceptor.h \ - -o IORInterceptor - IORInterceptor/IORInterceptor.pidl - } - - IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb -Sa -St \ - -Wb,export_macro=TAO_IORInterceptor_Export \ - -Wb,export_include=tao/IORInterceptor/iorinterceptor_export.h \ - -o IORInterceptor - IORInterceptor/IORInfo.pidl } Pkgconfig_Files { diff --git a/TAO/tao/IORManipulation.mpc b/TAO/tao/IORManipulation.mpc index dfa45815fd1..ed36ba4b8ed 100644 --- a/TAO/tao/IORManipulation.mpc +++ b/TAO/tao/IORManipulation.mpc @@ -1,6 +1,20 @@ //$Id$ +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb -GX \ + -Wb,export_macro=TAO_IORManip_Export \ + -Wb,export_include=tao/IORManipulation/ior_manip_export.h \ + -Wb,include_guard=TAO_IORMANIP_SAFE_INCLUDE \ + -Wb,safe_include=tao/IORManipulation/IORManip_Loader.h \ + -o IORManipulation + idlflags -= -Sa -St + IORManipulation/IOR.pidl + } +} -project(IORManipulation) : taolib, tao_output, install, core_anytypecode, tao_versioning_idl_defaults { +project(IORManipulation) : taolib, tao_output, install, anytypecode, taoidldefaults { + after += *idl sharedname = TAO_IORManip dynamicflags = TAO_IORMANIP_BUILD_DLL @@ -8,6 +22,10 @@ project(IORManipulation) : taolib, tao_output, install, core_anytypecode, tao_ve IORManipulation } + Source_Files { + IORManipulation/IORC.cpp + } + Header_Files { IORManipulation } @@ -29,14 +47,6 @@ project(IORManipulation) : taolib, tao_output, install, core_anytypecode, tao_ve } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb -GX \ - -Wb,export_macro=TAO_IORManip_Export \ - -Wb,export_include=tao/IORManipulation/ior_manip_export.h \ - -Wb,include_guard=TAO_IORMANIP_SAFE_INCLUDE \ - -Wb,safe_include=tao/IORManipulation/IORManip_Loader.h \ - -o IORManipulation - idlflags -= -Sa -St - IORManipulation/IOR.pidl } Pkgconfig_Files { diff --git a/TAO/tao/IORManipulation/IORManip_IIOP_Filter.cpp b/TAO/tao/IORManipulation/IORManip_IIOP_Filter.cpp index e75ceca9d99..211e85c6a6e 100644 --- a/TAO/tao/IORManipulation/IORManip_IIOP_Filter.cpp +++ b/TAO/tao/IORManipulation/IORManip_IIOP_Filter.cpp @@ -208,12 +208,13 @@ TAO_IORManip_IIOP_Filter::get_endpoints (TAO_Profile* profile, // Extract the Byte Order. CORBA::Boolean byte_order; - if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order))) return 0; + in_cdr.reset_byte_order (static_cast<int> (byte_order)); // Extract endpoints sequence. - if ((in_cdr >> endpoints) == 0) + if (!(in_cdr >> endpoints)) return 0; return 1; diff --git a/TAO/tao/IORTable.mpc b/TAO/tao/IORTable.mpc index 289319fa00c..5156abcdf4b 100644 --- a/TAO/tao/IORTable.mpc +++ b/TAO/tao/IORTable.mpc @@ -1,6 +1,19 @@ //$Id$ +project(*core_idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb \ + -Wb,export_macro=TAO_IORTable_Export \ + -Wb,export_include=tao/IORTable/iortable_export.h \ + -Wb,include_guard=TAO_IORTABLE_SAFE_INCLUDE \ + -Wb,safe_include=tao/IORTable/IORTable.h \ + -o IORTable + IORTable/IORTable.pidl + } +} -project(IORTable) : taolib, tao_output, install, tao_versioning_idl_defaults { +project(IORTable) : taolib, tao_output, install, taoidldefaults { + after += *core_idl sharedname = TAO_IORTable dynamicflags = TAO_IORTABLE_BUILD_DLL @@ -8,6 +21,10 @@ project(IORTable) : taolib, tao_output, install, tao_versioning_idl_defaults { IORTable } + Source_Files { + IORTable/IORTableC.cpp + } + Header_Files { IORTable } @@ -29,13 +46,7 @@ project(IORTable) : taolib, tao_output, install, tao_versioning_idl_defaults { } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb \ - -Wb,export_macro=TAO_IORTable_Export \ - -Wb,export_include=tao/IORTable/iortable_export.h \ - -Wb,include_guard=TAO_IORTABLE_SAFE_INCLUDE \ - -Wb,safe_include=tao/IORTable/IORTable.h \ - -o IORTable - IORTable/IORTable.pidl + IORTable } Pkgconfig_Files { diff --git a/TAO/tao/ImR_Client.mpc b/TAO/tao/ImR_Client.mpc index 41eb3863003..b4a480b0ea4 100644 --- a/TAO/tao/ImR_Client.mpc +++ b/TAO/tao/ImR_Client.mpc @@ -1,5 +1,27 @@ //$Id$ -project(ImR_Client) : taolib, tao_output, install, portableserver, tao_versioning_idl_defaults { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Ssi -Gd -Sorb -GA \ + -Wb,export_macro=TAO_IMR_Client_Export \ + -Wb,export_include=tao/ImR_Client/imr_client_export.h \ + -o ImR_Client + idlflags -= -Sa -St + ImR_Client/ServerObject.pidl + } + + IDL_Files { + idlflags += -Gp -Ssi -Gd -Sorb -GX \ + -Wb,export_macro=TAO_IMR_Client_Export \ + -Wb,export_include=tao/ImR_Client/imr_client_export.h \ + -o ImR_Client + idlflags -= -Sa -St + ImR_Client/ImplRepo.pidl + } +} + +project(ImR_Client) : taolib, tao_output, install, portableserver, taoidldefaults { + after += *idl sharedname = TAO_ImR_Client dynamicflags = TAO_IMR_CLIENT_BUILD_DLL @@ -7,6 +29,14 @@ project(ImR_Client) : taolib, tao_output, install, portableserver, tao_versionin ImR_Client } + Source_Files { + ImR_Client/ServerObjectC.cpp + ImR_Client/ServerObjectA.cpp + ImR_Client/ServerObjectS.cpp + ImR_Client/ImplRepoC.cpp + ImR_Client/ImplRepoS.cpp + } + Header_Files { ImR_Client } @@ -28,21 +58,6 @@ project(ImR_Client) : taolib, tao_output, install, portableserver, tao_versionin } IDL_Files { - idlflags += -Gp -Ssi -Gd -Sorb -GA \ - -Wb,export_macro=TAO_IMR_Client_Export \ - -Wb,export_include=tao/ImR_Client/imr_client_export.h \ - -o ImR_Client - idlflags -= -Sa -St - ImR_Client/ServerObject.pidl - } - - IDL_Files { - idlflags += -Gp -Ssi -Gd -Sorb -GX \ - -Wb,export_macro=TAO_IMR_Client_Export \ - -Wb,export_include=tao/ImR_Client/imr_client_export.h \ - -o ImR_Client - idlflags -= -Sa -St - ImR_Client/ImplRepo.pidl } Pkgconfig_Files { diff --git a/TAO/tao/LF_Event_Binder.h b/TAO/tao/LF_Event_Binder.h index c2225fac1be..b8599ec1bcc 100644 --- a/TAO/tao/LF_Event_Binder.h +++ b/TAO/tao/LF_Event_Binder.h @@ -41,6 +41,10 @@ public: ~TAO_LF_Event_Binder (void); private: + void operator= (const TAO_LF_Event_Binder &); + TAO_LF_Event_Binder (const TAO_LF_Event_Binder &); + +private: /// Keep a reference to the leader follower TAO_LF_Event * const event_; TAO_LF_Follower * const follower_; diff --git a/TAO/tao/LF_Multi_Event.h b/TAO/tao/LF_Multi_Event.h index 2a0a05fd9dd..f61909ba518 100644 --- a/TAO/tao/LF_Multi_Event.h +++ b/TAO/tao/LF_Multi_Event.h @@ -73,6 +73,10 @@ public: int error_detected (void) const; //@} +private: + void operator= (const TAO_LF_Multi_Event &); + TAO_LF_Multi_Event (const TAO_LF_Multi_Event &); + protected: /// Validate the state change diff --git a/TAO/tao/LocateRequest_Invocation.cpp b/TAO/tao/LocateRequest_Invocation.cpp index 14e2bc9cbff..e64ab434271 100644 --- a/TAO/tao/LocateRequest_Invocation.cpp +++ b/TAO/tao/LocateRequest_Invocation.cpp @@ -9,6 +9,7 @@ #include "tao/Profile.h" #include "tao/ORB_Constants.h" #include "tao/SystemException.h" +#include "ace/Intrusive_Auto_Ptr.h" #include "ace/Countdown_Time.h" @@ -36,13 +37,20 @@ namespace TAO { ACE_Countdown_Time countdown (max_wait_time); - TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (), - this->details_.reply_service_info ()); + TAO_Synch_Reply_Dispatcher *rd_p = 0; + ACE_NEW_NORETURN (rd_p, TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (), + this->details_.reply_service_info ())); + if (!rd_p) + { + throw ::CORBA::NO_MEMORY (); + } + + ACE_Intrusive_Auto_Ptr<TAO_Synch_Reply_Dispatcher> rd(rd_p, false); // Register a reply dispatcher for this invocation. Use the // preallocated reply dispatcher. TAO_Bind_Dispatcher_Guard dispatch_guard (this->details_.request_id (), - &rd, + rd.get (), this->resolver_.transport ()->tms ()); if (dispatch_guard.status () != 0) @@ -54,9 +62,6 @@ namespace TAO throw ::CORBA::INTERNAL (TAO::VMCID, CORBA::COMPLETED_NO); } - TAO_Target_Specification tspec; - this->init_target_spec (tspec); - TAO_Transport *transport = this->resolver_.transport (); Invocation_Status s = TAO_INVOKE_FAILURE; @@ -65,6 +70,9 @@ namespace TAO transport->output_cdr_lock (), TAO_INVOKE_FAILURE); TAO_OutputCDR &cdr = transport->out_stream (); + TAO_Target_Specification tspec; + this->init_target_spec (tspec, cdr); + if (transport->generate_locate_request (tspec, this->details_, cdr) == -1) return TAO_INVOKE_FAILURE; @@ -84,9 +92,9 @@ namespace TAO if (this->resolver_.transport ()->idle_after_send ()) this->resolver_.transport_released (); - s = this->wait_for_reply (max_wait_time, rd, dispatch_guard); + s = this->wait_for_reply (max_wait_time, *rd.get (), dispatch_guard); - s = this->check_reply (rd); + s = this->check_reply (*rd.get ()); // For some strategies one may want to release the transport // back to cache after receiving the reply. If the idling is diff --git a/TAO/tao/LzoCompressor.mpc b/TAO/tao/LzoCompressor.mpc index 8ec9ac03ea2..85699c7789b 100644 --- a/TAO/tao/LzoCompressor.mpc +++ b/TAO/tao/LzoCompressor.mpc @@ -1,6 +1,6 @@ //$Id$ -project(LzoCompressor) : taolib, tao_output, install, compression, tao_versioning_idl_defaults, lzo2 { - requires += lzo2 +project(LzoCompressor) : taolib, tao_output, install, compression, taoidldefaults, lzo1 { + requires += lzo1 sharedname = TAO_LzoCompressor dynamicflags = TAO_LZOCOMPRESSOR_BUILD_DLL diff --git a/TAO/tao/MM_Sequence_Iterator_T.h b/TAO/tao/MM_Sequence_Iterator_T.h new file mode 100644 index 00000000000..b2fd193d325 --- /dev/null +++ b/TAO/tao/MM_Sequence_Iterator_T.h @@ -0,0 +1,959 @@ +#ifndef mm_sequence_iterator_h +#define mm_sequence_iterator_h + +/** + * @file + * + * @brief Implement the iterator for CORBA sequences that need + * memory management. + * + * There are some CORBA sequences that need to manage memory (e.g., + * string sequences). Iterators for these classes also need to + * manage memory and therefore do not use the iterators defined + * for the generic sequences. + * + * Essentially, only the iterators operators that reference and return + * elements (e.g.,operator*, operator[]) need to be overridden from the + * behavior provided by the generic sequence iterators. Template + * specialization code is appropriate here but I couldn't figure out how + * to make the compiler happy. + * + * In lieu of template specialization code separate iterators exist + * for sequences that manage memory. Here are those iterators. + * + * $Id$ + * + * @author Joe Hoffert + */ + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +namespace TAO +{ + +// Forward declare the iterators +template<typename T> +class MM_Sequence_Iterator; + +template<typename T> +class Const_MM_Sequence_Iterator; + +template<typename T> +class MM_Sequence_Reverse_Iterator; + +template<typename T> +class Const_MM_Sequence_Reverse_Iterator; + + +/** + * @class MM_Sequence_Iterator + * @brief Implements a random access iterator for generic sequence type + * classes that need to manage memory. MM stands for memory managed. + */ +template <typename SEQUENCE_T> + class MM_Sequence_Iterator +{ + friend class Const_MM_Sequence_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::element_type element_type; + typedef typename SEQUENCE_T::const_element_type const_element_type; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef typename SEQUENCE_T::implementation_type implementation_type; + typedef CORBA::Long difference_type; + + /// Construct a MM_Sequence_Iterator at position pos. + MM_Sequence_Iterator (implementation_type *sequence, + size_t pos = 0) + : sequence_ (sequence), + pos_ (pos) + { + } + + /// Copy constructor + MM_Sequence_Iterator (MM_Sequence_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + MM_Sequence_Iterator & operator= (MM_Sequence_Iterator<SEQUENCE_T> const & rhs) + { + MM_Sequence_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(MM_Sequence_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// typecast operator to Const_MM_Sequence_Iterator + operator Const_MM_Sequence_Iterator<SEQUENCE_T> () + { + return Const_MM_Sequence_Iterator<SEQUENCE_T> (*this); + } + + /// Dereference operator returns a reference to the item contained + /// at the current position + element_type operator* (void) + { + // Access the underlying element in the sequence. + return element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } + + /// Returns a const reference to the item contained at the current position + const_element_type operator* (void) const + { + // Access the underlying element in the sequence. + return const_element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } + + /// Preincrement operator + MM_Sequence_Iterator<SEQUENCE_T> &operator++ (void) + { + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return *this; + } + + /// Postincrement operator + MM_Sequence_Iterator<SEQUENCE_T> operator++ (int) + { + // Create a temporary to return so that it's not modified. + MM_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return temp_iter; + } + + /// Predecrement operator + MM_Sequence_Iterator<SEQUENCE_T> &operator-- (void) + { + --this->pos_; + return *this; + } + + /// Postdecrement operator + MM_Sequence_Iterator<SEQUENCE_T> operator-- (int) + { + // Create a temporary to return so that it's not modified. + MM_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + --this->pos_; + return temp_iter; + } + + /// Iterator addition + MM_Sequence_Iterator<SEQUENCE_T> &operator+= (difference_type n) + { + // Move ahead n elements. + this->pos_ += n; + return *this; + } + + /// Iterator addition + MM_Sequence_Iterator<SEQUENCE_T> operator+ (difference_type n) + { + // Create a temporary to return and move it ahead n elements. + return MM_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Iterator subtraction + MM_Sequence_Iterator<SEQUENCE_T> &operator-= (difference_type n) + { + // Move back n elements. + this->pos_ -= n; + return *this; + } + + /// Iterator subtraction + MM_Sequence_Iterator<SEQUENCE_T> operator- (difference_type n) + { + // Create a temporary to return and move it back n elements. + return MM_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Difference + difference_type operator- (const MM_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., this before rhs). + return this->pos_ - rhs.pos_; + } + + /// Difference + difference_type operator- (const Const_MM_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., this before rhs). + return this->pos_ - rhs.pos_; + } + + /// Element operator/assignment + element_type operator[] (difference_type n) + { + // Return the element at position pos_ + n + return element_type ((*(this->sequence_))[this->pos_ + n], + this->sequence_->release ()); + } + + /// Element operator/assignment + const_element_type operator[] (difference_type n) const + { + // Return the element at position pos_ + n + return const_element_type ((*(this->sequence_))[this->pos_ + n], + this->sequence_->release ()); + } + + /// Less than + bool operator< (const MM_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + return this->pos_ < rhs.pos_; + } + + /// Less than + bool operator< (const Const_MM_Sequence_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + return this->pos_ < rhs.pos_; + } + + + /// Equality operator + bool operator== (const MM_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const MM_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// the sequence with which we are dealing + implementation_type *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + MM_Sequence_Iterator<SEQUENCE_T> + operator+ (typename MM_Sequence_Iterator<SEQUENCE_T>::difference_type n, + const MM_Sequence_Iterator<SEQUENCE_T> & iter) + { + // Create an iter and move it ahead n elements. + return MM_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + MM_Sequence_Iterator<SEQUENCE_T> operator- + (typename MM_Sequence_Iterator<SEQUENCE_T>::difference_type n, + MM_Sequence_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements. + return MM_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + + +/** + * @class Const_MM_Sequence_Iterator + * @brief Implements a constant random access iterator for generic sequence + * type classes that need to manage memory. MM stands for memory + * managed. + * + * Note: Having a const Iterator does not guarantee that the current + * *position* that it points to will not change, it only guarantees that + * you cannot change the underlying array! + */ +template <typename SEQUENCE_T> +class Const_MM_Sequence_Iterator +{ + friend class MM_Sequence_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::const_element_type const_element_type; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef typename SEQUENCE_T::implementation_type implementation_type; + typedef int difference_type; + + /// Construct a Const_MM_Sequence_Iterator at position pos from + /// a const sequence. + explicit Const_MM_Sequence_Iterator (const implementation_type *sequence, + size_t pos = 0) + : sequence_ (sequence), + pos_ (pos) + { + } + + virtual ~Const_MM_Sequence_Iterator () + { + } + + /// Copy constructor + Const_MM_Sequence_Iterator ( + Const_MM_Sequence_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Copy constructor initializing by a MM_Sequence_Iterator + explicit Const_MM_Sequence_Iterator ( + MM_Sequence_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + Const_MM_Sequence_Iterator & operator= ( + Const_MM_Sequence_Iterator<SEQUENCE_T> const & rhs) + { + Const_MM_Sequence_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(Const_MM_Sequence_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// Dereference operator returns a reference to the item contained + /// at the current position + const_element_type operator* (void) const + { + // Access the underlying element in the sequence. + return const_element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } + + /// Preincrement operator + const Const_MM_Sequence_Iterator<SEQUENCE_T> &operator++ (void) const + { + // Increment the position. + ++this->pos_; + return * this; + } + + /// Postincrement operator + Const_MM_Sequence_Iterator<SEQUENCE_T> operator++ (int) const + { + // Create a temporary to return so that it's not modified. + Const_MM_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position. + // We also need to check if we're now past the end. + ++this->pos_; + return temp_iter; + } + + /// Predecrement operator + const Const_MM_Sequence_Iterator<SEQUENCE_T> &operator-- (void) const + { + --this->pos_; + return * this; + } + + /// Postdecrement operator + Const_MM_Sequence_Iterator<SEQUENCE_T> operator-- (int) const + { + // Create a temporary to return so that it's not modified. + Const_MM_Sequence_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + --this->pos_; + return temp_iter; + } + + /// Iterator addition + const Const_MM_Sequence_Iterator<SEQUENCE_T> &operator+= (difference_type n) const + { + // Move ahead n elements. + this->pos_ += n; + return * this; + } + + /// Iterator addition + Const_MM_Sequence_Iterator<SEQUENCE_T> operator+ (difference_type n) const + { + // Create a temporary to return and move it ahead n elements. + return Const_MM_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Iterator subtraction + const Const_MM_Sequence_Iterator<SEQUENCE_T> &operator-= (difference_type n) const + { + // Move back n elements. + this->pos_ -= n; + return * this; + } + + /// Iterator subtraction + Const_MM_Sequence_Iterator<SEQUENCE_T> operator- (difference_type n) const + { + // Create a temporary to return and move it back n elements. + return Const_MM_Sequence_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Difference + difference_type operator- (const Const_MM_Sequence_Iterator<SEQUENCE_T> & rhs) const + { + // I think the order is important here (i.e., this before rhs). + return this->pos_ - rhs.pos_; + } + + /// Element operator + const_element_type operator[] (difference_type n) const + { + // Return the element at position pos_ + n + return const_element_type ((*(this->sequence_))[this->pos_ + n], + this->sequence_->release ()); + } + + /// Less than + virtual bool operator< (const Const_MM_Sequence_Iterator<SEQUENCE_T> & rhs) const + { + // Return if this iterator is less than the passed in iterator. + return this->pos_ < rhs.pos_; + } + + /// Equality operator + bool operator== (const Const_MM_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const Const_MM_Sequence_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// the sequence with which we are dealing + const implementation_type *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_MM_Sequence_Iterator<SEQUENCE_T> operator+ + (typename MM_Sequence_Iterator<SEQUENCE_T>::difference_type n, + Const_MM_Sequence_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it ahead n elements. + return Const_MM_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_MM_Sequence_Iterator<SEQUENCE_T> operator- + (typename MM_Sequence_Iterator<SEQUENCE_T>::difference_type n, + Const_MM_Sequence_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements. + return Const_MM_Sequence_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + + +/** + * @class MM_Sequence_Reverse_Iterator + * @brief Implements a reverse random access iterator for generic sequence type + * classes that need to manage memory. MM stands for memory managed. + */ +template <typename SEQUENCE_T> +class MM_Sequence_Reverse_Iterator +{ + friend class Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::element_type element_type; + typedef typename SEQUENCE_T::const_element_type const_element_type; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef typename SEQUENCE_T::implementation_type implementation_type; + typedef int difference_type; + + /// Construct a MM_Sequence_Reverse_Iterator at position pos + MM_Sequence_Reverse_Iterator (implementation_type *sequence, + size_t pos) + : sequence_ (sequence), + pos_ (pos) + { + } + + /// Copy constructor + MM_Sequence_Reverse_Iterator ( + MM_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + MM_Sequence_Reverse_Iterator & operator= ( + MM_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + { + MM_Sequence_Reverse_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// Dereference operator returns a reference to the item contained + /// at the current position + element_type operator* (void) + { + // Access the underlying element in the sequence. + return element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } + + /// Returns a const reference to the item contained at the current position + const_element_type operator* (void) const + { + // Access the underlying element in the sequence. + return const_element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } + + /// Preincrement operator + MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator++ (void) + { + // Decrement the position for reverse iterators. + // We also need to check if we're now before the start. + --this->pos_; + return *this; + } + + /// Postincrement operator + MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator++ (int) + { + // Create a temporary to return so that it's not modified. + MM_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Decrement the position for reverse iterators. + // We also need to check if we're now past the end. + --this->pos_; + return temp_iter; + } + + /// Predecrement operator + MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-- (void) + { + // Increment the position for reverse iterators. + ++this->pos_; + return *this; + } + + /// Postdecrement operator + MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator-- (int) + { + // Create a temporary to return so that it's not modified. + MM_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position for reverse iterators. + ++this->pos_; + return temp_iter; + } + + /// Iterator addition + MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator+= (difference_type n) + { + // Move back n elements for reverse iterators. + this->pos_ -= n; + return *this; + } + + /// Iterator addition + MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ (difference_type n) + { + // Create a temporary to return and move it back n elements for + // reverse iterators. + return MM_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Iterator subtraction + MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-= (difference_type n) + { + // Move ahead n elements for reverse iterators. + this->pos_ += n; + return *this; + } + + /// Iterator subtraction + MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator- (difference_type n) + { + // Create a temporary to return and move it ahead n elements for + // reverse iterators. + return MM_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Difference + difference_type operator- (const MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., rhs before this). + return rhs.pos_ - this->pos_; + } + + /// Difference + difference_type operator- (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // I think order is important here (i.e., rhs before this). + return rhs.pos_ - this->pos_; + } + + /// Element operator/assignment + element_type operator[] (difference_type n) + { + // Return the element at position pos_ + n + return element_type ((*(this->sequence_))[this->pos_ + n], + this->sequence_->release ()); + } + + /// Element operator/assignment + const_element_type operator[] (difference_type n) const + { + // Return the element at position pos_ + n + return const_element_type ((*(this->sequence_))[this->pos_ + n], + this->sequence_->release ()); + } + + /// Less than + bool operator< (const MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + // For reverse iterators reverse the logic. + return this->pos_ > rhs.pos_; + } + + /// Less than + bool operator< (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + { + // Return if this iterator is less than the passed in iterator. + // For reverse iterators reverse the logic. + return this->pos_ > rhs.pos_; + } + + + /// Equality operator + bool operator== (const MM_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Equality operator + bool operator== (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const MM_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + + /// Nonequality operator + bool operator!= (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// The sequence with which we are dealing + implementation_type *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ + (typename MM_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + MM_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements for reverse iterators. + return MM_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator- + (typename MM_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + MM_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it ahead n elements for reverse iterators. + return MM_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + + +/** + * @class Const_MM_Sequence_Reverse_Iterator + * @brief Implements a constant reverse random access iterator for generic + * sequence type classes that need to manage memory. MM stands for + * memory managed. + * + * Note: Having a const Iterator does not guarantee that the current + * *position* that it points to will not change, it only guarantees that + * you cannot change the underlying array! + */ +template <typename SEQUENCE_T> +class Const_MM_Sequence_Reverse_Iterator +{ + friend class MM_Sequence_Reverse_Iterator<SEQUENCE_T>; + +public: + // = Necessary traits + typedef std::random_access_iterator_tag iterator_category; + typedef typename SEQUENCE_T::value_type value_type; + typedef typename SEQUENCE_T::value_type *pointer; + typedef typename SEQUENCE_T::value_type &reference; + typedef typename SEQUENCE_T::const_element_type const_element_type; + typedef typename SEQUENCE_T::allocation_traits allocation_traits; + typedef typename SEQUENCE_T::element_traits element_traits; + typedef typename SEQUENCE_T::implementation_type implementation_type; + typedef int difference_type; + + /// Construct a Const_MM_Sequence_Reverse_Iterator at position pos + /// using a const sequence. + Const_MM_Sequence_Reverse_Iterator (const implementation_type *sequence, + size_t pos) + : sequence_ (sequence), + pos_ (pos) + { + } + + /// Copy constructor + Const_MM_Sequence_Reverse_Iterator ( + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Copy constructor + Const_MM_Sequence_Reverse_Iterator ( + MM_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + : sequence_ (rhs.sequence_), + pos_ (rhs.pos_) + { + } + + /// Assignment operator + Const_MM_Sequence_Reverse_Iterator & operator= ( + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> const & rhs) + { + Const_MM_Sequence_Reverse_Iterator tmp(rhs); + swap (tmp); + return * this; + } + + /// swaps all members + void swap(Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) + throw() + { + std::swap (sequence_, rhs.sequence_); + std::swap (this->pos_, rhs.pos_); + } + + /// typecast operator to MM_Sequence_Reverse_Iterator + + /// Dereference operator returns a reference to the item contained + /// at the current position + const_element_type operator* (void) const + { + // Access the underlying element in the sequence. + return const_element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } + + /// Preincrement operator + const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator++ (void) const + { + // Decrement the position for reveres iterators. + // We also need to check if we're now before the start. + --this->pos_; + return *this; + } + + /// Postincrement operator + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator++ (int) const + { + // Create a temporary to return so that it's not modified. + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Decrement the position for reverse iterators. + // We also need to check if we're now before the start. + --this->pos_; + return temp_iter; + } + + /// Predecrement operator + const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-- (void) const + { + // Increment the position for reverse iterators. + ++this->pos_; + return *this; + } + + /// Postdecrement operator + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator-- (int) const + { + // Create a temporary to return so that it's not modified. + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> temp_iter (this->sequence_, this->pos_); + // Increment the position for reverse iterators. + ++this->pos_; + return temp_iter; + } + + /// Iterator addition + const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator+= (difference_type n) const + { + // Move back n elements for reverse iterators. + this->pos_ -= n; + return *this; + } + + /// Iterator addition + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ (difference_type n) const + { + // Create a temporary to return and move it back n elements for + // reverse iterators. + return Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ - n); + } + + /// Iterator subtraction + const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &operator-= (difference_type n) const + { + // Move ahead n elements for reverse iterators. + this->pos_ += n; + return *this; + } + + /// Iterator subtraction + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator- (difference_type n) const + { + // Create a temporary to return and move it ahead n elements for + // reverse iterators. + return Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> (this->sequence_, this->pos_ + n); + } + + /// Difference + difference_type operator- (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) const + { + // I think order is important here (i.e., rhs before this). + return rhs.pos_ - this->pos_; + } + + /// Element operator/assignment + const_element_type operator[] (difference_type n) const + { + // Return the element at position pos_ + n + return const_element_type ((*(this->sequence_))[this->pos_ + n], + this->sequence_->release ()); + } + + /// Less than + bool operator< (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> & rhs) const + { + // Return if this iterator is less than the passed in iterator. + // For reverse iterators reverse the logic. + return this->pos_ > rhs.pos_; + } + + /// Equality operator + bool operator== (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + // Compare all the data members for equality. + return this->sequence_ == rhs.sequence_ + && this->pos_ == rhs.pos_; + } + + /// Nonequality operator + bool operator!= (const Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> &rhs) const + { + return !(*this == rhs); + } + +private: + /// the sequence with which we are dealing + const implementation_type *sequence_; + + /// Our current position in the sequence. + mutable difference_type pos_; +}; + +/// Iterator addition with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator+ + (typename Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it back n elements for reverse iterators. + return Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ - n); + } + +/// Iterator subtraction with the difference_type being the first argument. +template<typename SEQUENCE_T> + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> operator- + (typename Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T>::difference_type n, + Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> iter) + { + // Create an iter and move it ahead n elements for reverse iterators. + return Const_MM_Sequence_Reverse_Iterator<SEQUENCE_T> (iter.sequence_, iter.pos_ + n); + } + + +} // namespace TAO + +#endif /* TAO_HAS_SEQUENCE_ITERATORS == 1 */ + +#endif // mm_sequence_iterator_h diff --git a/TAO/tao/MProfile.cpp b/TAO/tao/MProfile.cpp index 352ffc47871..c4c763c7f6c 100644 --- a/TAO/tao/MProfile.cpp +++ b/TAO/tao/MProfile.cpp @@ -201,7 +201,7 @@ TAO_MProfile::add_profiles (TAO_MProfile *pfiles) { // this->size_ == total number of profiles we can hold // this->last_ == the index of the last profile - CORBA::ULong space = this->size_ - this->last_; + CORBA::ULong const space = this->size_ - this->last_; if (space < pfiles->last_) { @@ -364,7 +364,7 @@ TAO_MProfile::give_shared_profile (TAO_Profile *pfile) pfile->_decr_refcnt(); return i; } - return this->give_profile(pfile,0); + return this->give_profile(pfile, 0); } diff --git a/TAO/tao/Makefile.am b/TAO/tao/Makefile.am index 52a7430d85a..2b3c526cee3 100644 --- a/TAO/tao/Makefile.am +++ b/TAO/tao/Makefile.am @@ -1229,6 +1229,7 @@ nobase_include_HEADERS = \ MCAST_Parser.h \ MCAST_Parser.inl \ MMAP_Allocator.h \ + MM_Sequence_Iterator_T.h \ MProfile.h \ MProfile.inl \ Messaging_PolicyValue.pidl \ @@ -1581,6 +1582,7 @@ libTAO_Codeset_la_SOURCES = \ Codeset/Codeset_Descriptor.cpp \ Codeset/Codeset_Manager_Factory.cpp \ Codeset/Codeset_Manager_i.cpp \ + Codeset/Codeset_Service_Context_Handler.cpp \ Codeset/Codeset_Translator_Factory.cpp \ Codeset/UTF16_BOM_Factory.cpp \ Codeset/UTF16_BOM_Translator.cpp \ @@ -1599,6 +1601,7 @@ nobase_include_HEADERS += \ Codeset/CodeSetContextC.h \ Codeset/CodeSetContextS.h \ Codeset/Codeset.h \ + Codeset/Codeset_Service_Context_Handler.h \ Codeset/Codeset_Descriptor.h \ Codeset/Codeset_Manager_Factory.h \ Codeset/Codeset_Manager_i.h \ @@ -3742,6 +3745,7 @@ libTAO_DiffServPolicy_la_SOURCES = \ DiffServPolicy/DiffServPolicy.cpp \ DiffServPolicy/DiffServPolicyA.cpp \ DiffServPolicy/DiffServPolicyC.cpp \ + DiffServPolicy/DiffServ_Service_Context_Handler.cpp \ DiffServPolicy/DiffServPolicy_Factory.cpp \ DiffServPolicy/DiffServPolicy_ORBInitializer.cpp \ DiffServPolicy/DiffServ_Network_Priority_Hook.cpp \ @@ -3761,6 +3765,7 @@ libTAO_DiffServPolicy_la_LIBADD = \ nobase_include_HEADERS += \ DiffServPolicy/Client_Network_Priority_Policy.h \ + DiffServPolicy/DiffServ_Service_Context_Handler.h \ DiffServPolicy/DiffServPolicy.h \ DiffServPolicy/DiffServPolicy.pidl \ DiffServPolicy/DiffServPolicyA.h \ @@ -5335,6 +5340,7 @@ libTAO_RTCORBA_la_SOURCES = \ RTCORBA/RTCORBAC.cpp \ RTCORBA/RTCORBA_includeC.cpp \ RTCORBA/RT_Current.cpp \ + RTCORBA/RT_Service_Context_Handler.cpp \ RTCORBA/RT_Endpoint_Selector_Factory.cpp \ RTCORBA/RT_Endpoint_Utils.cpp \ RTCORBA/RT_Invocation_Endpoint_Selectors.cpp \ @@ -5368,6 +5374,7 @@ nobase_include_HEADERS += \ RTCORBA/Continuous_Priority_Mapping.h \ RTCORBA/Direct_Priority_Mapping.h \ RTCORBA/Linear_Network_Priority_Mapping.h \ + RTCORBA/RT_Service_Context_Handler.h \ RTCORBA/Linear_Priority_Mapping.h \ RTCORBA/Multi_Priority_Mapping.h \ RTCORBA/Network_Priority_Mapping.h \ @@ -6531,6 +6538,7 @@ libTAO_ZIOP_la_SOURCES = \ ZIOP/ZIOP_ORBInitializer.cpp \ ZIOP/ZIOP_PolicyFactory.cpp \ ZIOP/ZIOP_Policy_Validator.cpp \ + ZIOP/ZIOP_Service_Context_Handler.cpp \ ZIOP/ZIOP_Policy_i.cpp \ ZIOP/ZIOP_Stub.cpp \ ZIOP/ZIOP_Stub_Factory.cpp @@ -6556,6 +6564,7 @@ nobase_include_HEADERS += \ ZIOP/ZIOP_PolicyFactory.h \ ZIOP/ZIOP_Policy_Validator.h \ ZIOP/ZIOP_Policy_i.h \ + ZIOP/ZIOP_Service_Context_Handler.h \ ZIOP/ZIOP_Stub.h \ ZIOP/ZIOP_Stub_Factory.h \ ZIOP/ziop_export.h diff --git a/TAO/tao/Messaging.mpc b/TAO/tao/Messaging.mpc index 74dbd488ab1..85d34e94cf6 100644 --- a/TAO/tao/Messaging.mpc +++ b/TAO/tao/Messaging.mpc @@ -1,31 +1,6 @@ //$Id$ -project(Messaging) : taolib, tao_output, install, portableserver, pi, valuetype, tao_versioning_idl_defaults { - sharedname = TAO_Messaging - dynamicflags = TAO_MESSAGING_BUILD_DLL - - Source_Files { - Messaging - } - - Header_Files { - Messaging - } - - Inline_Files { - Messaging - } - - Template_Files { - Messaging - } - - Resource_Files { - Messaging - } - - PIDL_Files { - } - +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 IDL_Files { idlflags += -SS -GA -Gp -Gd -Sorb -Sal \ -Wb,export_macro=TAO_Messaging_Export \ @@ -85,6 +60,57 @@ project(Messaging) : taolib, tao_output, install, portableserver, pi, valuetype, idlflags -= -Sa -St Messaging/Messaging.pidl } +} + +project(Messaging) : taolib, tao_output, install, portableserver, pi, valuetype, taoidldefaults { + after += *idl + sharedname = TAO_Messaging + dynamicflags = TAO_MESSAGING_BUILD_DLL + + Source_Files { + Messaging + } + + Source_Files { + Messaging/ExceptionHolderC.cpp + Messaging/PollableC.cpp + Messaging/Messaging_TypesC.cpp + Messaging/TAO_ExtC.cpp + Messaging/Messaging_RT_PolicyC.cpp + Messaging/Messaging_SyncScope_PolicyC.cpp + Messaging/Messaging_No_ImplC.cpp + Messaging/MessagingC.cpp + Messaging/MessagingS.cpp + Messaging/ExceptionHolderA.cpp + Messaging/MessagingA.cpp + Messaging/Messaging_No_ImplA.cpp + Messaging/Messaging_RT_PolicyA.cpp + Messaging/Messaging_SyncScope_PolicyA.cpp + Messaging/TAO_ExtA.cpp + } + + Header_Files { + Messaging + } + + Inline_Files { + Messaging + } + + Template_Files { + Messaging + } + + Resource_Files { + Messaging + } + + PIDL_Files { + Messaging + } + + IDL_Files { + } Pkgconfig_Files { Messaging/TAO_Messaging.pc.in diff --git a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp index 00cd3bab7d3..9075cd3247c 100644 --- a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp +++ b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp @@ -138,7 +138,7 @@ TAO_Asynch_Reply_Dispatcher::dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) } } - this->decr_refcount (); + this->intrusive_remove_ref (this); return 1; } @@ -182,12 +182,12 @@ TAO_Asynch_Reply_Dispatcher::connection_closed (void) if (TAO_debug_level >= 4) { ex._tao_print_exception ( - "Asynch_Reply_Dispacher::connection_closed"); + "Asynch_Reply_Dispatcher::connection_closed"); } } - (void) this->decr_refcount (); + this->intrusive_remove_ref (this); } // AMI Timeout Handling Begin @@ -237,11 +237,11 @@ TAO_Asynch_Reply_Dispatcher::reply_timed_out (void) { if (TAO_debug_level >= 4) { - ex._tao_print_exception ("Asynch_Reply_Dispacher::reply_timed_out"); + ex._tao_print_exception ("Asynch_Reply_Dispatcher::reply_timed_out"); } } - (void) this->decr_refcount (); + this->intrusive_remove_ref (this); } long diff --git a/TAO/tao/Monitor.mpc b/TAO/tao/Monitor.mpc index 81023a16a22..2be58690640 100644 --- a/TAO/tao/Monitor.mpc +++ b/TAO/tao/Monitor.mpc @@ -1,15 +1,48 @@ //$Id$ -project (TAO_Monitor): portableserver, install, tao_versioning_idl_defaults, ace_mc, tao_output { - sharedname = TAO_Monitor - dynamicflags = TAO_MONITOR_BUILD_DLL +project (*idl): tao_versioning_idl_defaults { + custom_only = 1 idlflags += -Gp -Gd -GA \ -Wb,export_macro=TAO_Monitor_Export \ -Wb,export_include=tao/Monitor/Monitor_export.h \ -o Monitor + IDL_Files { + idlflags += -Wb,unique_include=tao/Monitor/Monitor.h -SS -Sci + Monitor/Monitor_include.pidl + } + + IDL_Files { + idlflags += -Wb,include_guard=TAO_MONITOR_SAFE_INCLUDE \ + -Wb,safe_include=tao/Monitor/Monitor.h -Ssi + Monitor/Monitor.pidl + } + + IDL_Files { + idlflags -= -Sa -St + idlflags += -SS -Wb,include_guard=TAO_MONITOR_SAFE_INCLUDE \ + -Wb,safe_include=tao/Monitor/Monitor.h + Monitor/Monitor_Types.pidl + } +} + +project (TAO_Monitor): portableserver, install, taoidldefaults, ace_mc, tao_output { + after += *idl + sharedname = TAO_Monitor + dynamicflags = TAO_MONITOR_BUILD_DLL + Source_Files { Monitor } + Source_Files { + Monitor/Monitor_includeC.cpp + Monitor/MonitorC.cpp + Monitor/Monitor_TypesC.cpp + Monitor/MonitorA.cpp + Monitor/MonitorS.cpp + Monitor/Monitor_includeA.cpp + Monitor/Monitor_TypesA.cpp + } + Header_Files { Monitor } @@ -31,21 +64,6 @@ project (TAO_Monitor): portableserver, install, tao_versioning_idl_defaults, ace } IDL_Files { - idlflags += -Wb,unique_include=tao/Monitor/Monitor.h -SS -Sci - Monitor/Monitor_include.pidl - } - - IDL_Files { - idlflags += -Wb,include_guard=TAO_MONITOR_SAFE_INCLUDE \ - -Wb,safe_include=tao/Monitor/Monitor.h -Ssi - Monitor/Monitor.pidl - } - - IDL_Files { - idlflags -= -Sa -St - idlflags += -SS -Wb,include_guard=TAO_MONITOR_SAFE_INCLUDE \ - -Wb,safe_include=tao/Monitor/Monitor.h - Monitor/Monitor_Types.pidl } Pkgconfig_Files { diff --git a/TAO/tao/Muxed_TMS.cpp b/TAO/tao/Muxed_TMS.cpp index ed9b87bbf1b..06036f4f116 100644 --- a/TAO/tao/Muxed_TMS.cpp +++ b/TAO/tao/Muxed_TMS.cpp @@ -66,7 +66,7 @@ TAO_Muxed_TMS::request_id (void) /// Bind the dispatcher with the request id. int TAO_Muxed_TMS::bind_dispatcher (CORBA::ULong request_id, - TAO_Reply_Dispatcher *rd) + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd) { ACE_GUARD_RETURN (ACE_Lock, ace_mon, @@ -126,15 +126,16 @@ int TAO_Muxed_TMS::dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) { int result = 0; + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd(0); + // Grab the reply dispatcher for this id. { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, -1); - - TAO_Reply_Dispatcher *rd = 0; result = this->dispatcher_table_.unbind (params.request_id_, rd); + } if (result == 0 && rd) { @@ -144,11 +145,6 @@ TAO_Muxed_TMS::dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) ACE_TEXT ("id = %d\n"), params.request_id_)); - // Do not move it outside the scope of the lock. A follower thread - // could have timedout unwinding the stack and the reply - // dispatcher, and that would mean the present thread could be left - // with a dangling pointer and may crash. To safeguard against such - // cases we dispatch with the lock held. // Dispatch the reply. // They return 1 on success, and -1 on failure. result = rd->dispatch_reply (params); @@ -162,13 +158,13 @@ TAO_Muxed_TMS::dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) params.request_id_, result)); - // Result = 0 means that the mux strategy was not able - // to find a registered reply handler, either because the reply - // was not our reply - just forget about it - or it was ours, but - // the reply timed out - just forget about the reply. - result = 0; - } - } + // Result = 0 means that the mux strategy was not able + // to find a registered reply handler, either because the reply + // was not our reply - just forget about it - or it was ours, but + // the reply timed out - just forget about the reply. + result = 0; + } + return result; } @@ -177,7 +173,7 @@ int TAO_Muxed_TMS::reply_timed_out (CORBA::ULong request_id) { int result = 0; - TAO_Reply_Dispatcher *rd = 0; + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd(0); // Grab the reply dispatcher for this id. { @@ -269,7 +265,7 @@ TAO_Muxed_TMS::clear_cache_i (void) REQUEST_DISPATCHER_TABLE::ITERATOR const end = this->dispatcher_table_.end (); - ACE_Unbounded_Stack <TAO_Reply_Dispatcher *> ubs; + ACE_Unbounded_Stack <ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> > ubs; for (REQUEST_DISPATCHER_TABLE::ITERATOR i = this->dispatcher_table_.begin (); @@ -284,7 +280,7 @@ TAO_Muxed_TMS::clear_cache_i (void) for (size_t k = 0 ; k != sz ; ++k) { - TAO_Reply_Dispatcher *rd = 0; + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd(0); if (ubs.pop (rd) == 0) { diff --git a/TAO/tao/Muxed_TMS.h b/TAO/tao/Muxed_TMS.h index 64de055f306..648d2547f2b 100644 --- a/TAO/tao/Muxed_TMS.h +++ b/TAO/tao/Muxed_TMS.h @@ -25,11 +25,15 @@ #include "ace/Hash_Map_Manager_T.h" #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +template <class X> class ACE_Intrusive_Auto_Ptr; +ACE_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_ORB_Core; class TAO_Pluggable_Reply_Params; +class TAO_Reply_Dispatcher; /** * @class TAO_Muxed_TMS @@ -59,7 +63,7 @@ public: // = Please read the documentation in the TAO_Transport_Mux_Strategy // class. virtual int bind_dispatcher (CORBA::ULong request_id, - TAO_Reply_Dispatcher *rh); + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd); virtual int unbind_dispatcher (CORBA::ULong request_id); virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms); @@ -71,6 +75,10 @@ public: virtual bool has_request (void); private: + void operator= (const TAO_Muxed_TMS &); + TAO_Muxed_TMS (const TAO_Muxed_TMS &); + +private: /// Lock to protect the state of the object ACE_Lock *lock_; @@ -83,7 +91,7 @@ private: TAO_ORB_Core * const orb_core_; typedef ACE_Hash_Map_Manager_Ex <CORBA::ULong, - TAO_Reply_Dispatcher *, + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher>, ACE_Hash <CORBA::ULong>, ACE_Equal_To <CORBA::ULong>, ACE_Null_Mutex> diff --git a/TAO/tao/Network_Priority_Protocols_Hooks.h b/TAO/tao/Network_Priority_Protocols_Hooks.h index f76db69ebe8..9a8c0f38fb9 100644 --- a/TAO/tao/Network_Priority_Protocols_Hooks.h +++ b/TAO/tao/Network_Priority_Protocols_Hooks.h @@ -51,14 +51,6 @@ public: CORBA::Object *object) = 0; virtual CORBA::Long get_dscp_codepoint (TAO_Service_Context &req) = 0; - - virtual void np_service_context (TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart) = 0; - - virtual void add_rep_np_service_context_hook ( - TAO_Service_Context &service_context, - CORBA::Long &dscp_codepoint) = 0; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 9d48644495b..6975aba2fad 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1327,7 +1327,7 @@ CORBA::ORB_init (int &argc, ACE_TCHAR *argv[], const char *orbid) if (result != 0 && errno != ENOENT) { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("TAO (%P|%t) %p\n"), ACE_TEXT ("Unable to initialize the ") ACE_TEXT ("Service Configurator"))); throw ::CORBA::INITIALIZE ( diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index a31dae3795c..3b7089d28aa 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1295,7 +1295,7 @@ TAO_ORB_Core::init (int &argc, char *argv[] ) this->orb_params ()->negotiate_codesets (negotiate_codesets); if (this->codeset_manager()) - this->codeset_manager_->open(); + this->codeset_manager_->open(*this); else if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, @@ -1754,26 +1754,6 @@ TAO_ORB_Core::service_raise_transient_failure ( return TAO::TAO_INVOKE_FAILURE; } -void -TAO_ORB_Core::service_context_list ( - TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart) -{ - if (this->protocols_hooks_ != 0) - { - this->protocols_hooks_->rt_service_context (stub, service_context, restart); - } - - // call the network priority protocols hooks that has been - // registered. - if (network_priority_protocols_hooks_ != 0) - { - this->network_priority_protocols_hooks_->np_service_context (stub, - service_context, restart); - } -} - TAO_Client_Strategy_Factory * TAO_ORB_Core::client_factory (void) { diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index d1324f2ffdf..13d561541b6 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -739,12 +739,6 @@ public: */ CORBA::ULong hash_service (TAO_Profile *this_p, CORBA::ULong max); - /// Call the service layers with the Service Context to check - /// whether they would like to add something to the list. - void service_context_list (TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean retstart); - /// Return a reference to the Fault Tolerant service object. TAO_Fault_Tolerance_Service &fault_tolerance_service (void); diff --git a/TAO/tao/ObjRefTemplate.mpc b/TAO/tao/ObjRefTemplate.mpc index 6ad1c80852f..431e97e0a93 100644 --- a/TAO/tao/ObjRefTemplate.mpc +++ b/TAO/tao/ObjRefTemplate.mpc @@ -1,5 +1,38 @@ //$Id$ -project(ObjRefTemplate) : valuetype, portableserver, install, tao_output, tao_versioning_idl_defaults { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -SS -Sorb -GX \ + -Wb,export_macro=TAO_ORT_Export \ + -Wb,export_include=tao/ObjRefTemplate/ort_export.h \ + -Wb,include_guard=TAO_OBJREF_TEMPLATE_SAFE_INCLUDE \ + -Wb,safe_include=tao/ObjRefTemplate/ObjectReferenceTemplate.h \ + -o ObjRefTemplate + idlflags -= -Sa -St + ObjRefTemplate/ObjectReferenceTemplate.pidl + } + + IDL_Files { + idlflags += -SS -Sorb -GX -Sci \ + -Wb,export_macro=TAO_ORT_Export \ + -Wb,export_include=tao/ObjRefTemplate/ort_export.h \ + -Wb,unique_include=tao/ObjRefTemplate/ObjectReferenceTemplate.h \ + -o ObjRefTemplate + ObjRefTemplate/ObjectReferenceTemplate_include.pidl + } + + IDL_Files { + idlflags += -Gp -Gd -SS -GA -Sorb \ + -Wb,export_macro=TAO_ORT_Export \ + -Wb,export_include=tao/ObjRefTemplate/ort_export.h \ + -o ObjRefTemplate + idlflags -= -Sa -St + ObjRefTemplate/Default_ORT.pidl + } +} + +project(ObjRefTemplate) : valuetype, portableserver, install, tao_output, taoidldefaults { + after += *idl sharedname = TAO_ObjRefTemplate dynamicflags = TAO_ORT_BUILD_DLL @@ -7,6 +40,13 @@ project(ObjRefTemplate) : valuetype, portableserver, install, tao_output, tao_ve ObjRefTemplate } + Source_Files { + ObjRefTemplate/ObjectReferenceTemplateC.cpp + ObjRefTemplate/ObjectReferenceTemplate_includeC.cpp + ObjRefTemplate/Default_ORTC.cpp + ObjRefTemplate/Default_ORTA.cpp + } + Header_Files { ObjRefTemplate } @@ -28,32 +68,6 @@ project(ObjRefTemplate) : valuetype, portableserver, install, tao_output, tao_ve } IDL_Files { - idlflags += -Gp -Gd -SS -Sorb -GX \ - -Wb,export_macro=TAO_ORT_Export \ - -Wb,export_include=tao/ObjRefTemplate/ort_export.h \ - -Wb,include_guard=TAO_OBJREF_TEMPLATE_SAFE_INCLUDE \ - -Wb,safe_include=tao/ObjRefTemplate/ObjectReferenceTemplate.h \ - -o ObjRefTemplate - idlflags -= -Sa -St - ObjRefTemplate/ObjectReferenceTemplate.pidl - } - - IDL_Files { - idlflags += -SS -Sorb -GX -Sci \ - -Wb,export_macro=TAO_ORT_Export \ - -Wb,export_include=tao/ObjRefTemplate/ort_export.h \ - -Wb,unique_include=tao/ObjRefTemplate/ObjectReferenceTemplate.h \ - -o ObjRefTemplate - ObjRefTemplate/ObjectReferenceTemplate_include.pidl - } - - IDL_Files { - idlflags += -Gp -Gd -SS -GA -Sorb \ - -Wb,export_macro=TAO_ORT_Export \ - -Wb,export_include=tao/ObjRefTemplate/ort_export.h \ - -o ObjRefTemplate - idlflags -= -Sa -St - ObjRefTemplate/Default_ORT.pidl } Pkgconfig_Files { diff --git a/TAO/tao/ObjectKey_Table.h b/TAO/tao/ObjectKey_Table.h index bea994c294a..4e2f8c13df4 100644 --- a/TAO/tao/ObjectKey_Table.h +++ b/TAO/tao/ObjectKey_Table.h @@ -122,6 +122,10 @@ namespace TAO int unbind_i (Refcounted_ObjectKey *&key); private: + void operator= (const ObjectKey_Table &); + ObjectKey_Table (const ObjectKey_Table &); + + private: // Some useful typedefs. typedef ACE_RB_Tree<TAO::ObjectKey, diff --git a/TAO/tao/PI.mpc b/TAO/tao/PI.mpc index f59ae6fae53..e3b60d68586 100644 --- a/TAO/tao/PI.mpc +++ b/TAO/tao/PI.mpc @@ -1,36 +1,10 @@ //$Id$ -project(PI) : taolib, tao_output, codecfactory, install, tao_versioning_idl_defaults { - sharedname = TAO_PI - dynamicflags = TAO_PI_BUILD_DLL +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 idlflags += -SS -Sci -Gp -Gd \ -Wb,export_macro=TAO_PI_Export \ -Wb,export_include=tao/PI/pi_export.h \ -o PI - - Source_Files { - PI - } - - Header_Files { - PI - } - - Inline_Files { - PI - } - - Template_Files { - PI - } - - Resource_Files { - PI - } - - PIDL_Files { - PI - } - IDL_Files { idlflags += -Sorb -GX \ -Wb,unique_include=tao/PI/PI.h @@ -72,6 +46,63 @@ project(PI) : taolib, tao_output, codecfactory, install, tao_versioning_idl_defa idlflags -= -Sa -St PI/InvalidSlot.pidl } +} + +project(PI) : taolib, tao_output, codecfactory, install, taoidldefaults { + after += *idl + sharedname = TAO_PI + dynamicflags = TAO_PI_BUILD_DLL + + Source_Files { + PI + } + + Source_Files { + PI/PI_includeC.cpp + PI/ORBInitInfoC.cpp + PI/ORBInitializerC.cpp + PI/ClientRequestInterceptorC.cpp + PI/ClientRequestInfoC.cpp + PI/RequestInfoC.cpp + PI/PIForwardRequestC.cpp + PI/PICurrentC.cpp + PI/ProcessingModePolicyC.cpp + PI/InterceptorC.cpp + PI/InvalidSlotC.cpp + PI/ClientRequestInfoA.cpp + PI/ClientRequestInterceptorA.cpp + PI/InterceptorA.cpp + PI/InvalidSlotA.cpp + PI/ORBInitializerA.cpp + PI/PICurrentA.cpp + PI/PIForwardRequestA.cpp + PI/PolicyFactoryA.cpp + PI/ProcessingModePolicyA.cpp + PI/RequestInfoA.cpp + } + + Header_Files { + PI + } + + Inline_Files { + PI + } + + Template_Files { + PI + } + + Resource_Files { + PI + } + + PIDL_Files { + PI + } + + IDL_Files { + } Pkgconfig_Files { PI/TAO_PI.pc.in diff --git a/TAO/tao/PI_Server.mpc b/TAO/tao/PI_Server.mpc index 8d58f70ecb9..ab411f93776 100644 --- a/TAO/tao/PI_Server.mpc +++ b/TAO/tao/PI_Server.mpc @@ -1,13 +1,31 @@ //$Id$ -project(PI_Server) : taolib, tao_output, pi, portableserver, install, tao_versioning_idl_defaults { - sharedname = TAO_PI_Server - dynamicflags = TAO_PI_SERVER_BUILD_DLL - +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 idlflags += \ -Wb,export_macro=TAO_PI_Server_Export \ -Wb,export_include=tao/PI_Server/pi_server_export.h \ -o PI_Server + IDL_Files { + idlflags += -Sci -SS -GA -Gp -Gd -Sorb -Sal +// -Wb,include_guard=TAO_PI_SERVER_SAFE_INCLUDE \ +// -Wb,safe_include=tao/PI_Server/PI_Server.h + idlflags -= -Sa -St + PI_Server/ServerRequestInfo.pidl + } + + IDL_Files { + idlflags += -SS -Sorb -GX -Sci \ + -Wb,unique_include=tao/PI_Server/PI_Server.h + PI_Server/PI_Server_include.pidl + } +} + +project(PI_Server) : taolib, tao_output, pi, portableserver, install, taoidldefaults { + after += *idl + sharedname = TAO_PI_Server + dynamicflags = TAO_PI_SERVER_BUILD_DLL + specific(bmake) { compile_flags += -Q } @@ -16,6 +34,11 @@ project(PI_Server) : taolib, tao_output, pi, portableserver, install, tao_versio PI_Server } + Source_Files { + PI_Server/ServerRequestInfoC.cpp + PI_Server/PI_Server_includeC.cpp + } + Header_Files { PI_Server } @@ -37,17 +60,6 @@ project(PI_Server) : taolib, tao_output, pi, portableserver, install, tao_versio } IDL_Files { - idlflags += -Sci -SS -GA -Gp -Gd -Sorb -Sal -// -Wb,include_guard=TAO_PI_SERVER_SAFE_INCLUDE \ -// -Wb,safe_include=tao/PI_Server/PI_Server.h - idlflags -= -Sa -St - PI_Server/ServerRequestInfo.pidl - } - - IDL_Files { - idlflags += -SS -Sorb -GX -Sci \ - -Wb,unique_include=tao/PI_Server/PI_Server.h - PI_Server/PI_Server_include.pidl } Pkgconfig_Files { diff --git a/TAO/tao/Policy_Set.cpp b/TAO/tao/Policy_Set.cpp index 67397ac0086..afbc6ae3489 100644 --- a/TAO/tao/Policy_Set.cpp +++ b/TAO/tao/Policy_Set.cpp @@ -57,22 +57,18 @@ TAO_Policy_Set::TAO_Policy_Set (const TAO_Policy_Set &rhs) continue; } - CORBA::Policy_var copy = - policy->copy (); + CORBA::Policy_var copy = policy->copy (); - TAO_Cached_Policy_Type const cached_type = - copy->_tao_cached_type (); + TAO_Cached_Policy_Type const cached_type = copy->_tao_cached_type (); // Add the "cacheable" policies into the cache. - if (cached_type != TAO_CACHED_POLICY_UNCACHED - && cached_type >= 0) + if (cached_type != TAO_CACHED_POLICY_UNCACHED && cached_type >= 0) { this->cached_policies_[cached_type] = copy.ptr (); } this->policy_list_[i] = copy._retn (); } - } catch (const ::CORBA::Exception& ex) { @@ -108,8 +104,7 @@ TAO_Policy_Set::copy_from (TAO_Policy_Set *source) throw ::CORBA::NO_PERMISSION (); } - CORBA::Policy_var copy = - policy->copy (); + CORBA::Policy_var copy = policy->copy (); CORBA::ULong const length = this->policy_list_.length (); this->policy_list_.length (length + 1); @@ -310,15 +305,12 @@ TAO_Policy_Set::get_policy (CORBA::PolicyType type) for (CORBA::ULong i = 0; i < length; ++i) { - const CORBA::ULong current = - this->policy_list_[i]->policy_type (); + CORBA::PolicyType const current = this->policy_list_[i]->policy_type (); - if (current != type) + if (current == type) { - continue; + return CORBA::Policy::_duplicate (this->policy_list_[i]); } - - return CORBA::Policy::_duplicate (this->policy_list_[i]); } return CORBA::Policy::_nil (); @@ -327,8 +319,7 @@ TAO_Policy_Set::get_policy (CORBA::PolicyType type) CORBA::Policy_ptr TAO_Policy_Set::get_cached_const_policy (TAO_Cached_Policy_Type type) const { - if (type != TAO_CACHED_POLICY_UNCACHED - && type < TAO_CACHED_POLICY_MAX_CACHED) + if (type != TAO_CACHED_POLICY_UNCACHED && type < TAO_CACHED_POLICY_MAX_CACHED) { return this->cached_policies_[type]; } @@ -339,8 +330,7 @@ TAO_Policy_Set::get_cached_const_policy (TAO_Cached_Policy_Type type) const CORBA::Policy_ptr TAO_Policy_Set::get_cached_policy (TAO_Cached_Policy_Type type) { - if (type != TAO_CACHED_POLICY_UNCACHED - && type < TAO_CACHED_POLICY_MAX_CACHED) + if (type != TAO_CACHED_POLICY_UNCACHED && type < TAO_CACHED_POLICY_MAX_CACHED) { return CORBA::Policy::_duplicate (this->cached_policies_[type]); } diff --git a/TAO/tao/Policy_Validator.h b/TAO/tao/Policy_Validator.h index d91dd67a122..769e8e40de2 100644 --- a/TAO/tao/Policy_Validator.h +++ b/TAO/tao/Policy_Validator.h @@ -102,6 +102,10 @@ protected: TAO_ORB_Core &orb_core_; private: + void operator= (const TAO_Policy_Validator &); + TAO_Policy_Validator (const TAO_Policy_Validator &); + +private: TAO_Policy_Validator *next_; }; diff --git a/TAO/tao/PortableServer.mpc b/TAO/tao/PortableServer.mpc index 0f8b99f8421..6009de3664d 100644 --- a/TAO/tao/PortableServer.mpc +++ b/TAO/tao/PortableServer.mpc @@ -1,29 +1,6 @@ //$Id$ -project(PortableServer) : taolib, tao_output, install, core_anytypecode, tao_versioning_idl_defaults { - sharedname = TAO_PortableServer - dynamicflags = TAO_PORTABLESERVER_BUILD_DLL - - Source_Files { - PortableServer - } - - Header_Files { - PortableServer - } - - Inline_Files { - PortableServer - } - - Template_Files { - PortableServer/Servant_var.cpp - PortableServer/*_T.cpp - } - - Resource_Files { - PortableServer - } - +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 IDL_Files { idlflags += -Gp -Gd -Sci -SS -Sorb -GA \ -Wb,export_macro=TAO_PortableServer_Export \ @@ -82,11 +59,77 @@ project(PortableServer) : taolib, tao_output, install, core_anytypecode, tao_ver -o PortableServer PortableServer/PortableServer.pidl } +} + +project(PortableServer) : taolib, tao_output, install, anytypecode, taoidldefaults { + after += *idl + sharedname = TAO_PortableServer + dynamicflags = TAO_PORTABLESERVER_BUILD_DLL + + Source_Files { + PortableServer + } + + Source_Files { + PortableServer/ForwardRequestC.cpp + PortableServer/AdapterActivatorC.cpp + PortableServer/IdAssignmentPolicyC.cpp + PortableServer/IdUniquenessPolicyC.cpp + PortableServer/ImplicitActivationPolicyC.cpp + PortableServer/LifespanPolicyC.cpp + PortableServer/RequestProcessingPolicyC.cpp + PortableServer/ServantActivatorC.cpp + PortableServer/ServantLocatorC.cpp + PortableServer/ServantManagerC.cpp + PortableServer/ServantRetentionPolicyC.cpp + PortableServer/ThreadPolicyC.cpp + PortableServer/POAManagerC.cpp + PortableServer/POAManagerFactoryC.cpp + PortableServer/POAC.cpp + PortableServer/PS_CurrentC.cpp + PortableServer/PortableServer_includeC.cpp + PortableServer/PortableServerC.cpp + PortableServer/AdapterActivatorA.cpp + PortableServer/ForwardRequestA.cpp + PortableServer/IdAssignmentPolicyA.cpp + PortableServer/IdUniquenessPolicyA.cpp + PortableServer/ImplicitActivationPolicyA.cpp + PortableServer/LifespanPolicyA.cpp + PortableServer/PS_ForwardA.cpp + PortableServer/Regular_POA.cpp + PortableServer/RequestProcessingPolicyA.cpp + PortableServer/Root_POA.cpp + PortableServer/ServantActivatorA.cpp + PortableServer/ServantLocatorA.cpp + PortableServer/ServantManagerA.cpp + PortableServer/ServantRetentionPolicyA.cpp + PortableServer/ThreadPolicyA.cpp + } + + Header_Files { + PortableServer + } + + Inline_Files { + PortableServer + } + + Template_Files { + PortableServer/Servant_var.cpp + PortableServer/*_T.cpp + } + + Resource_Files { + PortableServer + } PIDL_Files { PortableServer } + IDL_Files { + } + Pkgconfig_Files { PortableServer/TAO_PortableServer.pc.in } diff --git a/TAO/tao/PortableServer/PortableServer_include.pidl b/TAO/tao/PortableServer/PortableServer_include.pidl index 00894ac3bc9..41803d12427 100644 --- a/TAO/tao/PortableServer/PortableServer_include.pidl +++ b/TAO/tao/PortableServer/PortableServer_include.pidl @@ -4,31 +4,6 @@ * $Id$ * * @brief Include file for use in applications that need PortableServer.pidl. - * - * This file just includes PortableServer.pidl. The *C.h file generated from - * this is hand-crafted to itself include PortableServer.h instead of - * PortableServerC.h (which will produce a compiler error message if - * included directly). The PortableServer_includeC.h file can then be - * included directly and automatically by the IDL compiler when - * building the application. - * - * 1. Run the tao_idl compiler on the pidl file. The command used for - * this is: - * - * tao_idl -o orig -St -Sp -Sci -SS - * -Wb,export_macro=TAO_PortableServer_Export \ - * -Wb,export_include="portableserver_export.h" \ - * -Wb,pre_include="ace/pre.h" - * -Wb,post_include="ace/post.h" - * PortableServer_include.pidl - * - * 2. Then change this line in PortableServer_includeC.h: - * - * #include "PortableServerC.h" - * - * to - * - * #include "PortableServer.h" */ #ifndef _PORTABLESERVER_INCLUDE_IDL_ diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp index e98aefca50a..7edcce46ee9 100644 --- a/TAO/tao/Profile.cpp +++ b/TAO/tao/Profile.cpp @@ -313,8 +313,7 @@ TAO_Profile::set_tagged_components (TAO_OutputCDR &out_cdr) IOP::TaggedComponent tagged_component; tagged_component.tag = TAO_TAG_ENDPOINTS; tagged_component.component_data.length (length); - CORBA::Octet *buf = - tagged_component.component_data.get_buffer (); + CORBA::Octet *buf = tagged_component.component_data.get_buffer (); for (const ACE_Message_Block *iterator = out_cdr.begin (); iterator != 0; @@ -347,7 +346,6 @@ TAO_Profile::policies (CORBA::PolicyList *policy_list) return; } - Messaging::PolicyValue pv; Messaging::PolicyValueSeq policy_value_seq; size_t length = 0; @@ -355,7 +353,7 @@ TAO_Profile::policies (CORBA::PolicyList *policy_list) // This loop iterates through CORBA::PolicyList to convert // each CORBA::Policy into a CORBA::PolicyValue - size_t const plen = policy_list->length (); + CORBA::ULong const plen = policy_list->length (); policy_value_seq.length (plen); @@ -364,8 +362,11 @@ TAO_Profile::policies (CORBA::PolicyList *policy_list) TAO_OutputCDR out_CDR; policy_value_seq[i].ptype = (*policy_list)[i]->policy_type (); - out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); - (*policy_list)[i]->_tao_encode (out_CDR); + if (!(out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return; + + if (!((*policy_list)[i]->_tao_encode (out_CDR))) + return; length = out_CDR.total_length (); policy_value_seq[i].pvalue.length (static_cast <CORBA::ULong>(length)); @@ -390,8 +391,11 @@ TAO_Profile::policies (CORBA::PolicyList *policy_list) IOP::TaggedComponent tagged_component; tagged_component.tag = Messaging::TAG_POLICIES; - out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); - out_cdr << policy_value_seq; + if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return; + + if (!(out_cdr << policy_value_seq)) + return; length = out_cdr.total_length (); @@ -439,7 +443,7 @@ TAO_Profile::get_policies (CORBA::PolicyList& pl) if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order))) { - return ; + return; } in_cdr.reset_byte_order (static_cast <int> (byte_order)); diff --git a/TAO/tao/Profile_Transport_Resolver.h b/TAO/tao/Profile_Transport_Resolver.h index 4ebf0f3edd6..9bf19631f8b 100644 --- a/TAO/tao/Profile_Transport_Resolver.h +++ b/TAO/tao/Profile_Transport_Resolver.h @@ -157,6 +157,9 @@ namespace TAO /// ORB. bool get_connection_timeout (ACE_Time_Value &max_wait_time); + void operator= (const Profile_Transport_Resolver &); + Profile_Transport_Resolver (const Profile_Transport_Resolver &); + private: bool try_connect_i (TAO_Transport_Descriptor_Interface *desc, ACE_Time_Value *val, diff --git a/TAO/tao/Protocols_Hooks.h b/TAO/tao/Protocols_Hooks.h index 50599b87809..0dd3aca17f7 100644 --- a/TAO/tao/Protocols_Hooks.h +++ b/TAO/tao/Protocols_Hooks.h @@ -156,10 +156,6 @@ public: virtual CORBA::Long get_dscp_codepoint (void) = 0; - virtual void rt_service_context (TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart) = 0; - virtual void get_selector_hook (CORBA::Policy *model_policy, CORBA::Boolean &is_client_propagated, CORBA::Short &server_priority) = 0; diff --git a/TAO/tao/QtResource.mpc b/TAO/tao/QtResource.mpc index d593352ae2f..639208dd94d 100644 --- a/TAO/tao/QtResource.mpc +++ b/TAO/tao/QtResource.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- now wouldn't this be cool... // $Id$ -project(TAO_QtResource) : acelib, taolib, install, tao_output, taodefaults, ace_qtreactor, tao_versioning_idl_defaults { +project(TAO_QtResource) : acelib, taolib, install, tao_output, taodefaults, ace_qtreactor, taoidldefaults { sharedname = TAO_QtResource dynamicflags += TAO_QTRESOURCE_BUILD_DLL diff --git a/TAO/tao/QtResource/QtResource_Loader.h b/TAO/tao/QtResource/QtResource_Loader.h index 2f7ef42e7a7..1ae1191f104 100644 --- a/TAO/tao/QtResource/QtResource_Loader.h +++ b/TAO/tao/QtResource/QtResource_Loader.h @@ -23,7 +23,11 @@ #include "tao/Versioned_Namespace.h" +#if defined (ACE_HAS_QT4) +#include <Qt/qapplication.h> +#else #include <qapplication.h> +#endif TAO_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/RTCORBA.mpc b/TAO/tao/RTCORBA.mpc index 51443902e14..68c7d5cde0a 100644 --- a/TAO/tao/RTCORBA.mpc +++ b/TAO/tao/RTCORBA.mpc @@ -1,17 +1,40 @@ //$Id$ -project(RTCORBA) : taolib, tao_output, install, pi, tao_versioning_idl_defaults { - sharedname = TAO_RTCORBA - dynamicflags = TAO_RTCORBA_BUILD_DLL - requires += rt_corba +project(*core_idl) : tao_versioning_idl_defaults { + custom_only = 1 idlflags += -Sci -SS -Sorb -GX \ -Wb,export_macro=TAO_RTCORBA_Export \ -Wb,export_include=tao/RTCORBA/rtcorba_export.h \ -o RTCORBA + IDL_Files { + idlflags += -Sa \ + -Wb,unique_include=tao/RTCORBA/RTCORBA.h + RTCORBA/RTCORBA_include.pidl + } + + IDL_Files { + idlflags -= -Sa -St + idlflags += -Gp -Gd \ + -Wb,include_guard=TAO_RTCORBA_SAFE_INCLUDE \ + -Wb,safe_include=tao/RTCORBA/RTCORBA.h + RTCORBA/RTCORBA.pidl + } +} + +project(RTCORBA) : taolib, tao_output, install, pi, taoidldefaults { + after += *core_idl + sharedname = TAO_RTCORBA + dynamicflags = TAO_RTCORBA_BUILD_DLL + requires += rt_corba Source_Files { RTCORBA } + Source_Files { + RTCORBA/RTCORBA_includeC.cpp + RTCORBA/RTCORBAC.cpp + } + Header_Files { RTCORBA } @@ -33,16 +56,6 @@ project(RTCORBA) : taolib, tao_output, install, pi, tao_versioning_idl_defaults } IDL_Files { - idlflags += -Sa \ - -Wb,unique_include=tao/RTCORBA/RTCORBA.h - RTCORBA/RTCORBA_include.pidl - } - - IDL_Files { - idlflags += -Gp -Gd \ - -Wb,include_guard=TAO_RTCORBA_SAFE_INCLUDE \ - -Wb,safe_include=tao/RTCORBA/RTCORBA.h - RTCORBA/RTCORBA.pidl } Pkgconfig_Files { diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h index dc3888f6da7..e546ae6808f 100644 --- a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h +++ b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h @@ -62,6 +62,10 @@ public: virtual TAO_Invocation_Endpoint_Selector *get_selector (void); private: + void operator= (const RT_Endpoint_Selector_Factory &); + RT_Endpoint_Selector_Factory (const RT_Endpoint_Selector_Factory &); + +private: TAO_RT_Invocation_Endpoint_Selector *rt_invocation_endpoint_selector_; }; diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp index dde24c0455c..3b556b2816a 100644 --- a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp +++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp @@ -36,7 +36,7 @@ TAO_RT_Invocation_Endpoint_Selector::select_endpoint ( CORBA::Policy_var client_protocol_policy_base = TAO_RT_Endpoint_Utils::policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL, *r); - if (client_protocol_policy_base.ptr () == 0) + if (CORBA::is_nil(client_protocol_policy_base.in ())) { do { @@ -49,7 +49,6 @@ TAO_RT_Invocation_Endpoint_Selector::select_endpoint ( // If we get here, we completely failed to find an endpoint selector // that we know how to use, so throw an exception. - // NO NO throw ::CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); } else { @@ -120,9 +119,9 @@ TAO_RT_Invocation_Endpoint_Selector::select_endpoint_based_on_client_protocol_po // policy with no success. Throw exception. if (!valid_profile_found) { - if (r.inconsistent_policies ()) + CORBA::PolicyList *p = r.inconsistent_policies (); + if (p) { - CORBA::PolicyList *p = r.inconsistent_policies (); p->length (1); (*p)[0u] = CORBA::Policy::_duplicate (client_protocol_policy); @@ -132,8 +131,6 @@ TAO_RT_Invocation_Endpoint_Selector::select_endpoint_based_on_client_protocol_po // If we get here, we found at least one pertinent profile, but no // usable endpoints. - // throw ::CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); - } int @@ -164,14 +161,14 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( CORBA::Short max_priority = 0; // If the priority model policy is not set. - if (priority_model_policy.ptr () == 0) + if (CORBA::is_nil (priority_model_policy.in ())) { // Bands without priority model do not make sense. - if (bands_policy.ptr () != 0) + if (!CORBA::is_nil (bands_policy.in ())) { - if (r.inconsistent_policies ()) + CORBA::PolicyList *p = r.inconsistent_policies (); + if (p) { - CORBA::PolicyList *p = r.inconsistent_policies (); p->length (1); (*p)[0u] = CORBA::Policy::_duplicate (bands_policy.in ()); @@ -250,10 +247,9 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( // If priority doesn't fall into any of the bands. if (!in_range) { - if (r.inconsistent_policies ()) + CORBA::PolicyList *p = r.inconsistent_policies (); + if (p) { - - CORBA::PolicyList *p = r.inconsistent_policies (); p->length (2); (*p)[0u] = CORBA::Policy::_duplicate (bands_policy.in ()); (*p)[1u] = diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp index f43b7660213..6d70c55f9b2 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp @@ -26,6 +26,7 @@ ACE_RCSID (RTCORBA, #include "tao/RTCORBA/RT_ORB.h" #include "tao/RTCORBA/RT_Current.h" #include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h" +#include "tao/RTCORBA/RT_Service_Context_Handler.h" #include "tao/Exception.h" #include "tao/ORB_Core.h" @@ -86,6 +87,12 @@ TAO_RT_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info) throw ::CORBA::INTERNAL (); } + // Bind the service context handler for RTCORBA + TAO_RT_Service_Context_Handler* h = 0; + ACE_NEW (h, + TAO_RT_Service_Context_Handler()); + tao_info->orb_core ()->service_context_registry ().bind (IOP::RTCorbaPriority, h); + // Set the name of the Protocol_Hooks to be RT_Protocols_Hooks. tao_info->orb_core ()->orb_params ()->protocols_hooks_name ("RT_Protocols_Hooks"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Protocols_Hooks); diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp index cf2123c5759..886b839e784 100644 --- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp +++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp @@ -460,74 +460,6 @@ TAO_RT_Protocols_Hooks::get_dscp_codepoint (void) } void -TAO_RT_Protocols_Hooks::rt_service_context ( - TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart) -{ - // If the restart flag is true, then this call for a - // reinvocation. We need not prepare the Service Context List once - // again. We can use the already existing one. - if (!restart) - { - TAO_RT_Stub *rt_stub = - dynamic_cast<TAO_RT_Stub *> (stub); - - if (!rt_stub) - throw CORBA::INTERNAL (); - - CORBA::Policy_var priority_model_policy = - rt_stub->get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL); - - if (!CORBA::is_nil (priority_model_policy.in ())) - { - RTCORBA::PriorityModelPolicy_var model_policy_ptr = - RTCORBA::PriorityModelPolicy::_narrow (priority_model_policy.in ()); - - TAO_PriorityModelPolicy *priority_model = - static_cast<TAO_PriorityModelPolicy *> (model_policy_ptr.in ()); - - if (priority_model->get_priority_model () == RTCORBA::CLIENT_PROPAGATED) - { - CORBA::Short client_priority = -1; - // Get client thread priority from 'Current' or if not set by implying one - // from the native thread priority via the mapping. - if (this->get_thread_CORBA_priority (client_priority) != -1 || - this->get_thread_implicit_CORBA_priority (client_priority) != -1) - { - // OK - } - else - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "ERROR: TAO_RT_Protocols_Hooks::rt_service_context. " - "Unable to access RT CORBA Priority in client thread " - "accessing object with CLIENT_PROPAGATED priority model.\n")); - throw CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); - - } - - // Encapsulate the priority of the current thread into - // a service context. - TAO_OutputCDR cdr; - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << client_priority) == 0) - { - throw CORBA::MARSHAL (); - } - - service_context.set_context (IOP::RTCorbaPriority, cdr); - } - } - else - { - // The Object does not contain PriorityModel policy in its IOR. - // We must be talking to a non-RT ORB. Do nothing. - } - } -} - -void TAO_RT_Protocols_Hooks::get_selector_hook ( CORBA::Policy *model_policy, CORBA::Boolean &is_client_propagated, diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h index 3566e7e2c36..4cae8d8aab1 100644 --- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h +++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h @@ -19,6 +19,7 @@ #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 +#include "tao/RTCORBA/rtcorba_export.h" #include "tao/RTCORBA/Priority_Mapping_Manager.h" #include "tao/RTCORBA/Network_Priority_Mapping_Manager.h" @@ -80,10 +81,6 @@ public: CORBA::Long get_dscp_codepoint (void); - void rt_service_context (TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart); - void get_selector_hook (CORBA::Policy *model_policy, CORBA::Boolean &is_client_propagated, @@ -101,7 +98,7 @@ public: * some critical components. */ //@{ - int get_thread_CORBA_priority (CORBA::Short &); + int get_thread_CORBA_priority (CORBA::Short &priority); int get_thread_native_priority (CORBA::Short &); diff --git a/TAO/tao/RTCORBA/RT_Service_Context_Handler.cpp b/TAO/tao/RTCORBA/RT_Service_Context_Handler.cpp new file mode 100644 index 00000000000..d6cc3e03b57 --- /dev/null +++ b/TAO/tao/RTCORBA/RT_Service_Context_Handler.cpp @@ -0,0 +1,101 @@ +// $Id$ + +#include "tao/RTCORBA/RT_Service_Context_Handler.h" + +ACE_RCSID (RTCORBA, + RT_Service_Context_Handler, + "$Id$") + +#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 + +#include "tao/RTCORBA/RT_Policy_i.h" +#include "tao/RTCORBA/RT_Protocols_Hooks.h" +#include "tao/RTCORBA/RT_Stub.h" +#include "tao/CDR.h" +#include "tao/TAO_Server_Request.h" +#include "tao/Transport.h" +#include "tao/ORB_Core.h" +#include "tao/GIOP_Message_Base.h" +#include "tao/operation_details.h" +#include "tao/Transport_Mux_Strategy.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_RT_Service_Context_Handler::process_service_context ( + TAO_Transport&, + const IOP::ServiceContext&) +{ + return 0; +} + +int +TAO_RT_Service_Context_Handler::generate_service_context ( + TAO_Stub *stub, + TAO_Transport&, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &, + TAO_OutputCDR &) +{ + TAO_RT_Stub *rt_stub = + dynamic_cast<TAO_RT_Stub *> (stub); + + if (rt_stub) + { + CORBA::Policy_var priority_model_policy = + rt_stub->get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL); + + RTCORBA::PriorityModelPolicy_var model_policy_ptr = + RTCORBA::PriorityModelPolicy::_narrow (priority_model_policy.in ()); + + if (!CORBA::is_nil (model_policy_ptr.in ())) + { + TAO_PriorityModelPolicy *priority_model = + static_cast<TAO_PriorityModelPolicy *> (model_policy_ptr.in ()); + + if (priority_model->get_priority_model () == RTCORBA::CLIENT_PROPAGATED) + { + CORBA::Short client_priority = -1; + TAO_Protocols_Hooks *protocol_hooks = stub->orb_core ()->get_protocols_hooks (); + // Get client thread priority from 'Current' or if not set by implying one + // from the native thread priority via the mapping. + if (protocol_hooks && + (protocol_hooks->get_thread_CORBA_priority (client_priority) != -1 || + protocol_hooks->get_thread_implicit_CORBA_priority (client_priority) != -1)) + { + // OK + } + else + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "ERROR: TAO_RT_Protocols_Hooks::rt_service_context. " + "Unable to access RT CORBA Priority in client thread " + "accessing object with CLIENT_PROPAGATED priority model.\n")); + throw CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); + } + + // Encapsulate the priority of the current thread into + // a service context. + TAO_OutputCDR cdr; + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(cdr << client_priority)) + { + throw CORBA::MARSHAL (); + } + + opdetails.request_service_context ().set_context (IOP::RTCorbaPriority, cdr); + } + } + else + { + // The Object does not contain PriorityModel policy in its IOR. + // We must be talking to a non-RT ORB. Do nothing. + } + } + return 0; +} + + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif diff --git a/TAO/tao/RTCORBA/RT_Service_Context_Handler.h b/TAO/tao/RTCORBA/RT_Service_Context_Handler.h new file mode 100644 index 00000000000..eac15e175c5 --- /dev/null +++ b/TAO/tao/RTCORBA/RT_Service_Context_Handler.h @@ -0,0 +1,47 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file RT_Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_RT_SERVICE_CONTEXT_HANDLER_H +#define TAO_RT_SERVICE_CONTEXT_HANDLER_H +#include /**/ "ace/pre.h" +#include "tao/RTCORBA/rtcorba_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Service_Context_Handler.h" + +#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_RT_Service_Context_Handler : + public TAO_Service_Context_Handler +{ +public: + virtual int process_service_context (TAO_Transport& transport, + const IOP::ServiceContext& context); + virtual int generate_service_context ( + TAO_Stub *stub, + TAO_Transport &transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif + +#include /**/ "ace/post.h" +#endif /* TAO_RT_SERVICE_CONTEXT_HANDLER_H */ diff --git a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h index cfc5dbc30fa..9b96964b822 100644 --- a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h +++ b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h @@ -77,6 +77,10 @@ public: // @} +private: + void operator= (const TAO_RT_Thread_Lane_Resources_Manager &); + TAO_RT_Thread_Lane_Resources_Manager (const TAO_RT_Thread_Lane_Resources_Manager &); + protected: /// Default lane resources. diff --git a/TAO/tao/RTPortableServer.mpc b/TAO/tao/RTPortableServer.mpc index 7a651afbd09..80a582162a0 100644 --- a/TAO/tao/RTPortableServer.mpc +++ b/TAO/tao/RTPortableServer.mpc @@ -1,17 +1,39 @@ //$Id$ -project(RTPortableServer) : taolib, tao_output, install, rtcorba, portableserver, avoids_corba_e_micro { - sharedname = TAO_RTPortableServer - dynamicflags = TAO_RTPORTABLESERVER_BUILD_DLL - +project(*idl) : tao_versioning_idl_defaults, avoids_corba_e_micro { + custom_only = 1 idlflags += -Sci -SS -Sorb -GX \ -Wb,export_macro=TAO_RTPortableServer_Export \ -Wb,export_include=tao/RTPortableServer/rtportableserver_export.h \ -o RTPortableServer + IDL_Files { + idlflags += -Gp -Gd \ + -Wb,include_guard=TAO_RT_PORTABLESERVER_SAFE_INCLUDE \ + -Wb,safe_include=tao/RTPortableServer/RTPortableServer.h + RTPortableServer/RTPortableServer.pidl + } + + IDL_Files { + idlflags += -Sa \ + -Wb,unique_include=tao/RTPortableServer/RTPortableServer.h + RTPortableServer/RTPortableServer_include.pidl + } +} + +project(RTPortableServer) : taolib, tao_output, install, rtcorba, portableserver, avoids_corba_e_micro { + after += *idl + sharedname = TAO_RTPortableServer + dynamicflags = TAO_RTPORTABLESERVER_BUILD_DLL + Source_Files { RTPortableServer } + Source_Files { + RTPortableServer/RTPortableServerC.cpp + RTPortableServer/RTPortableServer_includeC.cpp + } + Header_Files { RTPortableServer } @@ -33,16 +55,7 @@ project(RTPortableServer) : taolib, tao_output, install, rtcorba, portableserver } IDL_Files { - idlflags += -Gp -Gd \ - -Wb,include_guard=TAO_RT_PORTABLESERVER_SAFE_INCLUDE \ - -Wb,safe_include=tao/RTPortableServer/RTPortableServer.h - RTPortableServer/RTPortableServer.pidl - } - - IDL_Files { - idlflags += -Sa \ - -Wb,unique_include=tao/RTPortableServer/RTPortableServer.h - RTPortableServer/RTPortableServer_include.pidl + RTPortableServer } Pkgconfig_Files { diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp index 63f2b2ff519..06a9054a1f9 100644 --- a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp +++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp @@ -41,8 +41,7 @@ TAO_RT_Servant_Dispatcher::pre_invoke_remote_request ( TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state ) { - TAO_Service_Context &request_service_context = - req.request_service_context (); + TAO_Service_Context &request_service_context = req.request_service_context (); TAO_Service_Context &reply_service_context = req.reply_service_context (); TAO_Thread_Pool *thread_pool = @@ -115,11 +114,11 @@ TAO_RT_Servant_Dispatcher::pre_invoke_remote_request ( (context->context_data.get_buffer ()), context->context_data.length ()); CORBA::Boolean byte_order; - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) throw ::CORBA::MARSHAL (); cdr.reset_byte_order (static_cast<int> (byte_order)); - if ((cdr >> target_priority) == 0) + if (!(cdr >> target_priority)) throw ::CORBA::MARSHAL (); // Save the target priority in the response service diff --git a/TAO/tao/RTScheduler.mpc b/TAO/tao/RTScheduler.mpc index 841441264cf..836b6b1c4b8 100644 --- a/TAO/tao/RTScheduler.mpc +++ b/TAO/tao/RTScheduler.mpc @@ -1,5 +1,28 @@ //$Id$ -project(RTScheduler) : taolib, tao_output, rtcorba, pi, pi_server, portableserver, install, corba_messaging, tao_versioning_idl_defaults, avoids_corba_e_micro { +project(*idl) : tao_versioning_idl_defaults, avoids_corba_e_micro { + custom_only = 1 + IDL_Files { + idlflags += -Gp -Gd -Sci -SS -Sorb -GX \ + -Wb,export_macro=TAO_RTScheduler_Export \ + -Wb,export_include=tao/RTScheduling/rtscheduler_export.h \ + -Wb,include_guard=TAO_RTSCHEDULER_SAFE_INCLUDE \ + -Wb,safe_include=tao/RTScheduling/RTScheduler.h \ + -o RTScheduling + RTScheduling/RTScheduler.pidl + } + + IDL_Files { + idlflags += -SS -Sorb -GX -Sci \ + -Wb,export_macro=TAO_RTScheduler_Export \ + -Wb,export_include=tao/RTScheduling/rtscheduler_export.h \ + -Wb,unique_include=tao/RTScheduling/RTScheduler.h \ + -o RTScheduling + RTScheduling/RTScheduler_include.pidl + } +} + +project(RTScheduler) : taolib, tao_output, rtcorba, pi, pi_server, portableserver, install, corba_messaging, taoidldefaults, avoids_corba_e_micro { + after += *idl sharedname = TAO_RTScheduler dynamicflags = TAO_RTSCHEDULER_BUILD_DLL @@ -7,6 +30,11 @@ project(RTScheduler) : taolib, tao_output, rtcorba, pi, pi_server, portableserve RTScheduling } + Source_Files { + RTScheduling/RTSchedulerC.cpp + RTScheduling/RTScheduler_includeC.cpp + } + Header_Files { RTScheduling } @@ -28,22 +56,6 @@ project(RTScheduler) : taolib, tao_output, rtcorba, pi, pi_server, portableserve } IDL_Files { - idlflags += -Gp -Gd -Sci -SS -Sorb -GX \ - -Wb,export_macro=TAO_RTScheduler_Export \ - -Wb,export_include=tao/RTScheduling/rtscheduler_export.h \ - -Wb,include_guard=TAO_RTSCHEDULER_SAFE_INCLUDE \ - -Wb,safe_include=tao/RTScheduling/RTScheduler.h \ - -o RTScheduling - RTScheduling/RTScheduler.pidl - } - - IDL_Files { - idlflags += -SS -Sorb -GX -Sci \ - -Wb,export_macro=TAO_RTScheduler_Export \ - -Wb,export_include=tao/RTScheduling/rtscheduler_export.h \ - -Wb,unique_include=tao/RTScheduling/RTScheduler.h \ - -o RTScheduling - RTScheduling/RTScheduler_include.pidl } Pkgconfig_Files { diff --git a/TAO/tao/RTScheduling/RTScheduler.pidl b/TAO/tao/RTScheduling/RTScheduler.pidl index e578c205b88..2badcdfaa07 100644 --- a/TAO/tao/RTScheduling/RTScheduler.pidl +++ b/TAO/tao/RTScheduling/RTScheduler.pidl @@ -28,7 +28,7 @@ #include "tao/RTCORBA/RTCORBA_include.pidl" #include "tao/PortableServer/PortableServer_include.pidl" -#include "tao/PI/ClientRequestInfo.pidl" +#include "tao/PI/PI_include.pidl" #include "tao/PI_Server/ServerRequestInfo.pidl" #include "tao/PortableInterceptor.pidl" #include "tao/PI/PIForwardRequest.pidl" diff --git a/TAO/tao/Remote_Invocation.cpp b/TAO/tao/Remote_Invocation.cpp index e937eb30d7d..0e3ffa24553 100644 --- a/TAO/tao/Remote_Invocation.cpp +++ b/TAO/tao/Remote_Invocation.cpp @@ -36,20 +36,17 @@ namespace TAO } void - Remote_Invocation::init_target_spec (TAO_Target_Specification &target_spec) + Remote_Invocation::init_target_spec (TAO_Target_Specification &target_spec, + TAO_OutputCDR &output) { - /** - * Mega hack for RTCORBA start. I don't think that - * PortableInterceptor would work here esp. for RTCORBA. PI needs - * to be improved to help our cause. - */ - this->resolver_.stub ()->orb_core ()->service_context_list ( - this->resolver_.stub (), - this->details_.request_service_context (), - 0); - /** - * Mega hack for RTCORBA END - */ + // Generate all service contexts + this->resolver_.stub ()->orb_core ()->service_context_registry (). + generate_service_context ( + this->resolver_.stub (), + *this->resolver_.transport (), + this->details_, + target_spec, + output); TAO_Profile *pfile = this->resolver_.profile (); @@ -61,8 +58,7 @@ namespace TAO break; case TAO_Target_Specification::Profile_Addr: { - IOP::TaggedProfile *tp = - pfile->create_tagged_profile (); + IOP::TaggedProfile *tp = pfile->create_tagged_profile (); if (tp) { @@ -100,11 +96,11 @@ namespace TAO void Remote_Invocation::write_header (TAO_OutputCDR &out_stream) { - TAO_Target_Specification spec; - this->init_target_spec (spec); - this->resolver_.transport ()->clear_translators (0, &out_stream); + TAO_Target_Specification spec; + this->init_target_spec (spec, out_stream); + // Send the request for the header if (this->resolver_.transport ()->generate_request_header (this->details_, spec, diff --git a/TAO/tao/Remote_Invocation.h b/TAO/tao/Remote_Invocation.h index 78b2a02ce31..9af15d3ac29 100644 --- a/TAO/tao/Remote_Invocation.h +++ b/TAO/tao/Remote_Invocation.h @@ -66,7 +66,7 @@ namespace TAO protected: /// Initialize the @a spec. - void init_target_spec (TAO_Target_Specification &spec); + void init_target_spec (TAO_Target_Specification &spec, TAO_OutputCDR& output); /// Write the GIOP header into the stream. void write_header (TAO_OutputCDR &out_stream); diff --git a/TAO/tao/Reply_Dispatcher.cpp b/TAO/tao/Reply_Dispatcher.cpp index eb6f608eaa2..e69fec458e2 100644 --- a/TAO/tao/Reply_Dispatcher.cpp +++ b/TAO/tao/Reply_Dispatcher.cpp @@ -13,10 +13,12 @@ ACE_RCSID (tao, TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Constructor. -TAO_Reply_Dispatcher::TAO_Reply_Dispatcher (void) +TAO_Reply_Dispatcher::TAO_Reply_Dispatcher (ACE_Allocator *allocator) // Just an invalid reply status. : locate_reply_status_ (GIOP::UNKNOWN_OBJECT) , reply_status_ (GIOP::NO_EXCEPTION) + , refcnt_ (1) + , allocator_(allocator) { } @@ -25,4 +27,36 @@ TAO_Reply_Dispatcher::~TAO_Reply_Dispatcher (void) { } + +void +TAO_Reply_Dispatcher::intrusive_add_ref (TAO_Reply_Dispatcher* rd) +{ + if (rd != 0) + { + ++rd->refcnt_; + } +} + +void +TAO_Reply_Dispatcher::intrusive_remove_ref (TAO_Reply_Dispatcher* rd) +{ + if (rd != 0) + { + long tmp = --rd->refcnt_; + if (tmp <= 0) + { + if (rd->allocator_) + { + ACE_DES_FREE (rd, + rd->allocator_->free, + TAO_Reply_Dispatcher); + } + else + { + delete rd; + } + } + } +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Reply_Dispatcher.h b/TAO/tao/Reply_Dispatcher.h index e291148edfe..810e6b9ed39 100644 --- a/TAO/tao/Reply_Dispatcher.h +++ b/TAO/tao/Reply_Dispatcher.h @@ -27,6 +27,14 @@ #include "tao/Basic_Types.h" #include "tao/GIOPC.h" +#include "ace/Atomic_Op.h" +#include "ace/Intrusive_Auto_Ptr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Allocator; +ACE_END_VERSIONED_NAMESPACE_DECL + + TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Forward Declarations. @@ -52,7 +60,7 @@ class TAO_Export TAO_Reply_Dispatcher public: /// Constructor. - TAO_Reply_Dispatcher (void); + TAO_Reply_Dispatcher (ACE_Allocator *allocator = 0); /// Destructor. virtual ~TAO_Reply_Dispatcher (void); @@ -86,12 +94,23 @@ public: GIOP::ReplyStatusType reply_status (void) const; + static void intrusive_add_ref (TAO_Reply_Dispatcher*); + static void intrusive_remove_ref (TAO_Reply_Dispatcher*); + protected: /// LocateReply status. GIOP::LocateStatusType locate_reply_status_; // RequestReply status GIOP::ReplyStatusType reply_status_; + +private: + /// Support for intrusive reference counting + ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> refcnt_; + + /// Allocator that was used to allocate this reply dispatcher. In case of + /// zero we come from the heap. + ACE_Allocator *allocator_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Resume_Handle.inl b/TAO/tao/Resume_Handle.inl index e89466fd4e2..04e538f537f 100644 --- a/TAO/tao/Resume_Handle.inl +++ b/TAO/tao/Resume_Handle.inl @@ -30,9 +30,12 @@ TAO_Resume_Handle::set_flag (TAO_Handle_Resume_Flag fl) ACE_INLINE TAO_Resume_Handle & TAO_Resume_Handle::operator= (const TAO_Resume_Handle &rhs) { - this->orb_core_ = rhs.orb_core_; - this->handle_ = rhs.handle_; - this->flag_ = rhs.flag_; + if (this != &rhs) + { + this->orb_core_ = rhs.orb_core_; + this->handle_ = rhs.handle_; + this->flag_ = rhs.flag_; + } return *this; } diff --git a/TAO/tao/Seq_Out_T.h b/TAO/tao/Seq_Out_T.h index baaf937394a..2340b044b2d 100644 --- a/TAO/tao/Seq_Out_T.h +++ b/TAO/tao/Seq_Out_T.h @@ -43,7 +43,7 @@ public: operator T *& (); T * operator-> (void); - T_elem operator[] (CORBA::ULong index); + T_elem operator[] (CORBA::ULong index); T *& ptr (void); private: diff --git a/TAO/tao/Service_Context_Handler.h b/TAO/tao/Service_Context_Handler.h index 390fbd43d57..6c6430ef7d5 100644 --- a/TAO/tao/Service_Context_Handler.h +++ b/TAO/tao/Service_Context_Handler.h @@ -24,6 +24,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_Transport; +class TAO_Operation_Details; +class TAO_Target_Specification; +class TAO_Stub; /** * This is the base of handler classes that each can process a certain @@ -35,8 +38,17 @@ class TAO_Export TAO_Service_Context_Handler { public: TAO_Service_Context_Handler (void); - virtual int process_service_context (TAO_Transport& transport, - const IOP::ServiceContext& context) = 0; + virtual int process_service_context ( + TAO_Transport& transport, + const IOP::ServiceContext& context) = 0; + + virtual int generate_service_context ( + TAO_Stub *stub, + TAO_Transport& transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg) = 0; + virtual ~TAO_Service_Context_Handler (void); }; diff --git a/TAO/tao/Service_Context_Handler_Registry.cpp b/TAO/tao/Service_Context_Handler_Registry.cpp index 5fd8a69cf67..8323b56f41d 100644 --- a/TAO/tao/Service_Context_Handler_Registry.cpp +++ b/TAO/tao/Service_Context_Handler_Registry.cpp @@ -32,6 +32,29 @@ TAO_Service_Context_Registry::process_service_contexts ( return 0; } +int +TAO_Service_Context_Registry::generate_service_context ( + TAO_Stub *stub, + TAO_Transport& transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg) +{ + int result = 0; + for (Table::iterator x = this->registry_.begin (); + x != this->registry_.end (); + ++x) + { + if ((*x).second->generate_service_context ( + stub, transport, opdetails, spec, msg) == -1) + { + result = -1; + } + } + + return result; +} + TAO_Service_Context_Registry::~TAO_Service_Context_Registry (void) { for (Table::iterator x = this->registry_.begin (); diff --git a/TAO/tao/Service_Context_Handler_Registry.h b/TAO/tao/Service_Context_Handler_Registry.h index 071d5a62c31..ec900f09c19 100644 --- a/TAO/tao/Service_Context_Handler_Registry.h +++ b/TAO/tao/Service_Context_Handler_Registry.h @@ -27,6 +27,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_Transport; class TAO_Service_Context_Handler; +class TAO_Operation_Details; +class TAO_Target_Specification; +class TAO_Stub; class TAO_Export TAO_Service_Context_Registry { @@ -47,6 +50,13 @@ class TAO_Export TAO_Service_Context_Registry int process_service_contexts (IOP::ServiceContextList &sc, TAO_Transport& transport); + int generate_service_context ( + TAO_Stub *stub, + TAO_Transport& transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); + private: typedef ACE_Array_Map<IOP::ServiceId, TAO_Service_Context_Handler*> Table; diff --git a/TAO/tao/SmartProxies.mpc b/TAO/tao/SmartProxies.mpc index d5c022af82f..a700015527d 100644 --- a/TAO/tao/SmartProxies.mpc +++ b/TAO/tao/SmartProxies.mpc @@ -24,6 +24,7 @@ project(SmartProxies) : taolib, tao_output, install, tao_versioning_idl_defaults } PIDL_Files { + SmartProxies } IDL_Files { diff --git a/TAO/tao/Strategies.mpc b/TAO/tao/Strategies.mpc index 9202eec2752..ce106eb6b1d 100644 --- a/TAO/tao/Strategies.mpc +++ b/TAO/tao/Strategies.mpc @@ -1,6 +1,21 @@ //$Id$ +project(*core_idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Sci -SS -Gp -Gd -Sorb -DCORBA3 \ + -Wb,export_macro=TAO_Strategies_Export \ + -Wb,export_include=tao/Strategies/strategies_export.h \ + -o Strategies + idlflags -= -St + Strategies/uiop_endpoints.pidl + Strategies/sciop_endpoints.pidl + Strategies/COIOP_Endpoints.pidl + } + +} -project(Strategies) : taolib, tao_output, install, pi, core_anytypecode, core_strategies, tao_versioning_idl_defaults { +project(Strategies) : taolib, tao_output, install, pi, anytypecode, core_strategies, taoidldefaults { + after += *core_idl sharedname = TAO_Strategies dynamicflags = TAO_STRATEGIES_BUILD_DLL @@ -8,6 +23,12 @@ project(Strategies) : taolib, tao_output, install, pi, core_anytypecode, core_st Strategies } + Source_Files { + Strategies/uiop_endpointsC.cpp + Strategies/sciop_endpointsC.cpp + Strategies/COIOP_EndpointsC.cpp + } + Header_Files { Strategies } @@ -25,17 +46,10 @@ project(Strategies) : taolib, tao_output, install, pi, core_anytypecode, core_st } PIDL_Files { + Strategies } IDL_Files { - idlflags += -Sci -SS -Gp -Gd -Sorb -DCORBA3 \ - -Wb,export_macro=TAO_Strategies_Export \ - -Wb,export_include=tao/Strategies/strategies_export.h \ - -o Strategies - idlflags -= -St - Strategies/uiop_endpoints.pidl - Strategies/sciop_endpoints.pidl - Strategies/COIOP_Endpoints.pidl } Pkgconfig_Files { diff --git a/TAO/tao/Strategies/DIOP_Acceptor.cpp b/TAO/tao/Strategies/DIOP_Acceptor.cpp index cc89e7c2e18..a979517c7bd 100644 --- a/TAO/tao/Strategies/DIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/DIOP_Acceptor.cpp @@ -321,7 +321,7 @@ TAO_DIOP_Acceptor::open (TAO_ORB_Core *orb_core, { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ") - ACE_TEXT ("DIOP_Acceptor::open, specified host=%s:%d\n"), + ACE_TEXT ("DIOP_Acceptor::open, specified host=%C:%d\n"), (specified_hostname.length () == 0 ? "<null>" : specified_hostname.c_str ()), addr.get_port_number ())); } diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp index 21092a76263..5aa66011513 100644 --- a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp @@ -285,7 +285,7 @@ TAO_DIOP_Connection_Handler::handle_input (ACE_HANDLE h) int TAO_DIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - int result = + int const result = this->handle_output_eh (handle, this); if (result == -1) @@ -393,7 +393,7 @@ TAO_DIOP_Connection_Handler::set_tos (int tos) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - DIOP_Connection_Handler::" - "set_dscp_codepoint, dscp: %x; result: %d; %s\n", + "set_dscp_codepoint, dscp: %x; result: %d; %C\n", tos, result, result == -1 ? "try running as superuser" : "")); diff --git a/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp b/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp index a60ed33ad4b..de79c013571 100644 --- a/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp +++ b/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp @@ -165,9 +165,13 @@ TAO_Optimized_Connection_Endpoint_Selector::select_endpoint } while (r->stub ()->next_profile_retry () != 0); - // If we get here, we completely failed to find an endpoint selector - // that we know how to use, so throw an exception. - throw ::CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); + // If we get here, we completely failed to find an endpoint + // that we know how to use. We used to throw an exception + // but that would prevent any request interception points + // being called. They may know how to fix the problem so + // we wait to throw the exception in + // Synch_Twoway_Invocation::remote_twoway and + // Synch_Oneway_Invocation::remote_oneway instead. } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Strategies/SCIOP_Acceptor.cpp b/TAO/tao/Strategies/SCIOP_Acceptor.cpp index 13256d30d65..b30ebd33316 100644 --- a/TAO/tao/Strategies/SCIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/SCIOP_Acceptor.cpp @@ -287,7 +287,7 @@ TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, ACE_TEXT ("TAO (%P|%t) ") ACE_TEXT ("SCIOP_Acceptor::open - ") ACE_TEXT ("no port number after the ") - ACE_TEXT ("colon in \"%s\"\n"), + ACE_TEXT ("colon in \"%C\"\n"), address), -1); } @@ -326,7 +326,7 @@ TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) ") ACE_TEXT ("SCIOP_Acceptor::open - ") - ACE_TEXT ("no hostnames in string \"%s\"\n"), + ACE_TEXT ("no hostnames in string \"%C\"\n"), tmp_host), -1); } @@ -418,7 +418,7 @@ TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Overriding address in IOR with %s\n"), + ACE_TEXT ("Overriding address in IOR with %C\n"), this->hostname_in_ior_)); } if (this->hostname (orb_core, @@ -776,7 +776,7 @@ TAO_SCIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core) if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Overriding address in IOR with %s\n"), + ACE_TEXT ("Overriding address in IOR with %C\n"), this->hostname_in_ior_)); } if (this->hostname (orb_core, @@ -980,7 +980,7 @@ TAO_SCIOP_Acceptor::parse_options (const char *str) if (slot == len - 1 || slot == ACE_CString::npos) ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) SCIOP option <%s> is ") + ACE_TEXT ("TAO (%P|%t) SCIOP option <%C> is ") ACE_TEXT ("missing a value.\n"), opt.c_str ()), -1); @@ -1008,7 +1008,7 @@ TAO_SCIOP_Acceptor::parse_options (const char *str) if (range < 1 || range > ACE_MAX_DEFAULT_PORT) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) Invalid SCIOP endpoint ") - ACE_TEXT ("portspan: <%s>\n") + ACE_TEXT ("portspan: <%C>\n") ACE_TEXT ("Valid range 1 -- %d\n"), value.c_str (), ACE_MAX_DEFAULT_PORT), -1); @@ -1021,7 +1021,7 @@ TAO_SCIOP_Acceptor::parse_options (const char *str) } else ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) Invalid SCIOP option: <%s>\n"), + ACE_TEXT ("TAO (%P|%t) Invalid SCIOP option: <%C>\n"), name.c_str ()), -1); diff --git a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp index 8ab30b5f351..33873fc18bc 100644 --- a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp @@ -415,8 +415,8 @@ TAO_SCIOP_Connection_Handler::set_tos (int tos) if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connection_Handler::" - "set_dscp_codepoint -> dscp: %x; result: %d; %s\n", + ACE_TEXT("TAO (%P|%t) - SCIOP_Connection_Handler::") + ACE_TEXT("set_dscp_codepoint -> dscp: %x; result: %d; %C\n"), tos, result, result == -1 ? "try running as superuser" : "")); diff --git a/TAO/tao/Strategies/SCIOP_Connector.cpp b/TAO/tao/Strategies/SCIOP_Connector.cpp index 7ac0d27bdcc..0acf1d555ef 100644 --- a/TAO/tao/Strategies/SCIOP_Connector.cpp +++ b/TAO/tao/Strategies/SCIOP_Connector.cpp @@ -275,7 +275,7 @@ TAO_SCIOP_Connector::make_connection_i (TAO::Profile_Transport_Resolver *r, if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - SCIOP_Connector::make_connection_i, " - "new %s connection to <%s:%d> on Transport[%d]\n", + "new %C connection to <%C:%d> on Transport[%d]\n", transport->is_connected() ? "connected" : "not connected", sciop_endpoint->host (), sciop_endpoint->port (), svc_handler->peer ().get_handle ())); diff --git a/TAO/tao/Strategies/SCIOP_Transport.cpp b/TAO/tao/Strategies/SCIOP_Transport.cpp index cc952bce2bb..777c8e08b3c 100644 --- a/TAO/tao/Strategies/SCIOP_Transport.cpp +++ b/TAO/tao/Strategies/SCIOP_Transport.cpp @@ -160,37 +160,6 @@ TAO_SCIOP_Transport::send_message (TAO_OutputCDR &stream, } int -TAO_SCIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) -{ - // Check whether we have a Bi Dir SCIOP policy set, whether the - // messaging objects are ready to handle bidirectional connections - // and also make sure that we have not recd. or sent any information - // regarding this before... - if (this->orb_core ()->bidir_giop_policy () && - this->messaging_object ()->is_ready_for_bidirectional (msg) && - this->bidirectional_flag () < 0) - { - this->set_bidir_context_info (opdetails); - - // Set the flag to 1 (i.e., originating side) - this->bidirectional_flag (1); - - // At the moment we enable BiDIR giop we have to get a new - // request id to make sure that we follow the even/odd rule - // for request id's. We only need to do this when enabled - // it, after that the Transport Mux Strategy will make sure - // that the rule is followed - opdetails.request_id (this->tms ()->request_id ()); - } - - return TAO_Transport::generate_request_header (opdetails, - spec, - msg); -} - -int TAO_SCIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr) { CORBA::Boolean byte_order; @@ -227,7 +196,7 @@ TAO_SCIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) acceptor++) { // Check whether it is a SCIOP acceptor - if ((*acceptor)->tag () == TAO_TAG_SCIOP_PROFILE) + if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) diff --git a/TAO/tao/Strategies/SCIOP_Transport.h b/TAO/tao/Strategies/SCIOP_Transport.h index 4f3c92f9ffb..7f1787c40b2 100644 --- a/TAO/tao/Strategies/SCIOP_Transport.h +++ b/TAO/tao/Strategies/SCIOP_Transport.h @@ -96,10 +96,6 @@ public: /*virtual int send_reply (TAO_OutputCDR &stream, TAO_Adapter *poa = 0);*/ - virtual int generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg); - virtual int tear_listen_point_list (TAO_InputCDR &cdr); virtual TAO_Connection_Handler * connection_handler_i (void); diff --git a/TAO/tao/Strategies/UIOP_Acceptor.cpp b/TAO/tao/Strategies/UIOP_Acceptor.cpp index 0fbf3fe9320..42b3f830449 100644 --- a/TAO/tao/Strategies/UIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/UIOP_Acceptor.cpp @@ -283,7 +283,7 @@ TAO_UIOP_Acceptor::open_i (const char *rendezvous, if (TAO_debug_level > 5) ACE_DEBUG ((LM_DEBUG, "\nTAO (%P|%t) UIOP_Acceptor::open_i - " - "listening on: <%s>\n", + "listening on: <%C>\n", addr.get_path_name ())); // In the event that an accept() fails, we can examine the reason. If @@ -452,7 +452,7 @@ TAO_UIOP_Acceptor::parse_options (const char *str) if (slot == len - 1 || slot == ACE_CString::npos) ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) UIOP option <%s> is " + "TAO (%P|%t) UIOP option <%C> is " "missing a value.\n", opt.c_str ()), -1); @@ -477,7 +477,7 @@ TAO_UIOP_Acceptor::parse_options (const char *str) } else ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid UIOP option: <%s>\n", + "TAO (%P|%t) Invalid UIOP option: <%C>\n", name.c_str ()), -1); } diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp index e23c6837bf5..8364a47784f 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp @@ -127,7 +127,7 @@ TAO_UIOP_Connection_Handler::open (void*) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) UIOP connection to server ") - ACE_TEXT ("<%s> on %d\n"), + ACE_TEXT ("<%C> on %d\n"), addr.get_path_name (), this->peer ().get_handle ())); // Set that the transport is now connected, if fails we return -1 diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index ab2abc5be54..1c8aae429f7 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -76,8 +76,7 @@ TAO_UIOP_Connector::close (void) } TAO_Profile * -TAO_UIOP_Connector::corbaloc_scan (const char *str, size_t &len - ) +TAO_UIOP_Connector::corbaloc_scan (const char *str, size_t &len) { if (this->check_prefix (str) != 0) return 0; @@ -88,7 +87,7 @@ TAO_UIOP_Connector::corbaloc_scan (const char *str, size_t &len if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_UIOP_CONNECTOR::corbaloc_scan error: " - "explicit terminating charactor '|' is missing from <%s>", + "explicit terminating charactor '|' is missing from <%C>", str)); return 0; } @@ -226,7 +225,7 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r, if (TAO_debug_level > 3) ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - UIOP_Connector::make_connection, " - "connection to <%s> failed (%p)\n", + "connection to <%C> failed (%p)\n", uiop_endpoint->rendezvous_point (), ACE_TEXT("errno"))); @@ -248,7 +247,7 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r, if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - UIOP_Connector::make_connection, " - "new %s connection to <%s> on Transport[%d]\n", + "new %C connection to <%C> on Transport[%d]\n", transport->is_connected() ? "connected" : "not connected", uiop_endpoint->rendezvous_point (), svc_handler->peer ().get_handle ())); diff --git a/TAO/tao/String_Sequence_Element_T.h b/TAO/tao/String_Sequence_Element_T.h index bbbb0e43748..8c54f185a46 100644 --- a/TAO/tao/String_Sequence_Element_T.h +++ b/TAO/tao/String_Sequence_Element_T.h @@ -114,10 +114,10 @@ public: return *this->element_; } - inline const character_type *_retn (void) { - value_type * copy_ = this->element_; + inline character_type *_retn (void) { + character_type * copy = *this->element_; *this->element_ = traits::default_initializer(); - return *copy_; + return copy; } void swap(string_sequence_element & rhs) diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp index 12847baf599..e0ad08a0a55 100644 --- a/TAO/tao/Synch_Invocation.cpp +++ b/TAO/tao/Synch_Invocation.cpp @@ -15,6 +15,7 @@ #include "tao/ORB_Core.h" #include "tao/Service_Context.h" #include "tao/SystemException.h" +#include "ace/Intrusive_Auto_Ptr.h" #if TAO_HAS_INTERCEPTORS == 1 # include "tao/PortableInterceptorC.h" @@ -55,8 +56,15 @@ namespace TAO { ACE_Countdown_Time countdown (max_wait_time); - TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (), - this->details_.reply_service_info ()); + TAO_Synch_Reply_Dispatcher *rd_p = 0; + ACE_NEW_NORETURN (rd_p, TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (), + this->details_.reply_service_info ())); + if (!rd_p) + { + throw ::CORBA::NO_MEMORY (); + } + + ACE_Intrusive_Auto_Ptr<TAO_Synch_Reply_Dispatcher> rd(rd_p, false); Invocation_Status s = TAO_INVOKE_FAILURE; @@ -101,7 +109,7 @@ namespace TAO // preallocated reply dispatcher. TAO_Bind_Dispatcher_Guard dispatch_guard ( this->details_.request_id (), - &rd, + rd.get (), transport->tms ()); if (dispatch_guard.status () != 0) @@ -163,7 +171,7 @@ namespace TAO // (explicitly coded) handlers called. We assume a POSIX.1c/C/C++ // environment. - s = this->wait_for_reply (max_wait_time, rd, dispatch_guard); + s = this->wait_for_reply (max_wait_time, *rd.get (), dispatch_guard); #if TAO_HAS_INTERCEPTORS == 1 if (s == TAO_INVOKE_RESTART) @@ -182,7 +190,7 @@ namespace TAO // What happens when the above call returns an error through // the return value? That would be bogus as per the contract // in the interface. The call violated the contract - s = this->check_reply_status (rd); + s = this->check_reply_status (*rd.get ()); // For some strategies one may want to release the transport // back to cache after receiving the reply. @@ -525,7 +533,7 @@ namespace TAO CORBA::ULong minor = 0; CORBA::ULong completion = 0; - if ((cdr >> minor) == 0 || (cdr >> completion) == 0) + if (!(cdr >> minor) || !(cdr >> completion)) { throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE); } diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp index 1827f98d0c5..e9ce6e621cc 100644 --- a/TAO/tao/TAO_Internal.cpp +++ b/TAO/tao/TAO_Internal.cpp @@ -503,7 +503,7 @@ namespace return pcfg->open (command_line.get_argc (), command_line.get_TCHAR_argv (), - ACE_DEFAULT_LOGGER_KEY, + 0, 0, // Don't ignore static services. ignore_default_svc_conf_file); } diff --git a/TAO/tao/TC.mpc b/TAO/tao/TC.mpc index dd8514378b9..1127c0bb322 100644 --- a/TAO/tao/TC.mpc +++ b/TAO/tao/TC.mpc @@ -1,7 +1,18 @@ //$Id$ +project(*idl) : taolib_with_idl, tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Wb,export_include=tao/TransportCurrent/Transport_Current_Export.h \ + -Wb,export_macro=TAO_Transport_Current_Export \ + -o TransportCurrent -I./TransportCurrent + idlflags -= -Sa -St -Sci -SS -project(TC) : taolib_with_idl, tao_output, tao_versioning_idl_defaults, install, interceptors, pi { + TransportCurrent/TC.idl + } +} +project(TC) : taolib_with_idl, tao_output, taoidldefaults, install, interceptors, pi { + after += *idl requires += transport_current sharedname = TAO_TC dynamicflags = TAO_TRANSPORT_CURRENT_BUILD_DLL @@ -12,6 +23,10 @@ project(TC) : taolib_with_idl, tao_output, tao_versioning_idl_defaults, install, TransportCurrent/Current_ORBInitializer_Base.cpp } + Source_Files { + TransportCurrent/TCC.cpp + } + Header_Files { TransportCurrent/Current_Impl.h TransportCurrent/Current_Loader.h @@ -28,19 +43,14 @@ project(TC) : taolib_with_idl, tao_output, tao_versioning_idl_defaults, install, TransportCurrent/Current_ORBInitializer.cpp } - IDL_Files { - idlflags += -Wb,export_include=tao/TransportCurrent/Transport_Current_Export.h \ - -Wb,export_macro=TAO_Transport_Current_Export \ - -o TransportCurrent -I./TransportCurrent - idlflags -= -Sa -St -Sci -SS - - TransportCurrent/TC.idl - } - Resource_Files { } PIDL_Files { + TransportCurrent + } + + IDL_Files { } } diff --git a/TAO/tao/TC_IIOP.mpc b/TAO/tao/TC_IIOP.mpc index 771a13ee5ac..7f44e1a677a 100644 --- a/TAO/tao/TC_IIOP.mpc +++ b/TAO/tao/TC_IIOP.mpc @@ -1,7 +1,18 @@ //$Id$ +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -Wb,export_include=tao/TransportCurrent/Transport_Current_Export.h \ + -Wb,export_macro=TAO_Transport_Current_Export \ + -o TransportCurrent -I./TransportCurrent + idlflags -= -Sa -St -project(TC_IIOP) : taolib_with_idl, tao_output, tao_versioning_idl_defaults, install, tc, interceptors, pi { + TransportCurrent/TC_IIOP.idl + } +} +project(TC_IIOP) : taolib_with_idl, tao_output, taoidldefaults, install, tc, interceptors, pi { + after += *idl requires += transport_current sharedname = TAO_TC_IIOP @@ -12,6 +23,10 @@ project(TC_IIOP) : taolib_with_idl, tao_output, tao_versioning_idl_defaults, ins TransportCurrent/IIOP_Current_Loader.cpp } + Source_Files { + TransportCurrent/TC_IIOPC.cpp + } + Header_Files { TransportCurrent/IIOP_Current_Impl.h TransportCurrent/IIOP_Current_Loader.h @@ -25,17 +40,12 @@ project(TC_IIOP) : taolib_with_idl, tao_output, tao_versioning_idl_defaults, ins } IDL_Files { - idlflags += -Wb,export_include=tao/TransportCurrent/Transport_Current_Export.h \ - -Wb,export_macro=TAO_Transport_Current_Export \ - -o TransportCurrent -I./TransportCurrent - idlflags -= -Sa -St - - TransportCurrent/TC_IIOP.idl } Resource_Files { } PIDL_Files { + TransportCurrent } } diff --git a/TAO/tao/Thread_Lane_Resources_Manager.h b/TAO/tao/Thread_Lane_Resources_Manager.h index 6341fc475c1..e14b9577f85 100644 --- a/TAO/tao/Thread_Lane_Resources_Manager.h +++ b/TAO/tao/Thread_Lane_Resources_Manager.h @@ -72,6 +72,10 @@ public: TAO_LF_Strategy &lf_strategy (void); // @} +private: + void operator= (const TAO_Thread_Lane_Resources_Manager &); + TAO_Thread_Lane_Resources_Manager (const TAO_Thread_Lane_Resources_Manager &); + protected: /// The ORB Core. TAO_ORB_Core * const orb_core_; diff --git a/TAO/tao/TkResource.mpc b/TAO/tao/TkResource.mpc index f7808b1f5d2..e55608ccc7a 100644 --- a/TAO/tao/TkResource.mpc +++ b/TAO/tao/TkResource.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- now wouldn't this be cool... // $Id$ -project(TAO_TkResource) : acelib, taolib, install, tao_output, taodefaults, ace_tkreactor, tao_versioning_idl_defaults { +project(TAO_TkResource) : acelib, taolib, install, tao_output, taodefaults, ace_tkreactor, taoidldefaults { sharedname = TAO_TkResource dynamicflags += TAO_TKRESOURCE_BUILD_DLL diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index f4011d541e0..fce3f82b2bc 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -444,15 +444,6 @@ TAO_Transport::generate_request_header ( TAO_Target_Specification &spec, TAO_OutputCDR &output) { - // Codeset service context is only supposed to be sent in the first request - // on a particular connection. - if (this->first_request_) - { - TAO_Codeset_Manager * const csm = this->orb_core ()->codeset_manager (); - if (csm) - csm->generate_service_context (opdetails, *this); - } - if (this->messaging_object ()->generate_request_header (opdetails, spec, output) == -1) @@ -2759,6 +2750,11 @@ TAO_Transport::allocate_partial_message_block (void) } } +void +TAO_Transport::set_bidir_context_info (TAO_Operation_Details &) +{ +} + /* * Hook to add concrete implementations from the derived class onto * TAO's transport. diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index 8742a63f3e0..fb348274d7f 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -563,6 +563,8 @@ public: /// Can the transport be purged? bool can_be_purged (void); + virtual void set_bidir_context_info (TAO_Operation_Details &opdetails); + /* * Specialization hook to add public methods from * concrete transport implementations to TAO's transport diff --git a/TAO/tao/Transport_Mux_Strategy.h b/TAO/tao/Transport_Mux_Strategy.h index 34ecd995d5f..cd2b6fac2cd 100644 --- a/TAO/tao/Transport_Mux_Strategy.h +++ b/TAO/tao/Transport_Mux_Strategy.h @@ -22,6 +22,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/Basic_Types.h" +#include "tao/Reply_Dispatcher.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Lock; @@ -29,7 +30,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL -class TAO_Reply_Dispatcher; class TAO_Transport; class TAO_Pluggable_Reply_Params; @@ -58,7 +58,7 @@ public: /// Bind the dispatcher with the request id. Commonalities in the /// derived class implementations is kept here. virtual int bind_dispatcher (CORBA::ULong request_id, - TAO_Reply_Dispatcher *rd) = 0; + ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd) = 0; /** * Unbind the dispatcher, the client is no longer waiting for the diff --git a/TAO/tao/Transport_Selection_Guard.h b/TAO/tao/Transport_Selection_Guard.h index a9ea238970b..3c2eaad7bb8 100644 --- a/TAO/tao/Transport_Selection_Guard.h +++ b/TAO/tao/Transport_Selection_Guard.h @@ -96,10 +96,13 @@ namespace TAO }; Transport_Selection_Guard& operator=(const Transport_Selection_Guard& rhs) { + if (this != &rhs) + { #if TAO_HAS_TRANSPORT_CURRENT == 1 - prev_ = rhs.prev_; + prev_ = rhs.prev_; #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ - curr_ = rhs.curr_; + curr_ = rhs.curr_; + } return *this; } diff --git a/TAO/tao/TypeCodeFactory.mpc b/TAO/tao/TypeCodeFactory.mpc index 00eba1e5fd4..8733376e7f7 100644 --- a/TAO/tao/TypeCodeFactory.mpc +++ b/TAO/tao/TypeCodeFactory.mpc @@ -1,5 +1,18 @@ //$Id$ -project(TypeCodeFactory) : taolib, tao_output, install, ifr_client, tao_versioning_idl_defaults { +project(*idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags += -SS -Sci -Sorb \ + -Wb,export_macro=TAO_TypeCodeFactory_Export \ + -Wb,export_include=tao/TypeCodeFactory/typecodefactory_export.h \ + -o TypeCodeFactory + idlflags -= -Sa -St + TypeCodeFactory/TypeCodeFactory.pidl + } +} + +project(TypeCodeFactory) : taolib, tao_output, install, ifr_client, taoidldefaults { + after += *idl sharedname = TAO_TypeCodeFactory dynamicflags = TAO_TYPECODEFACTORY_BUILD_DLL @@ -7,6 +20,10 @@ project(TypeCodeFactory) : taolib, tao_output, install, ifr_client, tao_versioni TypeCodeFactory } + Source_Files { + TypeCodeFactory/TypeCodeFactoryC.cpp + } + Header_Files { TypeCodeFactory } @@ -24,15 +41,10 @@ project(TypeCodeFactory) : taolib, tao_output, install, ifr_client, tao_versioni } PIDL_Files { + TypeCodeFactory } IDL_Files { - idlflags += -SS -Sci -Sorb \ - -Wb,export_macro=TAO_TypeCodeFactory_Export \ - -Wb,export_include=tao/TypeCodeFactory/typecodefactory_export.h \ - -o TypeCodeFactory - idlflags -= -Sa -St - TypeCodeFactory/TypeCodeFactory.pidl } Pkgconfig_Files { diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp index 78b8e665596..f8204186c0b 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp @@ -896,13 +896,13 @@ TAO_TypeCodeFactory_i::compute_default_label ( dv.enum_val = 0; CORBA::ULong const len = members.length (); - int success = 0; + bool success = false; // A collision forces us to start over, because the label // values need not be in sorted order. - while (success == 0) + while (!success) { - success = 1; + success = true; for (CORBA::ULong i = 0; i < len; ++i) { @@ -921,7 +921,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.char_val == dv.char_val) { dv.char_val++; - success = 0; + success = false; } break; case CORBA::tk_boolean: @@ -930,7 +930,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.bool_val == dv.bool_val) { dv.bool_val = !dv.bool_val; - success = 0; + success = false; } break; case CORBA::tk_short: @@ -939,7 +939,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.short_val == dv.short_val) { dv.short_val++; - success = 0; + success = false; } break; case CORBA::tk_ushort: @@ -948,7 +948,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.ushort_val == dv.ushort_val) { dv.ushort_val++; - success = 0; + success = false; } break; case CORBA::tk_long: @@ -957,7 +957,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.long_val == dv.long_val) { dv.long_val++; - success = 0; + success = false; } break; case CORBA::tk_ulong: @@ -966,7 +966,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.ulong_val == dv.ulong_val) { dv.ulong_val++; - success = 0; + success = false; } break; #if !defined (ACE_LACKS_LONGLONG_T) @@ -976,7 +976,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.ulonglong_val == dv.ulonglong_val) { dv.ulonglong_val++; - success = 0; + success = false; } break; #endif /* ACE_LACKS_LONGLONG_T */ @@ -1011,7 +1011,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( if (u.enum_val == dv.enum_val) { dv.enum_val++; - success = 0; + success = false; } break; } @@ -1020,7 +1020,7 @@ TAO_TypeCodeFactory_i::compute_default_label ( } // If there's been a collision, we should start over right away. - if (success == 0) + if (!success) { break; } @@ -1814,7 +1814,7 @@ TAO_TypeCodeFactory_i::check_recursion (CORBA::TCKind kind, || member_tc_kind == CORBA::tk_event) { char const * member_tc_id = member_tc->id (); - + if (working_id != 0 && ACE_OS::strcmp (working_id, member_tc_id) == 0) { @@ -1823,12 +1823,12 @@ TAO_TypeCodeFactory_i::check_recursion (CORBA::TCKind kind, // the recursion, which would otherwise never return. break; } - + // Update working_id to catch non-top-level recursion // of valuetype or eventtype. Other case caught below. working_id = member_tc_id; } - + bool const recursion_detected = this->check_recursion (kind, id, @@ -1856,7 +1856,7 @@ TAO_TypeCodeFactory_i::check_recursion (CORBA::TCKind kind, CORBA::TCKind const content_tc_kind = content_tc->kind (); - + char const * content_tc_id = 0; if (content_tc_kind == CORBA::tk_struct @@ -1875,7 +1875,7 @@ TAO_TypeCodeFactory_i::check_recursion (CORBA::TCKind kind, // end the recursion, which would otherwise never return. break; } - + if (content_tc_kind == CORBA::TAO_TC_KIND_COUNT) { if (ACE_OS::strcmp (id, content_tc_id) == 0) diff --git a/TAO/tao/Unbounded_Basic_String_Sequence_T.h b/TAO/tao/Unbounded_Basic_String_Sequence_T.h index b43ef6764f6..9f7fbd31546 100644 --- a/TAO/tao/Unbounded_Basic_String_Sequence_T.h +++ b/TAO/tao/Unbounded_Basic_String_Sequence_T.h @@ -14,6 +14,7 @@ #include "tao/Generic_Sequence_T.h" #include "tao/String_Sequence_Element_T.h" #include "tao/String_Const_Sequence_Element_T.h" +#include "tao/MM_Sequence_Iterator_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -113,9 +114,116 @@ public: } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO unbounded basic + /// string sequences. + /// + + // = Traits and factory methods that create iterators. + typedef MM_Sequence_Iterator<unbounded_basic_string_sequence<charT> > iterator; + typedef Const_MM_Sequence_Iterator<unbounded_basic_string_sequence<charT> > const_iterator; + typedef MM_Sequence_Reverse_Iterator<unbounded_basic_string_sequence<charT> > reverse_iterator; + typedef Const_MM_Sequence_Reverse_Iterator<unbounded_basic_string_sequence<charT> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + inline iterator begin (void) + { + return iterator (&this->impl_); + } + + // Get a const iterator that points to the beginning of the sequence. + inline const_iterator begin (void) const + { + return const_iterator (&this->impl_); + } + + // Get an iterator that points to the end of the sequence. + inline iterator end (void) + { + return iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a const iterator that points to the end of the sequence. + inline const_iterator end (void) const + { + return const_iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a reverse iterator that points to the end of the sequence. + inline reverse_iterator rbegin (void) + { + return reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + inline const_reverse_iterator rbegin (void) const + { + return const_reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + inline reverse_iterator rend (void) + { + return reverse_iterator (&this->impl_, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + inline const_reverse_iterator rend (void) const + { + return const_reverse_iterator (&this->impl_, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; }; + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 +/* +// Below is an attempt at template specialization that would +// not compile. It might be useful later. +// Generic_Sequence_Iterator template specializations for +// Unbounded_Basic_String_Sequence. These are needed since +// Unbounded_Basic_String_Sequence does some memory management with +// the strings. Without these specialization we leak memory. + +/// Dereference operator returns a reference to the item contained +/// at the current position. This dereference implies string +/// memory management. +// template<typename charT> + unbounded_basic_string_sequence<char>::element_type& + details::Generic_Sequence_Iterator<unbounded_basic_string_sequence<char>, unbounded_basic_string_sequence::allocation_traits, unbounded_basic_string_sequence::element_traits >::operator* (void) + { + // Access the underlying element in the sequence. + //return element_type (impl_[i], release()); + return element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release()); + } + + /// Returns a const reference to the item contained at the current position + // template<typename charT> + unbounded_basic_string_sequence<char>::const_element_type& + details::Generic_Sequence_Iterator<unbounded_basic_string_sequence<char> >::operator* (void) const + { + // Access the underlying element in the sequence. + //return const_element_type (impl_[i], release()); + return const_element_type ((*(this->sequence_))[this->pos_], + this->sequence_->release ()); + } +*/ +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + } // namespace TAO TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Unbounded_Object_Reference_Sequence_T.h b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h index 50d1ae9fd9b..5b91e166852 100644 --- a/TAO/tao/Unbounded_Object_Reference_Sequence_T.h +++ b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h @@ -14,6 +14,7 @@ #include "Generic_Sequence_T.h" #include "Object_Reference_Sequence_Element_T.h" #include "Object_Reference_Const_Sequence_Element_T.h" +#include "tao/MM_Sequence_Iterator_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -108,6 +109,77 @@ public: } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO unbounded object reference + /// sequences. + /// + + // = Traits and factory methods that create iterators. + typedef MM_Sequence_Iterator<unbounded_object_reference_sequence<object_t, object_t_var> > iterator; + typedef Const_MM_Sequence_Iterator<unbounded_object_reference_sequence<object_t, object_t_var> > const_iterator; + typedef MM_Sequence_Reverse_Iterator<unbounded_object_reference_sequence<object_t, object_t_var> > reverse_iterator; + typedef Const_MM_Sequence_Reverse_Iterator<unbounded_object_reference_sequence<object_t, object_t_var> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + iterator begin (void) + { + return iterator (&this->impl_); + } + + // Get a const iterator that points to the beginning of the sequence. + const_iterator begin (void) const + { + return const_iterator (&this->impl_); + } + + // Get an iterator that points to the end of the sequence. + iterator end (void) + { + return iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a const iterator that points to the end of the sequence. + const_iterator end (void) const + { + return const_iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a reverse iterator that points to the end of the sequence. + reverse_iterator rbegin (void) + { + return reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + const_reverse_iterator rbegin (void) const + { + return const_reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + reverse_iterator rend (void) + { + return reverse_iterator (&this->impl_, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + const_reverse_iterator rend (void) const + { + return const_reverse_iterator (&this->impl_, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; }; diff --git a/TAO/tao/Unbounded_Octet_Sequence_T.h b/TAO/tao/Unbounded_Octet_Sequence_T.h index 9434ecdba8f..25eddb02003 100644 --- a/TAO/tao/Unbounded_Octet_Sequence_T.h +++ b/TAO/tao/Unbounded_Octet_Sequence_T.h @@ -49,7 +49,7 @@ public: : maximum_ (allocation_traits::default_maximum()) , length_ (0) , buffer_ (allocation_traits::default_buffer_allocation()) - , release_ (true) + , release_ (buffer_ != 0) , mb_ (0) {} inline explicit unbounded_value_sequence<CORBA::Octet>(CORBA::ULong maximum) @@ -132,18 +132,6 @@ public: { if (this->mb_ == 0) { - if (length_ < length) - { - // TODO This code does not provide the strong-exception - // guarantee, but it does provide the weak-exception - // guarantee. The problem would appear when - // initialize_range() raises an exception after several - // elements have been modified. One could argue that - // this problem is irrelevant, as the elements already - // modified are unreachable to conforming applications. - element_traits::initialize_range( - buffer_ + length_, buffer_ + length); - } length_ = length; } else @@ -165,8 +153,6 @@ public: buffer_, buffer_ + length_, ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_)); - element_traits::initialize_range( - tmp.buffer_ + length_, tmp.buffer_ + length); swap(tmp); } inline value_type const & operator[](CORBA::ULong i) const { @@ -189,6 +175,7 @@ public: if (buffer_ == 0) { buffer_ = allocbuf(maximum_); + release_ = true; } return buffer_; } @@ -200,6 +187,10 @@ public: if (buffer_ == 0) { buffer_ = allocbuf(maximum_); + if (!orphan) + { + release_ = true; + } } if (!orphan) { @@ -268,6 +259,12 @@ public: , release_(false) , mb_ (0) { + if (rhs.maximum_ == 0 || rhs.buffer_ == 0) + { + maximum_ = rhs.maximum_; + length_ = rhs.length_; + return; + } unbounded_value_sequence<CORBA::Octet> tmp(rhs.maximum_); tmp.length_ = rhs.length_; if (rhs.mb_ == 0) @@ -312,7 +309,7 @@ private: /// If true then the sequence should release the buffer when it is /// destroyed. - CORBA::Boolean release_; + mutable CORBA::Boolean release_; ACE_Message_Block* mb_; }; diff --git a/TAO/tao/Unbounded_Value_Sequence_T.h b/TAO/tao/Unbounded_Value_Sequence_T.h index e39893e1f5c..dd52a85eeac 100644 --- a/TAO/tao/Unbounded_Value_Sequence_T.h +++ b/TAO/tao/Unbounded_Value_Sequence_T.h @@ -89,6 +89,71 @@ public: implementation_type::freebuf(buffer); } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO unbounded value + /// sequences. + /// + + // = Traits and factory methods that create iterators. + typedef details::Generic_Sequence_Iterator<details::generic_sequence<value_type, allocation_traits, element_traits> > iterator; + typedef details::Const_Generic_Sequence_Iterator<details::generic_sequence<value_type, allocation_traits, element_traits> > const_iterator; + typedef details::Generic_Sequence_Reverse_Iterator<details::generic_sequence<value_type, allocation_traits, element_traits> > reverse_iterator; + typedef details::Const_Generic_Sequence_Reverse_Iterator<details::generic_sequence<value_type, allocation_traits, element_traits> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + iterator begin (void) + { + return impl_.begin (); + } + + // Get a const iterator that points to the beginning of the sequence. + const_iterator begin (void) const + { + return impl_.begin (); + } + + // Get an iterator that points to the end of the sequence. + iterator end (void) + { + return impl_.end (); + } + + // Get a const iterator that points to the end of the sequence. + const_iterator end (void) const + { + return impl_.end (); + } + + // Get a reverse iterator that points to the end of the sequence. + reverse_iterator rbegin (void) + { + return impl_.rbegin (); + } + + // Get a const reverse iterator that points to the end of the sequence. + const_reverse_iterator rbegin (void) const + { + return impl_.rbegin (); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + reverse_iterator rend (void) + { + return impl_.rend (); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + const_reverse_iterator rend (void) const + { + return impl_.rend (); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; }; diff --git a/TAO/tao/Valuetype.mpc b/TAO/tao/Valuetype.mpc index c27b5e2a0a7..e64e6ddd81d 100644 --- a/TAO/tao/Valuetype.mpc +++ b/TAO/tao/Valuetype.mpc @@ -1,5 +1,18 @@ //$Id$ -project(Valuetype) : taolib, tao_output, install, core_anytypecode, avoids_corba_e_micro, tao_versioning_idl_defaults, gen_ostream { +project(*idl) : tao_versioning_idl_defaults, gen_ostream { + custom_only = 1 + IDL_Files { + idlflags += -SS -Sorb \ + -Wb,export_macro=TAO_Valuetype_Export \ + -Wb,export_include=tao/Valuetype/valuetype_export.h \ + -o Valuetype + idlflags -= -St + Valuetype/StringValue.pidl + } +} + +project(Valuetype) : taolib, tao_output, install, anytypecode, avoids_corba_e_micro, taoidldefaults, gen_ostream { + after += *idl sharedname = TAO_Valuetype dynamicflags = TAO_VALUETYPE_BUILD_DLL @@ -7,6 +20,10 @@ project(Valuetype) : taolib, tao_output, install, core_anytypecode, avoids_corba Valuetype } + Source_Files { + Valuetype/StringValueC.cpp + } + Header_Files { Valuetype } @@ -24,15 +41,10 @@ project(Valuetype) : taolib, tao_output, install, core_anytypecode, avoids_corba } PIDL_Files { + Valuetype } IDL_Files { - idlflags += -SS -Sorb \ - -Wb,export_macro=TAO_Valuetype_Export \ - -Wb,export_include=tao/Valuetype/valuetype_export.h \ - -o Valuetype - idlflags -= -St - Valuetype/StringValue.pidl } Pkgconfig_Files { diff --git a/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h b/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h index 08fa6bb75c5..a4656160425 100644 --- a/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h +++ b/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h @@ -13,6 +13,7 @@ #include "Valuetype_Traits_T.h" #include "tao/Generic_Sequence_T.h" #include "Valuetype_Sequence_Element_T.h" +#include "tao/MM_Sequence_Iterator_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -88,11 +89,86 @@ public: { return implementation_type::allocbuf(maximum); } + static value_type * allocbuf() + { + return implementation_type::allocbuf(MAX); + } static void freebuf(value_type * buffer) { implementation_type::freebuf(buffer); } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO bounded value type + /// sequences. + /// + + // = Traits and factory methods that create iterators. + typedef MM_Sequence_Iterator<bounded_valuetype_sequence<object_t, object_t_var, MAX> > iterator; + typedef Const_MM_Sequence_Iterator<bounded_valuetype_sequence<object_t, object_t_var, MAX> > const_iterator; + typedef MM_Sequence_Reverse_Iterator<bounded_valuetype_sequence<object_t, object_t_var, MAX> > reverse_iterator; + typedef Const_MM_Sequence_Reverse_Iterator<bounded_valuetype_sequence<object_t, object_t_var, MAX> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + inline iterator begin (void) + { + return iterator (&this->impl_); + } + + // Get a const iterator that points to the beginning of the sequence. + inline const_iterator begin (void) const + { + return const_iterator (&this->impl_); + } + + // Get an iterator that points to the end of the sequence. + inline iterator end (void) + { + return iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a const iterator that points to the end of the sequence. + inline const_iterator end (void) const + { + return const_iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a reverse iterator that points to the end of the sequence. + inline reverse_iterator rbegin (void) + { + return reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + inline const_reverse_iterator rbegin (void) const + { + return const_reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + inline reverse_iterator rend (void) + { + return reverse_iterator (&this->impl_, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + inline const_reverse_iterator rend (void) const + { + return const_reverse_iterator (&this->impl_, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; diff --git a/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h b/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h index 6abd2653ba7..e793815c8a6 100644 --- a/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h +++ b/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h @@ -13,6 +13,7 @@ #include "Valuetype_Traits_T.h" #include "tao/Generic_Sequence_T.h" #include "Valuetype_Sequence_Element_T.h" +#include "tao/MM_Sequence_Iterator_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -96,6 +97,77 @@ public: implementation_type::freebuf(buffer); } +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + /// + /// Additions to support iterator semantics for TAO unbounded value type + /// sequences. + /// + + // = Traits and factory methods that create iterators. + typedef MM_Sequence_Iterator<unbounded_valuetype_sequence<object_t, object_t_var> > iterator; + typedef Const_MM_Sequence_Iterator<unbounded_valuetype_sequence<object_t, object_t_var> > const_iterator; + typedef MM_Sequence_Reverse_Iterator<unbounded_valuetype_sequence<object_t, object_t_var> > reverse_iterator; + typedef Const_MM_Sequence_Reverse_Iterator<unbounded_valuetype_sequence<object_t, object_t_var> > const_reverse_iterator; + + // Get an iterator that points to the beginning of the sequence. + inline iterator begin (void) + { + return iterator (&this->impl_); + } + + // Get a const iterator that points to the beginning of the sequence. + inline const_iterator begin (void) const + { + return const_iterator (&this->impl_); + } + + // Get an iterator that points to the end of the sequence. + inline iterator end (void) + { + return iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a const iterator that points to the end of the sequence. + inline const_iterator end (void) const + { + return const_iterator (&this->impl_, + this->impl_.length ()); + } + + // Get a reverse iterator that points to the end of the sequence. + inline reverse_iterator rbegin (void) + { + return reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a const reverse iterator that points to the end of the sequence. + inline const_reverse_iterator rbegin (void) const + { + return const_reverse_iterator (&this->impl_, + this->impl_.length () - 1); + } + + // Get a reverse iterator that points to one before the beginning + // of the sequence. + inline reverse_iterator rend (void) + { + return reverse_iterator (&this->impl_, + -1); + } + + // Get a const reverse iterator that points to one before the + // beginning of the sequence. + inline const_reverse_iterator rend (void) const + { + return const_reverse_iterator (&this->impl_, + -1); + } + +#endif /* TAO_HAS_SEQUENCE_ITERATORS==1 */ + private: implementation_type impl_; diff --git a/TAO/tao/Version.h b/TAO/tao/Version.h index 1ed234fc2fe..5a7c10cb498 100644 --- a/TAO/tao/Version.h +++ b/TAO/tao/Version.h @@ -5,5 +5,5 @@ #define TAO_MAJOR_VERSION 1 #define TAO_MINOR_VERSION 6 -#define TAO_BETA_VERSION 8 -#define TAO_VERSION "1.6.8" +#define TAO_BETA_VERSION 9 +#define TAO_VERSION "1.6.9" diff --git a/TAO/tao/XtResource.mpc b/TAO/tao/XtResource.mpc index 28e0c508a4c..838f502b7b3 100644 --- a/TAO/tao/XtResource.mpc +++ b/TAO/tao/XtResource.mpc @@ -1,8 +1,7 @@ // -*- MPC -*- now wouldn't this be cool... // $Id$ -project(TAO_XtResource) : acelib, taolib, install, tao_output, taodefaults, ace_xtreactor, tao_versioning_idl_defaults { - +project(TAO_XtResource) : acelib, taolib, install, tao_output, taodefaults, ace_xtreactor, taoidldefaults { sharedname = TAO_XtResource dynamicflags += TAO_XTRESOURCE_BUILD_DLL diff --git a/TAO/tao/ZIOP.mpc b/TAO/tao/ZIOP.mpc index d7aa0e4b7fb..94d412bf29b 100644 --- a/TAO/tao/ZIOP.mpc +++ b/TAO/tao/ZIOP.mpc @@ -1,6 +1,20 @@ //$Id$ +project(*core_idl) : tao_versioning_idl_defaults { + custom_only = 1 + IDL_Files { + idlflags -= -Sa -St + idlflags += -Gp -Gd -Sci -SS -Sorb \ + -Wb,export_macro=TAO_ZIOP_Export \ + -Wb,export_include=tao/ZIOP/ziop_export.h \ + -Wb,include_guard=TAO_ZIOP_SAFE_INCLUDE \ + -Wb,safe_include=tao/ZIOP/ZIOP.h \ + -o ZIOP + ZIOP/ZIOP.pidl + } +} -project(ZIOP) : tao_output, install, taolib, compression, pi, tao_versioning_idl_defaults { +project(ZIOP) : tao_output, install, taolib, compression, pi, taoidldefaults { + after += *core_idl sharedname = TAO_ZIOP dynamicflags = TAO_ZIOP_BUILD_DLL @@ -8,6 +22,10 @@ project(ZIOP) : tao_output, install, taolib, compression, pi, tao_versioning_idl ZIOP } + Source_Files { + ZIOP/ZIOPC.cpp + } + Header_Files { ZIOP } @@ -29,14 +47,6 @@ project(ZIOP) : tao_output, install, taolib, compression, pi, tao_versioning_idl } IDL_Files { - idlflags -= -Sa -St - idlflags += -Gp -Gd -Sci -SS -Sorb \ - -Wb,export_macro=TAO_ZIOP_Export \ - -Wb,export_include=tao/ZIOP/ziop_export.h \ - -Wb,include_guard=TAO_ZIOP_SAFE_INCLUDE \ - -Wb,safe_include=tao/ZIOP/ZIOP.h \ - -o ZIOP - ZIOP/ZIOP.pidl } Pkgconfig_Files { diff --git a/TAO/tao/ZIOP/ZIOP.cpp b/TAO/tao/ZIOP/ZIOP.cpp index 910811b7fc9..ef689281ae5 100644 --- a/TAO/tao/ZIOP/ZIOP.cpp +++ b/TAO/tao/ZIOP/ZIOP.cpp @@ -103,6 +103,60 @@ TAO_ZIOP_Loader::Initializer (void) return ACE_Service_Config::process_directive (ace_svc_desc_TAO_ZIOP_Loader); } +const char * +TAO_ZIOP_Loader::ziop_compressorid_name (::Compression::CompressorId st) +{ + switch (st) + { + case ::Compression::COMPRESSORID_NONE: return "NONE"; + case ::Compression::COMPRESSORID_GZIP: return "GZIP"; + case ::Compression::COMPRESSORID_PKZIP: return "PKZIP"; + case ::Compression::COMPRESSORID_BZIP2: return "BZIP2"; + case ::Compression::COMPRESSORID_ZLIB: return "ZLIB"; + case ::Compression::COMPRESSORID_LZMA: return "LZMA"; + case ::Compression::COMPRESSORID_LZO: return "LZO"; + case ::Compression::COMPRESSORID_RZIP: return "RZIP"; + case ::Compression::COMPRESSORID_7X: return "7X"; + case ::Compression::COMPRESSORID_XAR: return "XAR"; + } + return "Unknown"; +} + +void +TAO_ZIOP_Loader::dump_msg (const char *type, const u_char *ptr, + size_t len, size_t original_data_length, + ::Compression::CompressorId compressor_id, + ::Compression::CompressionLevel compression_level) +{ + if (TAO_debug_level < 10) + { + return; + } + + static const char digits[] = "0123456789ABCD"; + int const byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; + CORBA::Double const ratio = 100 - (((CORBA::Double)len/original_data_length) * + (CORBA::Double) 100); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - ZIOP_Loader::dump_msg, ") + ACE_TEXT ("ZIOP message v%c.%c %C, %d data bytes, %s endian, ") + ACE_TEXT ("original_data_length = %d, ratio = %4.2f, ") + ACE_TEXT ("compressor = %C, compression_level = %d\n"), + digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]], + digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]], + type, + len - TAO_GIOP_MESSAGE_HEADER_LEN , + (byte_order == TAO_ENCAP_BYTE_ORDER) ? ACE_TEXT("my") : ACE_TEXT("other"), + original_data_length, + ratio, + TAO_ZIOP_Loader::ziop_compressorid_name(compressor_id), + compression_level)); + ACE_HEX_DUMP ((LM_DEBUG, + (const char *) ptr, + len, + ACE_TEXT ("ZIOP message"))); +} bool TAO_ZIOP_Loader::decompress (Compression::Compressor_ptr compressor, @@ -116,7 +170,8 @@ TAO_ZIOP_Loader::decompress (Compression::Compressor_ptr compressor, catch (::Compression::CompressionException &e) { ACE_ERROR_RETURN((LM_ERROR, - ACE_TEXT ("Decompression failed: %C\n"), + ACE_TEXT ("TAO (%P|%t) - TAO_ZIOP_Loader::decompress, ") + ACE_TEXT ("decompression failed, %C\n"), e._info ().c_str ()), false); } @@ -128,6 +183,12 @@ bool TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, TAO_ORB_Core& orb_core) { +#if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP == 0 + ACE_UNUSED_ARG (db); + ACE_UNUSED_ARG (qd); + ACE_UNUSED_ARG (orb_core); + return true; +#else CORBA::Object_var compression_manager = orb_core.resolve_compression_manager(); @@ -137,12 +198,12 @@ TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, if (!CORBA::is_nil(manager.in ())) { ZIOP::CompressedData data; - //first set the read pointer after the header + // first set the read pointer after the header size_t begin = qd.msg_block ()-> rd_ptr() - qd.msg_block ()->base (); char * initial_rd_ptr = qd.msg_block ()-> rd_ptr(); size_t const wr = qd.msg_block ()->wr_ptr () - qd.msg_block ()->base (); - TAO_InputCDR cdr (*db, + TAO_InputCDR cdr ((*db), qd.msg_block ()->self_flags (), begin + TAO_GIOP_MESSAGE_HEADER_LEN, wr, @@ -161,27 +222,37 @@ TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, if (decompress(compressor.in(), data.data, myout)) { - ACE_Message_Block *mb = new ACE_Message_Block(); - - mb->size ((size_t)(data.original_length + - TAO_GIOP_MESSAGE_HEADER_LEN)); + size_t new_data_length = (size_t)(data.original_length + + TAO_GIOP_MESSAGE_HEADER_LEN); + ACE_Message_Block mb (new_data_length); qd.msg_block ()->rd_ptr (initial_rd_ptr); - - mb->copy(qd.msg_block ()->base () + begin, + mb.copy(qd.msg_block ()->base () + begin, TAO_GIOP_MESSAGE_HEADER_LEN); - if (mb->copy((char*)myout.get_buffer(true), + if (mb.copy((char*)myout.get_buffer(false), (size_t)data.original_length) != 0) ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("TAO - (%P|%t) - ") - ACE_TEXT ("Failed to copy decompressed data : ") + ACE_TEXT ("TAO_ZIOP_Loader::decompress, ") + ACE_TEXT ("failed to copy decompressed data, ") ACE_TEXT ("Buffer too small\n")), false); - //change it into a GIOP message.. - mb->base ()[0] = 0x47; - ACE_CDR::mb_align (mb); - *db = mb->data_block (); + // change it into a GIOP message.. + mb.base ()[0] = 0x47; + ACE_CDR::mb_align (&mb); + + if (TAO_debug_level > 9) + { // we're only logging ZIOP messages. Log datablock before it's + // replaced by it's decompressed datablock + this->dump_msg ("before decompression", + reinterpret_cast <u_char *>(qd.msg_block ()->rd_ptr ()), + qd.msg_block ()->length (), data.original_length, + data.compressorid, compressor->compression_level ()); + } + //replace data block + *db = mb.data_block ()->duplicate (); + (*db)->size (new_data_length); return true; } } @@ -191,6 +262,7 @@ TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, } return true; +#endif } CORBA::ULong @@ -227,7 +299,8 @@ TAO_ZIOP_Loader::compress (Compression::Compressor_ptr compressor, catch (::Compression::CompressionException &e) { ACE_ERROR_RETURN((LM_ERROR, - ACE_TEXT ("Compression failed: %C\n"), + ACE_TEXT ("TAO (%P|%t) - TAO_ZIOP_Loader::compress, ") + ACE_TEXT ("compression failed, %C\n"), e._info ().c_str ()), false); } @@ -235,17 +308,26 @@ TAO_ZIOP_Loader::compress (Compression::Compressor_ptr compressor, return true; } +CORBA::ULong +TAO_ZIOP_Loader::get_ratio (CORBA::OctetSeq& uncompressed, CORBA::OctetSeq& compressed) +{ + return CORBA::ULong (100 - ((CORBA::Double)compressed.length () / uncompressed.length () * + (CORBA::Double)100)); +} + bool -TAO_ZIOP_Loader::check_min_ratio (::Compression::CompressionRatio ratio, +TAO_ZIOP_Loader::check_min_ratio (const CORBA::ULong& this_ratio, + ::Compression::CompressionRatio overall_ratio, CORBA::Long min_ratio) const { - bool accepted = min_ratio == 0 || ratio > min_ratio; + bool accepted = min_ratio == 0 || + static_cast < ::Compression::CompressionRatio>(this_ratio) > min_ratio; if (TAO_debug_level > 8) { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) - TAO_ZIOP_Loader::check_min_ratio: ") - ACE_TEXT ("Ratio:%d Accepted:%d\n"), - ratio, accepted)); + ACE_TEXT ("TAO (%P|%t) - TAO_ZIOP_Loader::check_min_ratio, ") + ACE_TEXT ("overall_ratio = %d, this_ratio = %d, accepted = %d\n"), + overall_ratio, this_ratio, accepted)); } return accepted; } @@ -262,13 +344,28 @@ TAO_ZIOP_Loader::get_compressor_details ( { compressor_id = (*list)[0].compressor_id; compression_level = (*list)[0].compression_level; + + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("TAO_ZIOP_Loader::get_compressor_details,") + ACE_TEXT ("compressor policy found, compressor = %C, ") + ACE_TEXT ("compression_level = %d\n"), + TAO_ZIOP_Loader::ziop_compressorid_name (compressor_id), + compression_level)); + } + } else { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - ") - ACE_TEXT ("TAO_ZIOP_Loader::get_compressor_details: ") - ACE_TEXT ("No appropriate compressor found\n"))); + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("TAO_ZIOP_Loader::get_compressor_details, ") + ACE_TEXT ("no appropriate compressor found\n"))); + } return false; } return true; @@ -294,17 +391,20 @@ TAO_ZIOP_Loader::get_compression_details( { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ") - ACE_TEXT ("TAO_ZIOP_Loader::get_compression_details: ") - ACE_TEXT ("No ZIOP policy set\n"))); + ACE_TEXT ("TAO_ZIOP_Loader::get_compression_details, ") + ACE_TEXT ("ZIOP enabled policy not set\n"))); } } } else { - ACE_ERROR((LM_ERROR, - ACE_TEXT("TAO (%P|%t) - ") - ACE_TEXT("TAO_ZIOP_Loader::get_compression_details : ") - ACE_TEXT("compression_enabling_policy is NIL. No ZIOP\n"))); + if (TAO_debug_level > 6) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("TAO_ZIOP_Loader::get_compression_details, ") + ACE_TEXT ("compression_enabling_policy is NIL, no ZIOP\n"))); + } } if (use_ziop) @@ -320,18 +420,22 @@ TAO_ZIOP_Loader::get_compression_details( compressor_id, compression_level); } } - else + else { - ACE_ERROR((LM_ERROR, - ACE_TEXT("TAO (%P|%t) - ") - ACE_TEXT("TAO_ZIOP_Loader::get_compression_details : ") - ACE_TEXT("Compression level policy not found\n"))); + if (TAO_debug_level > 6) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - ") + ACE_TEXT("TAO_ZIOP_Loader::get_compression_details, ") + ACE_TEXT("compressor ID/Level list policy not found\n"))); + } + use_ziop = false; } } return use_ziop; } -void +bool TAO_ZIOP_Loader::complete_compression (Compression::Compressor_ptr compressor, TAO_OutputCDR &cdr, ACE_Message_Block& mb, @@ -343,39 +447,50 @@ TAO_ZIOP_Loader::complete_compression (Compression::Compressor_ptr compressor, { if (low_value > 0 && original_data_length > low_value) { - CORBA::OctetSeq myout; + CORBA::OctetSeq output; CORBA::OctetSeq input (original_data_length, &mb); - myout.length (original_data_length); - - bool compressed = this->compress (compressor, input, myout); + output.length (original_data_length); - if (compressed && - (myout.length () < original_data_length) && - (this->check_min_ratio (compressor->compression_ratio(), - min_ratio))) + if (!this->compress (compressor, input, output)) + return false; + else if ((output.length () < original_data_length) && + (this->check_min_ratio (this->get_ratio (input, output), + compressor->compression_ratio(), + min_ratio))) { mb.wr_ptr (mb.rd_ptr ()); cdr.current_alignment (mb.wr_ptr() - mb.base ()); ZIOP::CompressedData data; data.compressorid = compressor_id; data.original_length = input.length(); - data.data = myout; + data.data = output; cdr << data; mb.rd_ptr(initial_rd_ptr); int begin = (mb.rd_ptr() - mb.base ()); mb.data_block ()->base ()[0 + begin] = 0x5A; mb.data_block ()->base ()[TAO_GIOP_MESSAGE_SIZE_OFFSET + begin] = cdr.length() - TAO_GIOP_MESSAGE_HEADER_LEN; + + if (TAO_debug_level > 9) + { + this->dump_msg ("after compression", reinterpret_cast <u_char *>(mb.rd_ptr ()), + mb.length (), data.original_length, + data.compressorid, compressor->compression_level ()); + } + } + else + return false; } else if (TAO_debug_level > 8) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ") - ACE_TEXT ("TAO_ZIOP_Loader::compress_data: ") - ACE_TEXT ("No compression used") - ACE_TEXT ("->Low Value Policy applied\n"))); + ACE_TEXT ("TAO_ZIOP_Loader::compress_data, ") + ACE_TEXT ("no compression used, ") + ACE_TEXT ("low value policy applied\n"))); } + return true; } bool @@ -386,6 +501,8 @@ TAO_ZIOP_Loader::compress_data (TAO_OutputCDR &cdr, Compression::CompressorId compressor_id, Compression::CompressionLevel compression_level) { + bool compressed = true; + cdr.consolidate (); ACE_Message_Block* current = const_cast <ACE_Message_Block*> (cdr.current ()); @@ -409,14 +526,14 @@ TAO_ZIOP_Loader::compress_data (TAO_OutputCDR &cdr, Compression::Compressor_var compressor = manager->get_compressor (compressor_id, compression_level); - complete_compression(compressor.in (), cdr, *current, + compressed = complete_compression(compressor.in (), cdr, *current, initial_rd_ptr, low_value, min_ratio, original_data_length, compressor_id); } } - //set back read pointer in case no compression was done... + // set back read pointer in case no compression was done... current->rd_ptr(initial_rd_ptr); - return true; + return compressed; } bool @@ -428,7 +545,8 @@ TAO_ZIOP_Loader::marshal_data (TAO_OutputCDR &cdr, TAO_Stub& stub) return true; #else CORBA::Boolean use_ziop = false; - Compression::CompressorId compressor_id = Compression::COMPRESSORID_ZLIB; + + Compression::CompressorId compressor_id = Compression::COMPRESSORID_NONE; Compression::CompressionLevel compression_level = 0; CORBA::Policy_var compression_enabling_policy = @@ -472,7 +590,7 @@ TAO_ZIOP_Loader::marshal_data (TAO_OutputCDR& cdr, TAO_ORB_Core& orb_core) return true; #else CORBA::Boolean use_ziop = false; - Compression::CompressorId compressor_id = Compression::COMPRESSORID_ZLIB; + Compression::CompressorId compressor_id = Compression::COMPRESSORID_NONE; Compression::CompressionLevel compression_level = 0; CORBA::Policy_var compression_enabling_policy = diff --git a/TAO/tao/ZIOP/ZIOP.h b/TAO/tao/ZIOP/ZIOP.h index f8639f3789e..1ce3ac690f7 100644 --- a/TAO/tao/ZIOP/ZIOP.h +++ b/TAO/tao/ZIOP/ZIOP.h @@ -60,6 +60,9 @@ public: /// Used to force the initialization of the ORB code. static int Initializer (void); + + /// Converts compressor ID to a compressor name. + static const char * ziop_compressorid_name (::Compression::CompressorId st); private: @@ -67,7 +70,13 @@ private: /// activated. static bool is_activated_; - /// Get the compression low value, returns 0 when it is not set + /// dump a ZIOP datablock after (de)compression + void dump_msg (const char *type, const u_char *ptr, + size_t len, size_t original_data_length, + ::Compression::CompressorId compressor_id, + ::Compression::CompressionLevel compression_level); + +/// Get the compression low value, returns 0 when it is not set CORBA::ULong compression_policy_value (CORBA::Policy_ptr policy) const; bool get_compressor_details ( @@ -80,7 +89,7 @@ private: Compression::CompressorId &compressor_id, Compression::CompressionLevel &compression_level); - void complete_compression (Compression::Compressor_ptr compressor, + bool complete_compression (Compression::Compressor_ptr compressor, TAO_OutputCDR &cdr, ACE_Message_Block& mb, char *initial_rd_ptr, @@ -103,8 +112,12 @@ private: bool decompress (Compression::Compressor_ptr compressor, const ::Compression::Buffer &source, ::Compression::Buffer &target); + + CORBA::ULong get_ratio (CORBA::OctetSeq& uncompressed, + CORBA::OctetSeq& compressed); - bool check_min_ratio (::Compression::CompressionRatio ratio, + bool check_min_ratio (const CORBA::ULong& this_ratio, + ::Compression::CompressionRatio overall_ratio, CORBA::Long min_ratio) const; }; diff --git a/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp b/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp index 0865acd51e3..9d9309925f3 100644 --- a/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp +++ b/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp @@ -7,6 +7,7 @@ #include "tao/ZIOP/ZIOP.h" #include "tao/ZIOP/ZIOP_Stub_Factory.h" #include "tao/ZIOP/ZIOP_PolicyFactory.h" +#include "tao/ZIOP/ZIOP_Service_Context_Handler.h" #include "tao/ORB_Core.h" #include "tao/PI/ORBInitInfo.h" @@ -43,6 +44,14 @@ TAO_ZIOP_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info) // Set the name of the stub factory to be ZIOP_Stub_Factory. tao_info->orb_core ()->orb_params ()->stub_factory_name ("ZIOP_Stub_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_ZIOP_Stub_Factory); + +#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 + // Bind the service context handler for ZIOP + TAO_ZIOP_Service_Context_Handler* h = 0; + ACE_NEW (h, + TAO_ZIOP_Service_Context_Handler()); + tao_info->orb_core ()->service_context_registry ().bind (IOP::INVOCATION_POLICIES, h); +#endif } void diff --git a/TAO/tao/ZIOP/ZIOP_Policy_i.cpp b/TAO/tao/ZIOP/ZIOP_Policy_i.cpp index c6306341d7a..8a25e5b902c 100644 --- a/TAO/tao/ZIOP/ZIOP_Policy_i.cpp +++ b/TAO/tao/ZIOP/ZIOP_Policy_i.cpp @@ -81,13 +81,7 @@ CompressorIdLevelListPolicy::destroy (void) ::Compression::CompressorIdLevelList * CompressorIdLevelListPolicy::compressor_ids (void) { - ::Compression::CompressorIdLevelList *tmp = 0; - ACE_NEW_THROW_EX (tmp, - ::Compression::CompressorIdLevelList (this->value_), - CORBA::NO_MEMORY (TAO::VMCID, - CORBA::COMPLETED_NO)); - - return tmp; + return &this->value_; } TAO_Cached_Policy_Type diff --git a/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp new file mode 100644 index 00000000000..7e0ad04cfec --- /dev/null +++ b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp @@ -0,0 +1,127 @@ +// $Id$ + +#include "tao/ZIOP/ZIOP_Service_Context_Handler.h" + +#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 + +ACE_RCSID (ZIOP, + ZIOP_Service_Context_Handler, + "$Id$") + +#include "tao/CDR.h" +#include "tao/Transport.h" +#include "tao/ORB_Core.h" +#include "tao/GIOP_Message_Base.h" +#include "tao/operation_details.h" +#include "tao/Stub.h" +#include "tao/ZIOP/ZIOP_Policy_i.h" +#include "tao/Messaging_PolicyValueC.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_ZIOP_Service_Context_Handler::process_service_context ( + TAO_Transport&, + const IOP::ServiceContext &) +{ + return 0; +} + +int +TAO_ZIOP_Service_Context_Handler::generate_service_context ( + TAO_Stub *stub, + TAO_Transport&, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &, + TAO_OutputCDR &) +{ + if (stub) + { + CORBA::Policy_var idpolicy = + stub->get_cached_policy (TAO_CACHED_COMPRESSION_ID_LEVEL_LIST_POLICY); + + CORBA::Policy_var enabledpolicy = + stub->get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY); + + ::ZIOP::CompressorIdLevelListPolicy_var idpolicyp = + ::ZIOP::CompressorIdLevelListPolicy::_narrow (idpolicy.in ()); + + ::ZIOP::CompressionEnablingPolicy_var enabledpolicyp = + ::ZIOP::CompressionEnablingPolicy::_narrow (enabledpolicy.in ()); + + Messaging::PolicyValueSeq policy_value_seq; + policy_value_seq.length (0); + TAO_OutputCDR out_CDR; + CORBA::ULong i = 0; + size_t length = 0; + + if (!CORBA::is_nil (idpolicyp.in ())) + { + policy_value_seq.length (i + 1); + policy_value_seq[i].ptype = idpolicyp->policy_type (); + + if (!(out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return 0; + + if (!(idpolicyp->_tao_encode (out_CDR))) + return 0; + + length = out_CDR.total_length (); + policy_value_seq[i].pvalue.length (static_cast <CORBA::ULong>(length)); + CORBA::Octet *buf = policy_value_seq[i].pvalue.get_buffer (); + + // Copy the CDR buffer data into the octet sequence buffer. + for (const ACE_Message_Block *iterator = out_CDR.begin (); + iterator != 0; + iterator = iterator->cont ()) + { + ACE_OS::memcpy (buf, iterator->rd_ptr (), iterator->length ()); + buf += iterator->length (); + } + ++i; + } + if (!CORBA::is_nil (enabledpolicyp.in ())) + { + policy_value_seq.length (i + 1); + policy_value_seq[i].ptype = enabledpolicyp->policy_type (); + + if (!(out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return 0; + + if (!(enabledpolicyp->_tao_encode (out_CDR))) + return 0; + + length = out_CDR.total_length (); + policy_value_seq[i].pvalue.length (static_cast <CORBA::ULong>(length)); + CORBA::Octet *buf = policy_value_seq[i].pvalue.get_buffer (); + + // Copy the CDR buffer data into the octet sequence buffer. + for (const ACE_Message_Block *iterator = out_CDR.begin (); + iterator != 0; + iterator = iterator->cont ()) + { + ACE_OS::memcpy (buf, iterator->rd_ptr (), iterator->length ()); + buf += iterator->length (); + } + ++i; + } + + if (policy_value_seq.length () > 0) + { + TAO_OutputCDR out_cdr; + if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return 0; + + if (!(out_cdr << policy_value_seq)) + return 0; + + opdetails.request_service_context ().set_context (IOP::INVOCATION_POLICIES, out_cdr); + } + } + + return 0; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif diff --git a/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h new file mode 100644 index 00000000000..24b9c6a766f --- /dev/null +++ b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h @@ -0,0 +1,47 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file ZIOP_Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_ZIOP_SERVICE_CONTEXT_HANDLER_H +#define TAO_ZIOP_SERVICE_CONTEXT_HANDLER_H +#include /**/ "ace/pre.h" +#include "tao/ZIOP/ziop_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Service_Context_Handler.h" + +#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_ZIOP_Service_Context_Handler : + public TAO_Service_Context_Handler +{ +public: + virtual int process_service_context (TAO_Transport& transport, + const IOP::ServiceContext& context); + virtual int generate_service_context ( + TAO_Stub *stub, + TAO_Transport &transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif + +#include /**/ "ace/post.h" +#endif /* TAO_ZIOP_SERVICE_CONTEXT_HANDLER_H */ diff --git a/TAO/tao/ZIOP/ZIOP_Stub.cpp b/TAO/tao/ZIOP/ZIOP_Stub.cpp index e52eb117e0f..fb245ff9cfe 100644 --- a/TAO/tao/ZIOP/ZIOP_Stub.cpp +++ b/TAO/tao/ZIOP/ZIOP_Stub.cpp @@ -5,6 +5,7 @@ #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 #include "tao/ZIOP/ZIOP_Policy_i.h" +#include "tao/ZIOP/ZIOP.h" #include "tao/ORB_Core.h" #include "tao/Policy_Set.h" #include "tao/Policy_Manager.h" @@ -187,22 +188,80 @@ TAO_ZIOP_Stub::effective_compression_id_list_policy (void) CORBA::Policy_var exposed = this->exposed_compression_id_list_policy (); - // Reconcile client-exposed and locally set values. - if (CORBA::is_nil (exposed.in ())) - return override._retn (); - - if (CORBA::is_nil (override.in ())) - return exposed._retn (); - ZIOP::CompressorIdLevelListPolicy_var override_policy_var = ZIOP::CompressorIdLevelListPolicy::_narrow (override.in ()); ZIOP::CompressorIdLevelListPolicy_var exposed_policy_var = ZIOP::CompressorIdLevelListPolicy::_narrow (exposed.in ()); + // Reconcile client-exposed and locally set values. + if (CORBA::is_nil (exposed_policy_var.in ())) + return override._retn (); + + if (CORBA::is_nil (override_policy_var.in ())) + return exposed._retn (); + // Check which compressor id we should use and which level + for (CORBA::ULong nr_exposed = 0; + nr_exposed < exposed_policy_var->compressor_ids ()->length (); + ++nr_exposed) + { + ::Compression::CompressorIdLevel_var exposed_compressor = + exposed_policy_var->compressor_ids ()->operator [](nr_exposed); - return exposed._retn (); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("TAO_ZIOP_Stub::effective_compression_id_list_policy, ") + ACE_TEXT ("exposed_policy = %d, compressor_id = %C, ") + ACE_TEXT ("compression_level = %d\n"), + nr_exposed, + TAO_ZIOP_Loader::ziop_compressorid_name ( + exposed_compressor.ptr ()->compressor_id), + exposed_compressor.ptr ()->compression_level)); + } + // check if a local policy matches this exposed policy + for (CORBA::ULong nr_override = 0; + nr_override < override_policy_var->compressor_ids ()->length (); + ++nr_override) + { + ::Compression::CompressorIdLevel_var override_compressor = + override_policy_var->compressor_ids ()->operator [] (nr_override); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("TAO_ZIOP_Stub::effective_compression_id_list_policy, ") + ACE_TEXT ("checking override_policy = %d, compressor_id = %C, ") + ACE_TEXT ("compression_level = %d\n"), + nr_override, + TAO_ZIOP_Loader::ziop_compressorid_name ( + override_compressor->compressor_id), + override_compressor->compression_level)); + } + if (override_compressor->compressor_id == + exposed_compressor->compressor_id) + { + CORBA::Policy_var tmp_policy = override_policy_var->copy (); + ZIOP::CompressorIdLevelListPolicy_var idlevellist_policy_var = + ZIOP::CompressorIdLevelListPolicy::_narrow (tmp_policy.in ()); + if (CORBA::is_nil (idlevellist_policy_var.in ())) + return override._retn (); + + idlevellist_policy_var->compressor_ids ()->operator [] (0).compressor_id = + override_compressor->compressor_id; + //according to ZIOP spec, return the compressor with the lowest compression level. + idlevellist_policy_var.ptr ()->compressor_ids ()->operator [] (0).compression_level = + ACE_MIN (override_compressor->compression_level, + exposed_compressor->compression_level); + + return idlevellist_policy_var._retn (); + } + } + } + + return 0; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/ZlibCompressor.mpc b/TAO/tao/ZlibCompressor.mpc index 797c1feccb7..929e7c57044 100644 --- a/TAO/tao/ZlibCompressor.mpc +++ b/TAO/tao/ZlibCompressor.mpc @@ -1,5 +1,5 @@ //$Id$ -project(ZlibCompressor) : taolib, tao_output, install, compression, tao_versioning_idl_defaults, ace_zlib { +project(ZlibCompressor) : taolib, tao_output, install, compression, taoidldefaults, ace_zlib { requires += zlib sharedname = TAO_ZlibCompressor dynamicflags = TAO_ZLIBCOMPRESSOR_BUILD_DLL diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index 4f0d9f92bf7..b980e3b1e5c 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -911,6 +911,10 @@ enum TAO_Policy_Scope # endif #endif +#if !defined (TAO_HAS_SEQUENCE_ITERATORS) +# define TAO_HAS_SEQUENCE_ITERATORS 0 +#endif + TAO_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index 7daa1e0822d..71ecf2a7e51 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -1,9 +1,7 @@ //$Id$ -project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_versioning_idl_defaults, gen_ostream, corba_e_micro, corba_e_compact, core_minimum_corba, tao_no_iiop { - sharedname = TAO - dynamicflags = TAO_BUILD_DLL - +project(TAO_Core_idl) : tao_versioning_idl_defaults, gen_ostream { + custom_only = 1 idlflags += -SS -Sorb -GA -Gp -Gd -oA AnyTypeCode \ -Wb,export_macro=TAO_Export \ -Wb,export_include=tao/TAO_Export.h \ @@ -11,6 +9,58 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_v -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h idlflags -= -Sa -St + IDL_Files { + GIOP.pidl >> AnyTypeCode/GIOPA.h AnyTypeCode/GIOPA.cpp + } + + IDL_Files { + idlflags += -Sci + CONV_FRAME.pidl >> AnyTypeCode/CONV_FRAMEA.h AnyTypeCode/CONV_FRAMEA.cpp + Current.pidl >> AnyTypeCode/CurrentA.h AnyTypeCode/CurrentA.cpp + IIOP.pidl >> AnyTypeCode/IIOPA.h AnyTypeCode/IIOPA.cpp + IIOP_Endpoints.pidl >> AnyTypeCode/IIOP_EndpointsA.h AnyTypeCode/IIOP_EndpointsA.cpp + IOP.pidl >> AnyTypeCode/IOPA.h AnyTypeCode/IOPA.cpp + Messaging_PolicyValue.pidl >> AnyTypeCode/Messaging_PolicyValueA.h AnyTypeCode/Messaging_PolicyValueA.cpp + Messaging_SyncScope.pidl >> AnyTypeCode/Messaging_SyncScopeA.h AnyTypeCode/Messaging_SyncScopeA.cpp + ObjectIdList.pidl >> AnyTypeCode/ObjectIdListA.h AnyTypeCode/ObjectIdListA.cpp + orb_types.pidl >> AnyTypeCode/orb_typesA.h AnyTypeCode/orb_typesA.cpp + ParameterMode.pidl >> AnyTypeCode/ParameterModeA.h AnyTypeCode/ParameterModeA.cpp + Policy_Forward.pidl >> AnyTypeCode/Policy_ForwardA.h AnyTypeCode/Policy_ForwardA.cpp + Policy_Manager.pidl >> AnyTypeCode/Policy_ManagerA.h AnyTypeCode/Policy_ManagerA.cpp + Policy_Current.pidl >> AnyTypeCode/Policy_CurrentA.h AnyTypeCode/Policy_CurrentA.cpp + PI_Forward.pidl >> AnyTypeCode/PI_ForwardA.h AnyTypeCode/PI_ForwardA.cpp + PortableInterceptor.pidl >> AnyTypeCode/PortableInterceptorA.h AnyTypeCode/PortableInterceptorA.cpp + Services.pidl >> AnyTypeCode/ServicesA.h AnyTypeCode/ServicesA.cpp + TAO.pidl >> AnyTypeCode/TAOA.h AnyTypeCode/TAOA.cpp + TimeBase.pidl >> AnyTypeCode/TimeBaseA.h AnyTypeCode/TimeBaseA.cpp + } + + IDL_Files { + idlflags += -Sci -Gse + BooleanSeq.pidl >> AnyTypeCode/BooleanSeqA.h AnyTypeCode/BooleanSeqA.cpp + CharSeq.pidl >> AnyTypeCode/CharSeqA.h AnyTypeCode/CharSeqA.cpp + DoubleSeq.pidl >> AnyTypeCode/DoubleSeqA.h AnyTypeCode/DoubleSeqA.cpp + FloatSeq.pidl >> AnyTypeCode/FloatSeqA.h AnyTypeCode/FloatSeqA.cpp + LongDoubleSeq.pidl >> AnyTypeCode/LongDoubleSeqA.h AnyTypeCode/LongDoubleSeqA.cpp + LongLongSeq.pidl >> AnyTypeCode/LongLongSeqA.h AnyTypeCode/LongLongSeqA.cpp + LongSeq.pidl >> AnyTypeCode/LongSeqA.h AnyTypeCode/LongSeqA.cpp + OctetSeq.pidl >> AnyTypeCode/OctetSeqA.h AnyTypeCode/OctetSeqA.cpp + ShortSeq.pidl >> AnyTypeCode/ShortSeqA.h AnyTypeCode/ShortSeqA.cpp + StringSeq.pidl >> AnyTypeCode/StringSeqA.h AnyTypeCode/StringSeqA.cpp + ULongLongSeq.pidl >> AnyTypeCode/ULongLongSeqA.h AnyTypeCode/ULongLongSeqA.cpp + ULongSeq.pidl >> AnyTypeCode/ULongSeqA.h AnyTypeCode/ULongSeqA.cpp + UShortSeq.pidl >> AnyTypeCode/UShortSeqA.h AnyTypeCode/UShortSeqA.cpp + WCharSeq.pidl >> AnyTypeCode/WCharSeqA.h AnyTypeCode/WCharSeqA.cpp + WStringSeq.pidl >> AnyTypeCode/WStringSeqA.h AnyTypeCode/WStringSeqA.cpp + } + +} + +project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoidldefaults, gen_ostream, corba_e_micro, corba_e_compact, core_minimum_corba, tao_no_iiop { + after += TAO_Core_idl + sharedname = TAO + dynamicflags = TAO_BUILD_DLL + Source_Files(TAO_COMPONENTS) { Abstract_Servant_Base.cpp Acceptor_Filter.cpp @@ -407,6 +457,7 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_v Message_Semantics.h Messaging_PolicyValueC.h Messaging_SyncScopeC.h + MM_Sequence_Iterator_T.h MMAP_Allocator.h MProfile.h Muxed_TMS.h @@ -595,52 +646,10 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_v orb.idl } - IDL_Files { - GIOP.pidl >> AnyTypeCode/GIOPA.h AnyTypeCode/GIOPA.cpp - } - - IDL_Files { - idlflags += -Sci - CONV_FRAME.pidl >> AnyTypeCode/CONV_FRAMEA.h AnyTypeCode/CONV_FRAMEA.cpp - Current.pidl >> AnyTypeCode/CurrentA.h AnyTypeCode/CurrentA.cpp - IIOP.pidl >> AnyTypeCode/IIOPA.h AnyTypeCode/IIOPA.cpp - IIOP_Endpoints.pidl >> AnyTypeCode/IIOP_EndpointsA.h AnyTypeCode/IIOP_EndpointsA.cpp - IOP.pidl >> AnyTypeCode/IOPA.h AnyTypeCode/IOPA.cpp - Messaging_PolicyValue.pidl >> AnyTypeCode/Messaging_PolicyValueA.h AnyTypeCode/Messaging_PolicyValueA.cpp - Messaging_SyncScope.pidl >> AnyTypeCode/Messaging_SyncScopeA.h AnyTypeCode/Messaging_SyncScopeA.cpp - ObjectIdList.pidl >> AnyTypeCode/ObjectIdListA.h AnyTypeCode/ObjectIdListA.cpp - orb_types.pidl >> AnyTypeCode/orb_typesA.h AnyTypeCode/orb_typesA.cpp - ParameterMode.pidl >> AnyTypeCode/ParameterModeA.h AnyTypeCode/ParameterModeA.cpp - Policy_Forward.pidl >> AnyTypeCode/Policy_ForwardA.h AnyTypeCode/Policy_ForwardA.cpp - Policy_Manager.pidl >> AnyTypeCode/Policy_ManagerA.h AnyTypeCode/Policy_ManagerA.cpp - Policy_Current.pidl >> AnyTypeCode/Policy_CurrentA.h AnyTypeCode/Policy_CurrentA.cpp - PI_Forward.pidl >> AnyTypeCode/PI_ForwardA.h AnyTypeCode/PI_ForwardA.cpp - PortableInterceptor.pidl >> AnyTypeCode/PortableInterceptorA.h AnyTypeCode/PortableInterceptorA.cpp - Services.pidl >> AnyTypeCode/ServicesA.h AnyTypeCode/ServicesA.cpp - TAO.pidl >> AnyTypeCode/TAOA.h AnyTypeCode/TAOA.cpp - TimeBase.pidl >> AnyTypeCode/TimeBaseA.h AnyTypeCode/TimeBaseA.cpp + Pkgconfig_Files { + TAO.pc.in } IDL_Files { - idlflags += -Sci -Gse - BooleanSeq.pidl >> AnyTypeCode/BooleanSeqA.h AnyTypeCode/BooleanSeqA.cpp - CharSeq.pidl >> AnyTypeCode/CharSeqA.h AnyTypeCode/CharSeqA.cpp - DoubleSeq.pidl >> AnyTypeCode/DoubleSeqA.h AnyTypeCode/DoubleSeqA.cpp - FloatSeq.pidl >> AnyTypeCode/FloatSeqA.h AnyTypeCode/FloatSeqA.cpp - LongDoubleSeq.pidl >> AnyTypeCode/LongDoubleSeqA.h AnyTypeCode/LongDoubleSeqA.cpp - LongLongSeq.pidl >> AnyTypeCode/LongLongSeqA.h AnyTypeCode/LongLongSeqA.cpp - LongSeq.pidl >> AnyTypeCode/LongSeqA.h AnyTypeCode/LongSeqA.cpp - OctetSeq.pidl >> AnyTypeCode/OctetSeqA.h AnyTypeCode/OctetSeqA.cpp - ShortSeq.pidl >> AnyTypeCode/ShortSeqA.h AnyTypeCode/ShortSeqA.cpp - StringSeq.pidl >> AnyTypeCode/StringSeqA.h AnyTypeCode/StringSeqA.cpp - ULongLongSeq.pidl >> AnyTypeCode/ULongLongSeqA.h AnyTypeCode/ULongLongSeqA.cpp - ULongSeq.pidl >> AnyTypeCode/ULongSeqA.h AnyTypeCode/ULongSeqA.cpp - UShortSeq.pidl >> AnyTypeCode/UShortSeqA.h AnyTypeCode/UShortSeqA.cpp - WCharSeq.pidl >> AnyTypeCode/WCharSeqA.h AnyTypeCode/WCharSeqA.cpp - WStringSeq.pidl >> AnyTypeCode/WStringSeqA.h AnyTypeCode/WStringSeqA.cpp - } - - Pkgconfig_Files { - TAO.pc.in } } diff --git a/TAO/tests/AMH_Oneway/run_test.pl b/TAO/tests/AMH_Oneway/run_test.pl index 551e6fbb23c..91885767c43 100755 --- a/TAO/tests/AMH_Oneway/run_test.pl +++ b/TAO/tests/AMH_Oneway/run_test.pl @@ -33,7 +33,7 @@ if ($sv != 0) { if ($server->WaitForFileTimed ($iorbase, $server->ProcessStartWaitInterval()) == -1) { print STDERR "ERROR: cannot find file <$server_iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); + $sv->Kill (); $sv->TimedWait (1); exit 1; } diff --git a/TAO/tests/Big_AMI/client.cpp b/TAO/tests/Big_AMI/client.cpp index a8b4332aed0..ac7a4292842 100644 --- a/TAO/tests/Big_AMI/client.cpp +++ b/TAO/tests/Big_AMI/client.cpp @@ -143,10 +143,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) return 1; // We reuse the object_var smart pointer! - object_var = orb->string_to_object (ior); + CORBA::Object_var ior_object = orb->string_to_object (ior); A::AMI_Test_var ami_test_var = - A::AMI_Test::_narrow (object_var.in ()); + A::AMI_Test::_narrow (ior_object.in ()); if (CORBA::is_nil (ami_test_var.in ())) { diff --git a/TAO/tests/Big_AMI/run_test.pl b/TAO/tests/Big_AMI/run_test.pl index 90c93b94d93..5606488c3a3 100755 --- a/TAO/tests/Big_AMI/run_test.pl +++ b/TAO/tests/Big_AMI/run_test.pl @@ -6,7 +6,7 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $debug_level = '0'; $iterations = '10'; @@ -18,35 +18,48 @@ foreach $i (@ARGV) { } } -$iorfile = PerlACE::LocalFile ("server.ior"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -unlink $iorfile; +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-ORBdebuglevel $debug_level -d -o server.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-ORBdebuglevel $debug_level -d -o $iorfile"); -} +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -d -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -i $iterations -x -b $payload"); -$SV->Spawn (); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } -$CL = new PerlACE::Process ("client", " -k file://$iorfile -i $iterations -x -b $payload"); +$client_status = $CL->SpawnWaitKill (60); -$client = $CL->SpawnWaitKill (60); -$server = $SV->WaitKill (10); +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} -unlink $iorfile; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); -if ($server != 0 || $client != 0) { - exit 1; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; } -exit 0; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/TAO/tests/Bug_2936_Regression/run_test.pl b/TAO/tests/Bug_2936_Regression/run_test.pl index ce13c4307a9..78e53c6fd7f 100755 --- a/TAO/tests/Bug_2936_Regression/run_test.pl +++ b/TAO/tests/Bug_2936_Regression/run_test.pl @@ -6,20 +6,26 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; $status = 0; -$file = PerlACE::LocalFile ("test.ior"); -unlink $file; +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); -my $class = (PerlACE::is_vxworks_test() ? 'PerlACE::ProcessVX' : - 'PerlACE::Process'); -$SV = new $class ("server"); +$SV = $server->CreateProcess ("server"); print STDERR "\n\n==== Running bug 2936 regression test\n"; -$SV->Spawn (); +$test = $SV->Spawn (); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} $collocated = $SV->WaitKill (30); @@ -28,6 +34,6 @@ if ($collocated != 0) { $status = 1; } -unlink $file; +$server->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/Bug_2953_Regression/server.cpp b/TAO/tests/Bug_2953_Regression/server.cpp index 067e7c26441..d5cb1f217c1 100644 --- a/TAO/tests/Bug_2953_Regression/server.cpp +++ b/TAO/tests/Bug_2953_Regression/server.cpp @@ -160,7 +160,7 @@ removeServant( RTCORBA::ThreadpoolId id) { PortableServer::ObjectId_var oid = poa->servant_to_id(servant); - poa->deactivate_object(oid); + poa->deactivate_object(oid.in()); rtorb->destroy_threadpool(id); ACE_DEBUG ((LM_DEBUG, "Destroyed threadpool with id <%d>\n", diff --git a/TAO/tests/Bug_3547_Regression/Stock_Quoter_Client.cpp b/TAO/tests/Bug_3547_Regression/Stock_Quoter_Client.cpp index 5ea95176562..87f319ebccc 100644 --- a/TAO/tests/Bug_3547_Regression/Stock_Quoter_Client.cpp +++ b/TAO/tests/Bug_3547_Regression/Stock_Quoter_Client.cpp @@ -6,6 +6,33 @@ #include "Stock_QuoterC.h" #include "UDPTestC.h" #include "ace/streams.h" +#include "ace/Task.h" + +class OrbTask : public ACE_Task_Base +{ +public: + OrbTask(const CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate(orb)) + { + } + + virtual int svc() + { + try + { + this->orb_->run (); + } + catch (const CORBA::Exception&) + { + } + return 0; + } + +private: + CORBA::ORB_var orb_; +}; + +static int n_threads = 1; unsigned char Msg[1000] = { 0 } ; @@ -25,6 +52,14 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) CORBA::Object_var stock_quoter_obj = orb->resolve_initial_references ("MyStockQuoter"); + OrbTask task(orb.in()); + + if (task.activate (THR_NEW_LWP | THR_JOINABLE, + n_threads) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot activate threads\n"), + 1); + UDPTestI_var server = UDPTestI::_narrow (udp_obj.in ()); Stock_Quoter_var quoter = Stock_Quoter::_narrow (stock_quoter_obj.in()); @@ -47,6 +82,8 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) quoter->shutdown (); + task.wait(); + orb->destroy (); } catch (CORBA::Exception& e) diff --git a/TAO/tests/Bug_3553_Regression/Bug_3553_Regression.mpc b/TAO/tests/Bug_3553_Regression/Bug_3553_Regression.mpc new file mode 100644 index 00000000000..5d39f6ca5f6 --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/Bug_3553_Regression.mpc @@ -0,0 +1,37 @@ +// -*- MPC -*- +// $Id$ + +project(*idl): taoidldefaults { + idlflags += -Sp + IDL_Files { + Test.idl + } + custom_only = 1 +} + +project(*Server): taoserver, iortable { + after += *idl + Source_Files { + Hello.cpp + Bug_3553_Regression_server.cpp + } + Source_Files { + TestC.cpp + TestS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, rtcorba, avoids_corba_e_micro { + after += *idl + Source_Files { + Bug_3553_Regression_client.cpp + } + Source_Files { + TestC.cpp + } + IDL_Files { + } +} + diff --git a/TAO/tests/Bug_3553_Regression/Bug_3553_Regression_client.cpp b/TAO/tests/Bug_3553_Regression/Bug_3553_Regression_client.cpp new file mode 100644 index 00000000000..4e8556742ed --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/Bug_3553_Regression_client.cpp @@ -0,0 +1,124 @@ +// $Id$ + +#include "TestC.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "tao/Policy_Current.h" +#include "tao/Policy_Current.h" +#include "ace/Get_Opt.h" + +ACE_RCSID(TransportCache, client, "$Id$") + +int cache_size = 512; +int port_nr = 27530; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("c:p:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + cache_size = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'p': + port_nr = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-c <transport_cache_size>\n" + "-p <server_port_nr>\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args(argc, argv) != 0) + return 1; + + // Get the RTORB. + CORBA::Object_var obj = orb->resolve_initial_references ("RTORB"); + RTCORBA::RTORB_var rtorb = RTCORBA::RTORB::_narrow (obj.in()); + //create the private connections policy. This means that every connection + // to the server uses his own socket. + CORBA::PolicyList policies (1); + policies.length (1); + policies[0] = rtorb->create_private_connection_policy (); + + CORBA::Object_var pol_current_object = orb->resolve_initial_references ("PolicyCurrent"); + + CORBA::PolicyCurrent_var policy_current = + CORBA::PolicyCurrent::_narrow (pol_current_object.in ()); + + if (CORBA::is_nil (policy_current.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Nil policy current\n")); + return 1; + } + policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE); + + Test::Hello_var *hello_array = 0; + ACE_NEW_RETURN (hello_array, Test::Hello_var [cache_size], -1); + + int iter = 1; + for (iter = 1; iter <= cache_size; ++iter) + { + char object_string[256]; + char reference_string[256]; + ACE_OS::sprintf (reference_string, "TransportCacheTest%d", iter); + ACE_OS::sprintf (object_string, "corbaloc:iiop:localhost:%d/", port_nr); + ACE_OS::strcat (object_string, reference_string); + + CORBA::Object_var hello_obj = orb->string_to_object (object_string); + orb->register_initial_reference (reference_string, hello_obj.in ()); + + CORBA::String_var ior_string = orb->object_to_string (hello_obj.in()); + ACE_DEBUG((LM_DEBUG, ACE_TEXT("IOR string for reference %d : %C\n"), + iter, ior_string.in ())); + hello_array[iter-1] = Test::Hello::_narrow(hello_obj.in ()); + } + //now we've got the references -> call each and everyone of them + for (iter = 0; iter < cache_size; ++iter) + { + Test::Hello_var hello = hello_array[iter]; + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT ("Nil Test::Hello reference\n")), + 1); + } + + CORBA::String_var the_string = hello->get_string (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C> from reference %d\n", + the_string.in (), iter + 1)); + } + //shutdown the server + if (iter >= 0) + hello_array[0]->shutdown (); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Bug_3553_Regression/Bug_3553_Regression_server.cpp b/TAO/tests/Bug_3553_Regression/Bug_3553_Regression_server.cpp new file mode 100644 index 00000000000..4341198321e --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/Bug_3553_Regression_server.cpp @@ -0,0 +1,102 @@ +// $Id$ + +#include "Hello.h" +#include "ace/Get_Opt.h" +#include "tao/IORTable/IORTable.h" + +ACE_RCSID (Hello, + server, + "$Id$") + +int cache_size = 512; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("c:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + cache_size = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-c <transport_cache_size> " + "\n", + argv [0]), + -1); + } + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + if (parse_args(argc, argv) != 0) + return 1; + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (orb.in ()), + 1); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = Test::Hello::_narrow (object.in ()); + + CORBA::Object_var table_obj = orb->resolve_initial_references("IORTable"); + IORTable::Table_var table = IORTable::Table::_narrow(table_obj.in()); + for (int i = 1; i <= cache_size; ++i) + { + CORBA::String_var ior_string = orb->object_to_string (object.in()); + ACE_DEBUG((LM_DEBUG, ACE_TEXT("Registering object %d with IOR string: %C\n"), + i, ior_string.in ())); + char identifier[256]; + ACE_OS::sprintf (identifier, "TransportCacheTest%d", i); + table->bind(identifier, ior_string.in()); + } + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); + poa_manager->activate (); + + orb->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Bug_3553_Regression/Hello.cpp b/TAO/tests/Bug_3553_Regression/Hello.cpp new file mode 100644 index 00000000000..df5dc90d3d9 --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/Hello.cpp @@ -0,0 +1,23 @@ +// +// $Id$ +// +#include "Hello.h" + +ACE_RCSID(Hello, Hello, "$Id$") + +Hello::Hello (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +char * +Hello::get_string (void) +{ + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Bug_3553_Regression/Hello.h b/TAO/tests/Bug_3553_Regression/Hello.h new file mode 100644 index 00000000000..f87205c3011 --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/Hello.h @@ -0,0 +1,31 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Bug_3553_Regression/Test.idl b/TAO/tests/Bug_3553_Regression/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Bug_3553_Regression/run_test.pl b/TAO/tests/Bug_3553_Regression/run_test.pl new file mode 100755 index 00000000000..1a8599748b6 --- /dev/null +++ b/TAO/tests/Bug_3553_Regression/run_test.pl @@ -0,0 +1,64 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; +$cache_size = '256'; +$port = '27530'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } + if ($i eq '-high') { + $cache_size = '1024'; + } + if ($i eq '-mid') { + $cache_size = '512'; + } + if ($i eq '-low') { + $cache_size = '256'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + + +$SV = $server->CreateProcess ("server", + "-c $cache_size -ORBdebuglevel $debug_level -ORBListenEndpoints iiop://localhost:$port"); +$CL = $client->CreateProcess ("client", + "-c $cache_size -p $port -ORBdebuglevel $debug_level"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +# just for all security... +sleep(5); + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +exit $status; diff --git a/TAO/tests/Bug_3558_Regression/client.cpp b/TAO/tests/Bug_3558_Regression/client.cpp index 9173e7bf9c5..42c66a099f6 100644 --- a/TAO/tests/Bug_3558_Regression/client.cpp +++ b/TAO/tests/Bug_3558_Regression/client.cpp @@ -147,7 +147,7 @@ test_server (void *arg) ACE_TEXT ("%D Shutdown server %d\n"), server_nr)); - if (!CORBA::is_nil(hello)) + if (!CORBA::is_nil(hello.in ())) { try { diff --git a/TAO/tests/Bug_3567_Regression/client.cpp b/TAO/tests/Bug_3567_Regression/client.cpp index 37bdddd9a43..188a2de3914 100644 --- a/TAO/tests/Bug_3567_Regression/client.cpp +++ b/TAO/tests/Bug_3567_Regression/client.cpp @@ -23,7 +23,7 @@ const ACE_TCHAR *ior = ACE_TEXT("file://test.ior"); int nthreads = 5; int niterations = 10; int debug = 0; -int number_of_replies = 0; +ACE_Atomic_Op <TAO_SYNCH_MUTEX, long> number_of_replies = 0; CORBA::Long in_number = 931232; const char * in_str = "Let's talk AMI."; @@ -98,7 +98,9 @@ class Client : public ACE_Task_Base { public: /// ctor - Client (A::AMI_Test_ptr server, int niterations); + Client (A::AMI_Test_ptr server, int niterations, A::AMI_AMI_TestHandler_ptr hnd); + /// dtor + ~Client () ; /// The thread entry point. virtual int svc (void); @@ -119,7 +121,7 @@ class Handler : public POA_A::AMI_AMI_TestHandler public: Handler (void) { - }; + } void set_ami_test (A::AMI_Test_ptr ami_test) { @@ -146,7 +148,7 @@ public: ami_test_var_->sendc_set_yadda (0, 5); --number_of_replies; - }; + } void foo_excep (::Messaging::ExceptionHolder * excep_holder) { @@ -161,35 +163,35 @@ public: { ex._tao_print_exception ("Caught exception:"); } - }; + } void get_yadda (CORBA::Long result) { ACE_DEBUG ((LM_DEBUG, "Callback method <get_yadda> called: result <%d>\n", result)); - }; + } void get_yadda_excep (::Messaging::ExceptionHolder *) { ACE_DEBUG ((LM_DEBUG, "Callback method <get_yadda_excep> called:\n")); - }; + } void set_yadda (void) { ACE_DEBUG ((LM_DEBUG, "Callback method <set_yadda> called:\n")); - }; + } void set_yadda_excep (::Messaging::ExceptionHolder *) { ACE_DEBUG ((LM_DEBUG, "Callback method <set_yadda_excep> called:\n")); - }; + } ~Handler (void) { - }; + } void inout_arg_test (const char *) { @@ -204,9 +206,6 @@ public: A::AMI_Test_var ami_test_var_; }; -// ReplyHandler. -Handler handler; - int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { @@ -251,8 +250,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) poa_manager->activate (); // Let the client perform the test in a separate thread + Handler handler; + PortableServer::ObjectId_var id = + root_poa->activate_object (&handler); + + CORBA::Object_var hnd_object = root_poa->id_to_reference (id.in ()); + + A::AMI_AMI_TestHandler_var the_handler_var = + A::AMI_AMI_TestHandler::_narrow (hnd_object.in ()); + + handler.set_ami_test (server.in ()); - Client client (server.in (), niterations); + Client client (server.in (), niterations, the_handler_var.in ()); if (client.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -267,7 +276,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) : Entering perform_work loop to receive <%d> replies\n", - number_of_replies)); + number_of_replies.value ())); } // ORB loop. @@ -285,7 +294,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) : Exited perform_work loop Received <%d> replies\n", - (nthreads*niterations) - number_of_replies)); + (nthreads*niterations) - number_of_replies.value ())); } client.thr_mgr ()->wait (); @@ -312,12 +321,16 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // **************************************************************** Client::Client (A::AMI_Test_ptr server, - int niterations) - : ami_test_var_ (A::AMI_Test::_duplicate (server)), - niterations_ (niterations) + int niterations, + A::AMI_AMI_TestHandler_ptr hnd) + : ami_test_var_ (A::AMI_Test::_duplicate (server)) + , niterations_ (niterations) + , the_handler_var_ (A::AMI_AMI_TestHandler::_duplicate (hnd)) +{ +} + +Client::~Client () { - handler.set_ami_test (server); - the_handler_var_ = handler._this (/* */); } int @@ -332,7 +345,7 @@ Client::svc (void) if (debug) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) :<%d> Asynchronous methods issued\n", + "(%P|%t) <%d> Asynchronous methods issued\n", niterations)); } } @@ -357,7 +370,8 @@ Worker::svc (void) if (pending) { - this->orb_->perform_work(); + ACE_Time_Value tm (1, 0); + this->orb_->perform_work(tm); } } diff --git a/TAO/tests/Bug_3574_Regression/Bug_3574_Regression.mpc b/TAO/tests/Bug_3574_Regression/Bug_3574_Regression.mpc new file mode 100644 index 00000000000..9635718fe6c --- /dev/null +++ b/TAO/tests/Bug_3574_Regression/Bug_3574_Regression.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +project(*): taoclient { + Source_Files { + test.cpp + } +} diff --git a/TAO/tests/Bug_3574_Regression/README b/TAO/tests/Bug_3574_Regression/README new file mode 100644 index 00000000000..4d31b51afe4 --- /dev/null +++ b/TAO/tests/Bug_3574_Regression/README @@ -0,0 +1,7 @@ +# $Id$ + +Description: +- sequence of 100 elements, means buffer allocation of 100 elements +- shrink to 99, means reinitialize 1 element to zap the old value +- extend to 100, means no allocation + diff --git a/TAO/tests/Bug_3574_Regression/run_test.pl b/TAO/tests/Bug_3574_Regression/run_test.pl new file mode 100755 index 00000000000..397c63d65bc --- /dev/null +++ b/TAO/tests/Bug_3574_Regression/run_test.pl @@ -0,0 +1,22 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $client = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$CL = $client->CreateProcess ("client", "-ORBInitRef MyObjectId=file://myobj.ior"); + +$test = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} + +exit 0; diff --git a/TAO/tests/Bug_3574_Regression/test.cpp b/TAO/tests/Bug_3574_Regression/test.cpp new file mode 100644 index 00000000000..0e2c361dfa3 --- /dev/null +++ b/TAO/tests/Bug_3574_Regression/test.cpp @@ -0,0 +1,51 @@ +// $Id$ + +#include "tao/StringSeqC.h" + +int +ACE_TMAIN (int, ACE_TCHAR *[]) +{ + char const *str = "Some string"; + + CORBA::StringSeq seq; + seq.length (100); + for (CORBA::ULong i = 0; i < seq.length (); ++i) + { + seq[i] = str; + } + + // Save a pointer to the whole buffer. + char const * const *wholebuf = seq.get_buffer (); + + // This call should reinitialize the the 100th element + // (the fact that the shrunk elements are reinitialized is TAO + // specific but we test for it). + seq.length (99); + // No reallocation should happen for the buffer. + ACE_TEST_ASSERT (seq.get_buffer () == wholebuf); + // And set the length to the same value + seq.length (99); + ACE_TEST_ASSERT (seq.get_buffer () == wholebuf); + // We cannot be sure that the pointer to the reinitialized 100th + // element is different from the old one since memory manager can + // return the same pointer that we've just released but it must + // not be 0 and it must be an empty string. + ACE_TEST_ASSERT (wholebuf[99] != 0); + ACE_TEST_ASSERT (ACE_OS::strcmp (wholebuf[99], "") == 0); + + // Extend the sequence to the original size. + seq.length (100); + // No reallocation should happen for the buffer. + ACE_TEST_ASSERT (seq.get_buffer () == wholebuf); + // And now we can test absolutely legally that the 100th + // element was reinitialized as CORBA spec requires. + ACE_TEST_ASSERT (seq[99].in () != 0); + ACE_TEST_ASSERT (ACE_OS::strcmp (seq[99].in (), "") == 0); + seq.length (101); + // Reallocation should happen for the buffer. + ACE_TEST_ASSERT (seq.get_buffer () != wholebuf); + ACE_TEST_ASSERT (seq[100].in () != 0); + ACE_TEST_ASSERT (ACE_OS::strcmp (seq[100].in (), "") == 0); + + return 0; +} diff --git a/TAO/tests/Bug_3575_Regression/Bug_3575_Regression.mpc b/TAO/tests/Bug_3575_Regression/Bug_3575_Regression.mpc new file mode 100644 index 00000000000..9635718fe6c --- /dev/null +++ b/TAO/tests/Bug_3575_Regression/Bug_3575_Regression.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +project(*): taoclient { + Source_Files { + test.cpp + } +} diff --git a/TAO/tests/Bug_3575_Regression/README b/TAO/tests/Bug_3575_Regression/README new file mode 100644 index 00000000000..d046ba031f0 --- /dev/null +++ b/TAO/tests/Bug_3575_Regression/README @@ -0,0 +1,5 @@ +# $Id$ + +Description: Before bug#3575 was fixed string_sequence_element::_retn() was +returning a pointer to a newly initialized element in a sequence loosing +the old pointer. diff --git a/TAO/tests/Bug_3575_Regression/run_test.pl b/TAO/tests/Bug_3575_Regression/run_test.pl new file mode 100755 index 00000000000..397c63d65bc --- /dev/null +++ b/TAO/tests/Bug_3575_Regression/run_test.pl @@ -0,0 +1,22 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $client = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$CL = $client->CreateProcess ("client", "-ORBInitRef MyObjectId=file://myobj.ior"); + +$test = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} + +exit 0; diff --git a/TAO/tests/Bug_3575_Regression/test.cpp b/TAO/tests/Bug_3575_Regression/test.cpp new file mode 100644 index 00000000000..c461eb6431b --- /dev/null +++ b/TAO/tests/Bug_3575_Regression/test.cpp @@ -0,0 +1,19 @@ +// $Id$ + +#include "tao/StringSeqC.h" + +int +ACE_TMAIN (int, ACE_TCHAR *[]) +{ + char const *str = "Some string"; + + CORBA::StringSeq seq; + seq.length (1); + seq[0] = str; + char const *beforeptr = seq[0].in (); + CORBA::String_var tmp = seq[0]._retn (); + // The pointer returned by in() and _retn() must be the same. + ACE_TEST_ASSERT (beforeptr == tmp.in ()); + + return 0; +} diff --git a/TAO/tests/Bug_3597_Regression/Bug_3597_Regression.mpc b/TAO/tests/Bug_3597_Regression/Bug_3597_Regression.mpc new file mode 100644 index 00000000000..bddd65f8a15 --- /dev/null +++ b/TAO/tests/Bug_3597_Regression/Bug_3597_Regression.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +project(*Server): taoserver { + Source_Files { + server.cpp + } +} + diff --git a/TAO/tests/Bug_3597_Regression/run_test.pl b/TAO/tests/Bug_3597_Regression/run_test.pl new file mode 100755 index 00000000000..d1d85802727 --- /dev/null +++ b/TAO/tests/Bug_3597_Regression/run_test.pl @@ -0,0 +1,22 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$SV = $server->CreateProcess ("server"); + +$test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} + +exit 0; diff --git a/TAO/tests/Bug_3597_Regression/server.cpp b/TAO/tests/Bug_3597_Regression/server.cpp new file mode 100644 index 00000000000..81e60283d0b --- /dev/null +++ b/TAO/tests/Bug_3597_Regression/server.cpp @@ -0,0 +1,86 @@ +// $Id$ + +#include "tao/corba.h" +#include "ace/Log_Msg.h" +#include "ace/Log_Msg_Backend.h" +#include "ace/Log_Record.h" + +const ACE_TCHAR* mykey = ACE_TEXT("KEY"); + +class Backend : public ACE_Log_Msg_Backend +{ +public: + Backend () + : ok_ (false) {} + + virtual int open (const ACE_TCHAR *logger_key); + + virtual int reset (void); + + virtual int close (void); + + virtual ssize_t log (ACE_Log_Record &log_record); + + bool ok (void) const; + +private: + bool ok_; +}; + +int +Backend::open (const ACE_TCHAR *key) +{ + if (ACE_OS::strcmp (key, mykey) == 0) + this->ok_ = true; + return 0; +} + +int +Backend::reset (void) +{ + return 0; +} + +int +Backend::close (void) +{ + return 0; +} + +ssize_t +Backend::log (ACE_Log_Record &) +{ + return 1; +} + +bool +Backend::ok (void) const +{ + return this->ok_; +} + +int ACE_TMAIN (int, ACE_TCHAR *argv[]) +{ + Backend b; + ACE_Log_Msg_Backend *old_b = ACE_Log_Msg::msg_backend (&b); + + ACE_LOG_MSG->set_flags (ACE_Log_Msg::CUSTOM); + + ACE_TCHAR *my_argv[3]; + my_argv[0] = argv[0]; + my_argv[1] = const_cast<ACE_TCHAR *> (ACE_TEXT ("-ORBServiceConfigLoggerKey")); + my_argv[2] = const_cast<ACE_TCHAR *> (mykey); + int my_argc = 3; + + CORBA::ORB_var orb2_ = CORBA::ORB_init (my_argc, my_argv, "ServerORB1"); + + if (!b.ok ()) + { + ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Key not ok!\n"), 1); + } + + // Reset the backend to avoid references to our soon-to-be-destroyed one. + ACE_Log_Msg::msg_backend (old_b); + + return 0; +} diff --git a/TAO/tests/Bug_3598a_Regression/Bug_3598a_Regression.mpc b/TAO/tests/Bug_3598a_Regression/Bug_3598a_Regression.mpc new file mode 100644 index 00000000000..0e883f6f7b0 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/Bug_3598a_Regression.mpc @@ -0,0 +1,39 @@ +// -*- MPC -*- +// $Id$ + +project(*idl): taoidldefaults { + idlflags += -Sp + IDL_Files { + Test.idl + } + custom_only = 1 +} + +project(*Server): taoserver, strategies { + after += *idl + Source_Files { + Hello.cpp + server.cpp + } + Source_Files { + TestC.cpp + TestS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, pi, strategies { + after += *idl + Source_Files { + ClientORBInitializer.cpp + ClientRequest_Interceptor.cpp + client.cpp + } + Source_Files { + TestC.cpp + } + IDL_Files { + } +} + diff --git a/TAO/tests/Bug_3598a_Regression/ClientORBInitializer.cpp b/TAO/tests/Bug_3598a_Regression/ClientORBInitializer.cpp new file mode 100644 index 00000000000..2f4406185c9 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/ClientORBInitializer.cpp @@ -0,0 +1,28 @@ +// -*- C++ -*- +// +// $Id$ + +#include "ClientORBInitializer.h" + +void +ClientORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr) +{ + // No-op +} + +void +ClientORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info) +{ + PortableInterceptor::ClientRequestInterceptor_ptr cri = + PortableInterceptor::ClientRequestInterceptor::_nil (); + + ACE_NEW_THROW_EX (cri, + ClientRequest_Interceptor, + CORBA::NO_MEMORY ()); + + PortableInterceptor::ClientRequestInterceptor_var + client_interceptor = cri; + + info->add_client_request_interceptor (client_interceptor.in ()); + +} diff --git a/TAO/tests/Bug_3598a_Regression/ClientORBInitializer.h b/TAO/tests/Bug_3598a_Regression/ClientORBInitializer.h new file mode 100644 index 00000000000..1c0ca44b138 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/ClientORBInitializer.h @@ -0,0 +1,50 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ClientORBInitializer.h + * + * $Id$ + */ +//============================================================================= +#ifndef CLIENTORBINITIALIZER_H +#define CLIENTORBINITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "tao/PortableInterceptorC.h" +#include "ClientRequest_Interceptor.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +/// RTCORBA ORB initializer. +class ClientORBInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ +public: + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" + +#endif /* CLIENTORBINITIALIZER_H */ diff --git a/TAO/tests/Bug_3598a_Regression/ClientRequest_Interceptor.cpp b/TAO/tests/Bug_3598a_Regression/ClientRequest_Interceptor.cpp new file mode 100644 index 00000000000..8c25c69b51e --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/ClientRequest_Interceptor.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include "ClientRequest_Interceptor.h" + +#include "tao/CORBA_String.h" +#include "tao/debug.h" +#include "ace/Log_Msg.h" + + CORBA::Boolean + ClientRequest_Interceptor::success_flag_ = 0; + + ClientRequest_Interceptor::ClientRequest_Interceptor (void) + : name_ ("ClientRequest_Interceptor") + { + } + + ClientRequest_Interceptor::~ClientRequest_Interceptor (void) + { + } + + char * + ClientRequest_Interceptor::name () + { + return CORBA::string_dup (this->name_); + } + + void + ClientRequest_Interceptor::destroy () + { + // No-op + } + + void + ClientRequest_Interceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr ri + ) + { + // Print debug + CORBA::String_var op = + ri->operation (); + + + ACE_DEBUG ((LM_DEBUG, + "TAO_FT (%P|%t): ClientRequest_Interceptor::send_poll called for operation: %C\n", + op.in ())); + } + + void + ClientRequest_Interceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri) + { + // Print debug + CORBA::String_var op = + ri->operation (); + + + ACE_DEBUG ((LM_DEBUG, + "ClientRequest_Interceptor::send_request called for operation: %C - things are going well...\n", + op.in ())); + } + + void + ClientRequest_Interceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr) + { + // No-op + } + + void + ClientRequest_Interceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr) + { + // No-op + } + + void + ClientRequest_Interceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri) + { + // Print debug + CORBA::String_var op = + ri->operation (); + + + ACE_DEBUG ((LM_DEBUG, + "ClientRequest_Interceptor::receive_exception called for operation: %C - test has succeeded...\n", + op.in ())); + success_flag_ = 1; + } diff --git a/TAO/tests/Bug_3598a_Regression/ClientRequest_Interceptor.h b/TAO/tests/Bug_3598a_Regression/ClientRequest_Interceptor.h new file mode 100644 index 00000000000..36e4fc7032d --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/ClientRequest_Interceptor.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file ClientRequest_Interceptor.h + * + * $Id$ + */ +//============================================================================= +#ifndef CLIENTREQUEST_INTERCEPTOR_H +#define CLIENTREQUEST_INTERCEPTOR_H +#include /**/ "ace/pre.h" + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +/** +* @class ClientRequest_Interceptor +* +*/ +class ClientRequest_Interceptor +: public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual ::CORBA::LocalObject +{ +public: + +ClientRequest_Interceptor (void); + +~ClientRequest_Interceptor (void); + +/// Canonical name of the interceptor. +virtual char * name (); + + +virtual void destroy (); + +virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr); + +virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri); + +virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri); + +virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri); + +virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri); + +static CORBA::Boolean success_flag_; + +private: + +/// Name of the interceptor +const char *name_; + +}; +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /*CLIENTREQUEST_INTERCEPTOR_H*/ + diff --git a/TAO/tests/Bug_3598a_Regression/Hello.cpp b/TAO/tests/Bug_3598a_Regression/Hello.cpp new file mode 100644 index 00000000000..7b9497529ec --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/Hello.cpp @@ -0,0 +1,23 @@ +// +// $Id$ +// +#include "Hello.h" + +ACE_RCSID(Hello, Hello, "Hello.cpp,v 1.3 2002/01/29 20:21:07 okellogg Exp") + +Hello::Hello (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +char * +Hello::get_string () +{ + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown () +{ + this->orb_->shutdown (0 ); +} diff --git a/TAO/tests/Bug_3598a_Regression/Hello.h b/TAO/tests/Bug_3598a_Regression/Hello.h new file mode 100644 index 00000000000..782b1b2f573 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/Hello.h @@ -0,0 +1,31 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual char * get_string (); + + virtual void shutdown (); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Bug_3598a_Regression/README b/TAO/tests/Bug_3598a_Regression/README new file mode 100644 index 00000000000..b2d570b8158 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/README @@ -0,0 +1,12 @@ +$Id$ + +This test attempts to contact a server IOR with no connectable profile in it (on account of how there is no server running). + +The method invocation should fail but the installed client request interceptor should have its send_request and receive_exception methods invoked regardless. + +The expected result looks like: + +Client about to make method call that is doomed to failure... +ClientRequest_Interceptor::send_request called for operation: get_string - things are going well... +ClientRequest_Interceptor::receive_exception called for operation: get_string - test has succeeded... +Success - the server was unreachable and PI receive_exception was invoked. diff --git a/TAO/tests/Bug_3598a_Regression/Test.idl b/TAO/tests/Bug_3598a_Regression/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Bug_3598a_Regression/client.cpp b/TAO/tests/Bug_3598a_Regression/client.cpp new file mode 100644 index 00000000000..06919103896 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/client.cpp @@ -0,0 +1,103 @@ +// $Id$ + +#include "TestC.h" +#include "ace/Get_Opt.h" +#include "tao/PortableInterceptorC.h" +#include "ClientORBInitializer.h" +#include "tao/ORBInitializer_Registry.h" +#include "tao/Strategies/advanced_resource.h" +#include "tao/Strategies/OC_Endpoint_Selector_Loader.h" + +ACE_RCSID(Hello, client, "client.cpp,v 1.5 2002/01/29 20:21:07 okellogg Exp") + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = + PortableInterceptor::ORBInitializer::_nil (); + PortableInterceptor::ORBInitializer_var orb_initializer; + + // Register the ClientRequest_Interceptor ORBInitializer. + ACE_NEW_RETURN (temp_orb_initializer, + ClientORBInitializer, + -1); + + orb_initializer = temp_orb_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var tmp = + orb->string_to_object (ACE_TEXT_ALWAYS_CHAR (ior)); + + Test::Hello_var hello = + Test::Hello::_narrow(tmp.in () ); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + ior), + 1); + } + + ACE_DEBUG ((LM_DEBUG, "Client about to make method call that is doomed to failure...\n")); + + CORBA::String_var the_string = + hello->get_string (); + + ACE_ERROR_RETURN ((LM_DEBUG, + "Error - the remote call succeeded which is bloody miraculous given that no server is running !!\n"), + 1); + } + catch (const CORBA::Exception&) + { + if (ClientRequest_Interceptor::success_flag_) + { + ACE_DEBUG ((LM_DEBUG, "Success - the server was unreachable and PI receive_exception was invoked.\n")); + return 0; + } + else + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Error: regression failed - interceptor receive_exception interception point was not invoked !!\n"), + 1); + } + } + + return 1; +} diff --git a/TAO/tests/Bug_3598a_Regression/run_test.pl b/TAO/tests/Bug_3598a_Regression/run_test.pl new file mode 100755 index 00000000000..0af02716e71 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/run_test.pl @@ -0,0 +1,76 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill (60); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->GetStderrLog(); +$client->GetStderrLog(); + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/TAO/tests/Bug_3598a_Regression/server.cpp b/TAO/tests/Bug_3598a_Regression/server.cpp new file mode 100644 index 00000000000..95d61429e99 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/server.cpp @@ -0,0 +1,99 @@ +// $Id$ + +#include "Hello.h" +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" + +ACE_RCSID (Hello, + server, + "server.cpp,v 1.6 2003/11/01 11:15:11 dhinton Exp") + +const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA" ); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + if (parse_args (argc, argv) != 0) + return 1; + + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(hello_impl); + + Test::Hello_var hello = + hello_impl->_this (); + + CORBA::String_var ior = + orb->object_to_string (hello.in () ); + + // Output the IOR to the <ior_output_file> + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + root_poa->destroy (1, 1 ); + + orb->destroy (); + + ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n")); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Bug_3598a_Regression/svc.conf b/TAO/tests/Bug_3598a_Regression/svc.conf new file mode 100644 index 00000000000..75b92f3c589 --- /dev/null +++ b/TAO/tests/Bug_3598a_Regression/svc.conf @@ -0,0 +1 @@ +static OC_Endpoint_Selector_Factory "-connect_timeout 1300" diff --git a/TAO/tests/Bug_3630_Regression/Bug_3630_Regression.mpc b/TAO/tests/Bug_3630_Regression/Bug_3630_Regression.mpc new file mode 100644 index 00000000000..bddd65f8a15 --- /dev/null +++ b/TAO/tests/Bug_3630_Regression/Bug_3630_Regression.mpc @@ -0,0 +1,9 @@ +// -*- MPC -*- +// $Id$ + +project(*Server): taoserver { + Source_Files { + server.cpp + } +} + diff --git a/TAO/tests/Bug_3630_Regression/TAO Conf File.conf b/TAO/tests/Bug_3630_Regression/TAO Conf File.conf new file mode 100644 index 00000000000..d02ffc26c2b --- /dev/null +++ b/TAO/tests/Bug_3630_Regression/TAO Conf File.conf @@ -0,0 +1 @@ +static Server_Strategy_Factory "-ORBConcurrency thread-per-connection" diff --git a/TAO/tests/Bug_3630_Regression/TAO_Conf_File.conf b/TAO/tests/Bug_3630_Regression/TAO_Conf_File.conf new file mode 100644 index 00000000000..d02ffc26c2b --- /dev/null +++ b/TAO/tests/Bug_3630_Regression/TAO_Conf_File.conf @@ -0,0 +1 @@ +static Server_Strategy_Factory "-ORBConcurrency thread-per-connection" diff --git a/TAO/tests/Bug_3630_Regression/run_test.pl b/TAO/tests/Bug_3630_Regression/run_test.pl new file mode 100755 index 00000000000..02ca089516f --- /dev/null +++ b/TAO/tests/Bug_3630_Regression/run_test.pl @@ -0,0 +1,29 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$SV = $server->CreateProcess ("server"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +exit $status; diff --git a/TAO/tests/Bug_3630_Regression/server.cpp b/TAO/tests/Bug_3630_Regression/server.cpp new file mode 100644 index 00000000000..f2e0bf4d4ae --- /dev/null +++ b/TAO/tests/Bug_3630_Regression/server.cpp @@ -0,0 +1,103 @@ +// $Id$ + +#include "tao/ORB.h" +#include "tao/ORB_Core.h" + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + int result = 0; + int extra_argc = 2; + int second_extra_argc = 2; + int largc = argc; + int second_largc = argc; + + try + { + ACE_TCHAR **extra = 0; + ACE_NEW_RETURN (extra, ACE_TCHAR *[extra_argc], -1); + extra[0] = ACE::strnew (ACE_TEXT ("-ORBSvcConf")); + extra[1] = ACE::strnew (ACE_TEXT ("TAO Conf File.conf")); + + ACE_TCHAR **largv = new ACE_TCHAR *[largc+extra_argc]; + for (int i = 0; i < largc; i++) + largv[i] = argv[i]; + + + for (int i = 0; i < extra_argc; i++) + largv[argc+i] = extra[i]; + + largc += extra_argc; + + CORBA::ORB_var orb = CORBA::ORB_init (largc, largv, "FirstORB"); + if(CORBA::is_nil(orb.in ())) + { + ACE_ERROR((LM_ERROR,ACE_TEXT ("Test failed. CORBA::ORB_init returned NIL ORB\n"),1)); + + for (int i = 0; i < extra_argc; i++) + ACE::strdelete (extra[i]); + + delete [] extra; + delete [] largv; + + return -1; + } + + orb->destroy (); + orb = CORBA::ORB::_nil (); + + for (int i = 0; i < extra_argc; i++) + ACE::strdelete (extra[i]); + delete [] extra; + delete [] largv; + + + ACE_TCHAR **second_extra = 0; + ACE_NEW_RETURN (second_extra, ACE_TCHAR *[second_extra_argc], -1); + extra[0] = ACE::strnew (ACE_TEXT ("-ORBSvcConf")); + extra[1] = ACE::strnew (ACE_TEXT ("TAO_Conf_File.conf")); + ACE_TCHAR **second_largv = new ACE_TCHAR *[second_largc+second_extra_argc]; + for (int i = 0; i < second_largc; i++) + second_largv[i] = argv[i]; + for (int i = 0; i < second_extra_argc; i++) + second_largv[argc+i] = second_extra[i]; + + second_largc += second_extra_argc; + + CORBA::ORB_var second_orb = CORBA::ORB_init (second_largc, second_largv, "SecondORB"); + if(CORBA::is_nil(second_orb.in ())) + { + ACE_ERROR((LM_ERROR,ACE_TEXT ("Test failed. CORBA::ORB_init returned NIL ORB\n"),1)); + + for (int i = 0; i < extra_argc; i++) + ACE::strdelete (second_extra[i]); + + delete [] second_extra; + delete [] second_largv; + + return -1; + } + + second_orb->destroy (); + second_orb = CORBA::ORB::_nil (); + + for (int i2 = 0; i2 < second_extra_argc; i2++) + ACE::strdelete (second_extra[i2]); + + delete [] second_extra; + delete [] second_largv; + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + } + + if (result == 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Test passed!"))); + else + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Test failed. Result: %d\n"), + result)); + return result; +} diff --git a/TAO/tests/Bug_3636_Regression/Bug_3636_Regression.mpc b/TAO/tests/Bug_3636_Regression/Bug_3636_Regression.mpc new file mode 100644 index 00000000000..fbab84719e4 --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/Bug_3636_Regression.mpc @@ -0,0 +1,37 @@ +// -*- MPC -*- +// $Id$ + +project(*idl): taoidldefaults { + idlflags += -Sp + IDL_Files { + Test.idl + } + custom_only = 1 +} + +project(*Server): taoserver { + after += *idl + Source_Files { + Hello.cpp + server.cpp + } + Source_Files { + TestC.cpp + TestS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient { + after += *idl + Source_Files { + client.cpp + } + Source_Files { + TestC.cpp + } + IDL_Files { + } +} + diff --git a/TAO/tests/Bug_3636_Regression/Hello.cpp b/TAO/tests/Bug_3636_Regression/Hello.cpp new file mode 100644 index 00000000000..df5dc90d3d9 --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/Hello.cpp @@ -0,0 +1,23 @@ +// +// $Id$ +// +#include "Hello.h" + +ACE_RCSID(Hello, Hello, "$Id$") + +Hello::Hello (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +char * +Hello::get_string (void) +{ + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + this->orb_->shutdown (0); +} diff --git a/TAO/tests/Bug_3636_Regression/Hello.h b/TAO/tests/Bug_3636_Regression/Hello.h new file mode 100644 index 00000000000..f87205c3011 --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/Hello.h @@ -0,0 +1,31 @@ +// +// $Id$ +// + +#ifndef HELLO_H +#define HELLO_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Hello interface +class Hello + : public virtual POA_Test::Hello +{ +public: + /// Constructor + Hello (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual char * get_string (void); + + virtual void shutdown (void); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; +}; + +#include /**/ "ace/post.h" +#endif /* HELLO_H */ diff --git a/TAO/tests/Bug_3636_Regression/Test.idl b/TAO/tests/Bug_3636_Regression/Test.idl new file mode 100644 index 00000000000..3c0976e106d --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/Test.idl @@ -0,0 +1,20 @@ +// +// $Id$ +// + +/// Put the interfaces in a module, to avoid global namespace pollution +module Test +{ + /// A very simple interface + interface Hello + { + /// Return a simple string + string get_string (); + + /// A method to shutdown the ORB + /** + * This method is used to simplify the test shutdown process + */ + oneway void shutdown (); + }; +}; diff --git a/TAO/tests/Bug_3636_Regression/client.cpp b/TAO/tests/Bug_3636_Regression/client.cpp new file mode 100644 index 00000000000..d1f53d7502e --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/client.cpp @@ -0,0 +1,77 @@ +// $Id$ + +#include "TestC.h" +#include "ace/Get_Opt.h" +#include "ace/OS_NS_unistd.h" + +ACE_RCSID(Hello, client, "$Id$") + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var tmp = orb->string_to_object(ior); + + Test::Hello_var hello = Test::Hello::_narrow(tmp.in ()); + + if (CORBA::is_nil (hello.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + ior), + 1); + } + + CORBA::String_var the_string = hello->get_string (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", + the_string.in ())); + + ACE_OS::sleep (10); + + hello->shutdown (); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/Bug_3636_Regression/run_test.pl b/TAO/tests/Bug_3636_Regression/run_test.pl new file mode 100755 index 00000000000..d4c8c6c0428 --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/run_test.pl @@ -0,0 +1,73 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '11'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/TAO/tests/Bug_3636_Regression/server.cpp b/TAO/tests/Bug_3636_Regression/server.cpp new file mode 100644 index 00000000000..601e72a15ea --- /dev/null +++ b/TAO/tests/Bug_3636_Regression/server.cpp @@ -0,0 +1,130 @@ +// $Id$ + +#include "Hello.h" +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" +#include "ace/Log_Msg.h" + +ACE_RCSID (Hello, + server, + "$Id$") + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + int idle_count = 0; + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); + + if (parse_args (argc, argv) != 0) + return 1; + + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (hello_impl); + + CORBA::Object_var object = root_poa->id_to_reference (id.in ()); + + Test::Hello_var hello = Test::Hello::_narrow (object.in ()); + + CORBA::String_var ior = orb->object_to_string (hello.in ()); + + // Output the IOR to the <ior_output_file> + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s\n", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + for (;;) + { + ACE_Time_Value tv (0, 500); + while (orb->work_pending (tv)) + { + ACE_DEBUG ((LM_DEBUG, "Work pending\n")); + ACE_Time_Value tv2 (0, 500); + if (orb->work_pending (tv2)) + { + ACE_Time_Value work_tv (0, 500); + orb->perform_work (work_tv); + } + } + ++idle_count; + } + + orb->destroy (); + } + catch (const CORBA::BAD_INV_ORDER&) + { + // Expected + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + if (idle_count == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Got unexpected idle_count %d\n", idle_count), 1); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Got %d idle moments\n", idle_count)); + } + + return 0; +} diff --git a/TAO/tests/Compression/Compression_Test.mpc b/TAO/tests/Compression/Compression_Test.mpc index ce461817d7c..daa9d2aea4f 100644 --- a/TAO/tests/Compression/Compression_Test.mpc +++ b/TAO/tests/Compression/Compression_Test.mpc @@ -1,9 +1,23 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, compression, zlibcompressor { +project(*Zlib_Server): taoserver, compression, zlibcompressor, { + exename = zlibserver Source_Files { - server.cpp + zlibserver.cpp } } +project(*Bzip2_Server): taoserver, compression, bzip2compressor, { + exename = bzip2server + Source_Files { + bzip2server.cpp + } +} + +project(*Lzo_Server): taoserver, compression, lzocompressor, { + exename = lzoserver + Source_Files { + lzoserver.cpp + } +} diff --git a/TAO/tests/Compression/bzip2server.cpp b/TAO/tests/Compression/bzip2server.cpp new file mode 100644 index 00000000000..79cf5feb27c --- /dev/null +++ b/TAO/tests/Compression/bzip2server.cpp @@ -0,0 +1,190 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" +#include "tao/ORB.h" +#include "tao/Compression/Compression.h" +#include "tao/Compression/bzip2/Bzip2Compressor_Factory.h" + +ACE_RCSID (Hello, + server, + "$Id$") + +bool +test_invalid_compression_factory (Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + try + { + // Get an invalid compression factory + Compression::CompressorFactory_var factory = + cm->get_factory (100); + } + catch (const Compression::UnknownCompressorId& ex) + { + ACE_UNUSED_ARG (ex); + succeed = true; + } + catch (const CORBA::Exception&) + { + } + + if (!succeed) + { + ACE_ERROR ((LM_ERROR, + "(%t) ERROR, get invalid compression factory failed\n")); + } + + return succeed; +} + +bool +test_duplicate_compression_factory ( + Compression::CompressionManager_ptr cm, + Compression::CompressorFactory_ptr cf) +{ + bool succeed = false; + try + { + // Register duplicate + cm->register_factory (cf); + } + catch (const Compression::FactoryAlreadyRegistered&) + { + succeed = true; + } + catch (const CORBA::Exception&) + { + } + + if (!succeed) + { + ACE_ERROR ((LM_ERROR, + "(%t) ERROR, register duplicate factory failed\n")); + } + + return succeed; +} + +bool +test_register_nil_compression_factory ( + Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + try + { + // Register nil factory + cm->register_factory (Compression::CompressorFactory::_nil()); + } + catch (const CORBA::BAD_PARAM& ex) + { + if ((ex.minor() & 0xFFFU) == 44) + { + succeed = true; + } + } + catch (const CORBA::Exception&) + { + } + + if (!succeed) + { + ACE_ERROR ((LM_ERROR, + "(%t) ERROR, register nill factory failed\n")); + } + + return succeed; +} + +bool +test_compression (CORBA::ULong nelements, + Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + + CORBA::OctetSeq mytest; + mytest.length (nelements); + for (CORBA::ULong j = 0; j != nelements; ++j) + { + mytest[j] = 'a'; + } + + Compression::Compressor_var compressor = cm->get_compressor ( + ::Compression::COMPRESSORID_BZIP2, 6); + + CORBA::OctetSeq myout; + myout.length ((CORBA::ULong)(mytest.length() * 1.1)); + + compressor->compress (mytest, myout); + + CORBA::OctetSeq decompress; + decompress.length (nelements); + + compressor->decompress (myout, decompress); + + if (decompress != mytest) + { + ACE_ERROR ((LM_ERROR, "Error, decompress not working\n")); + } + else + { + succeed = true; + ACE_DEBUG ((LM_DEBUG, "Compression worked with bzip2, original " + "size %d, compressed size %d\n", + mytest.length(), myout.length ())); + } + return succeed; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + int retval = 0; + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var compression_manager = + orb->resolve_initial_references("CompressionManager"); + + Compression::CompressionManager_var manager = + Compression::CompressionManager::_narrow (compression_manager.in ()); + + if (CORBA::is_nil(manager.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil compression manager\n"), + 1); + + Compression::CompressorFactory_ptr compressor_factory; + + ACE_NEW_RETURN (compressor_factory, TAO::Bzip2_CompressorFactory (), 1); + + Compression::CompressorFactory_var compr_fact = compressor_factory; + manager->register_factory(compr_fact.in ()); + + if (!test_duplicate_compression_factory (manager.in (), compr_fact.in ())) + retval = 1; + + if (!test_register_nil_compression_factory (manager.in ())) + retval = 1; + + if (!test_compression (1024, manager.in ())) + retval = 1; + + if (!test_compression (5, manager.in ())) + retval = 1; + + if (!test_invalid_compression_factory (manager.in ())) + retval = 1; + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + retval = 1; + } + + return retval; +} diff --git a/TAO/tests/Compression/lzoserver.cpp b/TAO/tests/Compression/lzoserver.cpp new file mode 100644 index 00000000000..735e14d7c30 --- /dev/null +++ b/TAO/tests/Compression/lzoserver.cpp @@ -0,0 +1,191 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" +#include "tao/ORB.h" +#include "tao/Compression/Compression.h" +#include "tao/Compression/lzo/LzoCompressor_Factory.h" + +ACE_RCSID (Hello, + server, + "$Id$") + +bool +test_invalid_compression_factory (Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + try + { + // Get an invalid compression factory + Compression::CompressorFactory_var factory = + cm->get_factory (100); + } + catch (const Compression::UnknownCompressorId& ex) + { + ACE_UNUSED_ARG (ex); + succeed = true; + } + catch (const CORBA::Exception&) + { + } + + if (!succeed) + { + ACE_ERROR ((LM_ERROR, + "(%t) ERROR, get invalid compression factory failed\n")); + } + + return succeed; +} + + +bool +test_duplicate_compression_factory ( + Compression::CompressionManager_ptr cm, + Compression::CompressorFactory_ptr cf) +{ + bool succeed = false; + try + { + // Register duplicate + cm->register_factory (cf); + } + catch (const Compression::FactoryAlreadyRegistered&) + { + succeed = true; + } + catch (const CORBA::Exception&) + { + } + + if (!succeed) + { + ACE_ERROR ((LM_ERROR, + "(%t) ERROR, register duplicate factory failed\n")); + } + + return succeed; +} + +bool +test_register_nil_compression_factory ( + Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + try + { + // Register nil factory + cm->register_factory (Compression::CompressorFactory::_nil()); + } + catch (const CORBA::BAD_PARAM& ex) + { + if ((ex.minor() & 0xFFFU) == 44) + { + succeed = true; + } + } + catch (const CORBA::Exception&) + { + } + + if (!succeed) + { + ACE_ERROR ((LM_ERROR, + "(%t) ERROR, register nill factory failed\n")); + } + + return succeed; +} + +bool +test_compression (CORBA::ULong nelements, + Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + + CORBA::OctetSeq mytest; + mytest.length (nelements); + for (CORBA::ULong j = 0; j != nelements; ++j) + { + mytest[j] = 'a'; + } + + Compression::Compressor_var compressor = cm->get_compressor ( + ::Compression::COMPRESSORID_LZO, 6); + + CORBA::OctetSeq myout; + myout.length ((CORBA::ULong)(mytest.length() * 1.1)); + + compressor->compress (mytest, myout); + + CORBA::OctetSeq decompress; + decompress.length (nelements); + + compressor->decompress (myout, decompress); + + if (decompress != mytest) + { + ACE_ERROR ((LM_ERROR, "Error, decompress not working\n")); + } + else + { + succeed = true; + ACE_DEBUG ((LM_DEBUG, "Compression worked with lzo, original " + "size %d, compressed size %d\n", + mytest.length(), myout.length ())); + } + return succeed; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + int retval = 0; + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var compression_manager = + orb->resolve_initial_references("CompressionManager"); + + Compression::CompressionManager_var manager = + Compression::CompressionManager::_narrow (compression_manager.in ()); + + if (CORBA::is_nil(manager.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil compression manager\n"), + 1); + + Compression::CompressorFactory_ptr compressor_factory; + + ACE_NEW_RETURN (compressor_factory, TAO::Lzo_CompressorFactory (), 1); + + Compression::CompressorFactory_var compr_fact = compressor_factory; + manager->register_factory(compr_fact.in ()); + + if (!test_duplicate_compression_factory (manager.in (), compr_fact.in ())) + retval = 1; + + if (!test_register_nil_compression_factory (manager.in ())) + retval = 1; + + if (!test_compression (1024, manager.in ())) + retval = 1; + + if (!test_compression (5, manager.in ())) + retval = 1; + + if (!test_invalid_compression_factory (manager.in ())) + retval = 1; + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + retval = 1; + } + + return retval; +} diff --git a/TAO/tests/Compression/run_test.pl b/TAO/tests/Compression/run_test.pl index d1d85802727..202d8d7e1c7 100755 --- a/TAO/tests/Compression/run_test.pl +++ b/TAO/tests/Compression/run_test.pl @@ -10,7 +10,17 @@ use PerlACE::TestTarget; my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$SV = $server->CreateProcess ("server"); +my @tests = qw( + zlibserver + bzip2server + lzoserver + ); + +foreach my $process (@tests) { + +$SV = $server->CreateProcess ("$process"); +my $executable = $SV->Executable; +next unless -e $executable; $test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); @@ -18,5 +28,6 @@ if ($test != 0) { print STDERR "ERROR: test returned $test\n"; exit 1; } +} exit 0; diff --git a/TAO/tests/Compression/server.cpp b/TAO/tests/Compression/zlibserver.cpp index d96d398167a..bdd9c164380 100644 --- a/TAO/tests/Compression/server.cpp +++ b/TAO/tests/Compression/zlibserver.cpp @@ -50,9 +50,8 @@ test_duplicate_compression_factory ( // Register duplicate cm->register_factory (cf); } - catch (const Compression::FactoryAlreadyRegistered& ex) + catch (const Compression::FactoryAlreadyRegistered&) { - ACE_UNUSED_ARG (ex); succeed = true; } catch (const CORBA::Exception&) @@ -98,6 +97,45 @@ test_register_nil_compression_factory ( return succeed; } +bool +test_compression (CORBA::ULong nelements, + Compression::CompressionManager_ptr cm) +{ + bool succeed = false; + + CORBA::OctetSeq mytest; + mytest.length (nelements); + for (CORBA::ULong j = 0; j != nelements; ++j) + { + mytest[j] = 'a'; + } + + Compression::Compressor_var compressor = cm->get_compressor (::Compression::COMPRESSORID_ZLIB, 6); + + CORBA::OctetSeq myout; + myout.length ((CORBA::ULong)(mytest.length() * 1.1)); + + compressor->compress (mytest, myout); + + CORBA::OctetSeq decompress; + decompress.length (nelements); + + compressor->decompress (myout, decompress); + + if (decompress != mytest) + { + ACE_ERROR ((LM_ERROR, "Error, decompress not working\n")); + + } + else + { + succeed = true; + ACE_DEBUG ((LM_DEBUG, "Compression worked with zlib, original " + "size %d, compressed size %d\n", + mytest.length(), myout.length ())); + } + return succeed; +} int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) @@ -132,34 +170,12 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (!test_register_nil_compression_factory (manager.in ())) retval = 1; - CORBA::ULong const nelements = 1024; - CORBA::OctetSeq mytest; - mytest.length (1024); - for (CORBA::ULong j = 0; j != nelements; ++j) - { - mytest[j] = 'a'; - } - - Compression::Compressor_var compressor = manager->get_compressor (::Compression::COMPRESSORID_ZLIB, 6); - - CORBA::OctetSeq myout; - myout.length ((CORBA::ULong)(mytest.length() * 1.1)); - - compressor->compress (mytest, myout); - - CORBA::OctetSeq decompress; - decompress.length (1024); - - compressor->decompress (myout, decompress); + if (!test_compression (1024, manager.in ())) + retval = 1; - if (decompress != mytest) - { - ACE_ERROR ((LM_ERROR, "Error, decompress not working\n")); - } - else - { - ACE_DEBUG ((LM_DEBUG, "Compression worked, original size %d, compressed size %d\n", mytest.length(), myout.length ())); - } + if (!test_compression (5, manager.in ())) + retval = 1; + if (!test_invalid_compression_factory (manager.in ())) retval = 1; diff --git a/TAO/tests/DIOP/client.cpp b/TAO/tests/DIOP/client.cpp index ebb233285eb..dbb73d07644 100644 --- a/TAO/tests/DIOP/client.cpp +++ b/TAO/tests/DIOP/client.cpp @@ -46,7 +46,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) switch (c) { case 'd': - TAO_debug_level++; + ++TAO_debug_level; break; case 'k': ior = get_opts.opt_arg (); @@ -142,8 +142,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); root_poa->destroy (1, // ethernalize objects - 0 // wait for completion - ); + 0); // wait for completion orb->destroy (); diff --git a/TAO/tests/DiffServ/run_test.pl b/TAO/tests/DiffServ/run_test.pl index 4cc87edc15e..bf1e25c4775 100755 --- a/TAO/tests/DiffServ/run_test.pl +++ b/TAO/tests/DiffServ/run_test.pl @@ -6,49 +6,51 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile = PerlACE::LocalFile ("simple_servant.ior"); -unlink $iorfile; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-ORBDebuglevel 1 -p 20000"); -} -else { - $SV = new PerlACE::Process ("server", "-ORBdebuglevel 1 -p 20000"); -} -$CL = new PerlACE::Process ("client", " -ORBdebuglevel 1 -n 10 -k file://$iorfile"); - -$server = $SV->Spawn (); +my $iorbase = "simple_servant.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel 1 -p 20000"); +$CL = $client->CreateProcess ("client", "-ORBdebuglevel 1 -n 10 -k file://$client_iorfile"); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; exit 1; } -if (PerlACE::waitforfile_timed ($iorfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; -} +} -$client = $CL->SpawnWaitKill (300); +$client_status = $CL->SpawnWaitKill (300); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (10); +$server_status = $SV->WaitKill (10); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/FL_Cube/client.cpp b/TAO/tests/FL_Cube/client.cpp index 275cbc8bc45..746b9c64bd9 100644 --- a/TAO/tests/FL_Cube/client.cpp +++ b/TAO/tests/FL_Cube/client.cpp @@ -5,9 +5,9 @@ ACE_RCSID(FL_Cube, client, "$Id$") -#include <FL/Fl.h> -#include <FL/Fl_Window.h> -#include <FL/Fl_Roller.h> +#include <FL/Fl.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Roller.H> class Client { diff --git a/TAO/tests/FL_Cube/server.cpp b/TAO/tests/FL_Cube/server.cpp index 95638b5fdbd..a1fa8259e32 100644 --- a/TAO/tests/FL_Cube/server.cpp +++ b/TAO/tests/FL_Cube/server.cpp @@ -6,7 +6,7 @@ ACE_RCSID(FL_Cube, server, "$Id$") -#include <FL/Fl.h> +#include <FL/Fl.H> const ACE_TCHAR *ior_output_file = 0; diff --git a/TAO/tests/FL_Cube/test_i.h b/TAO/tests/FL_Cube/test_i.h index f4f97040b86..df7b3e46e23 100644 --- a/TAO/tests/FL_Cube/test_i.h +++ b/TAO/tests/FL_Cube/test_i.h @@ -18,7 +18,7 @@ #include "testS.h" -#include <FL/Fl_Gl_Window.h> +#include <FL/Fl_Gl_Window.H> class Simple_Window : public Fl_Gl_Window diff --git a/TAO/tests/IDL_Inherited_Operation/InheritedOp.idl b/TAO/tests/IDL_Inherited_Operation/InheritedOp.idl new file mode 100644 index 00000000000..b8d54bafcb2 --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/InheritedOp.idl @@ -0,0 +1,33 @@ +//$Id$ + +#ifndef INHERITED_OP_IDL +#define INHERITED_OP_IDL + +module Outer +{ + module Inner + { + interface Base + { + void BaseOp (); + }; + }; +}; + +module Outer +{ + module Inner + { + interface Base; + }; +}; + +module Outer +{ + interface Derived : Inner::Base + { + void shutdown (); + }; +}; + +#endif /* INHERITED_OP_IDL */ diff --git a/TAO/tests/IDL_Inherited_Operation/InheritedOp.mpc b/TAO/tests/IDL_Inherited_Operation/InheritedOp.mpc new file mode 100644 index 00000000000..ab64f74834c --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/InheritedOp.mpc @@ -0,0 +1,54 @@ +// -*- MPC -*- +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + InheritedOp.idl + } + custom_only = 1 +} + +project(*Server): taoserver { + after += *idl + + Source_Files { + InheritedOpC.cpp + InheritedOpS.cpp + InheritedOp_i.cpp + server.cpp + } + + Header_Files { + InheritedOpC.h + InheritedOpS.h + InheritedOp_i.h + } + + Inline_Files { + InheritedOpC.inl + InheritedOpS.inl + } + + IDL_Files { + } +} + +project(*Client): taoclient { + after += *idl + + Source_Files { + InheritedOpC.cpp + client.cpp + } + + Header_Files { + InheritedOpC.h + } + + Inline_Files { + InheritedOpC.inl + } + + IDL_Files { + } +} diff --git a/TAO/tests/IDL_Inherited_Operation/InheritedOp_i.cpp b/TAO/tests/IDL_Inherited_Operation/InheritedOp_i.cpp new file mode 100644 index 00000000000..d7727558b6a --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/InheritedOp_i.cpp @@ -0,0 +1,20 @@ +// $Id:$ + +#include "InheritedOp_i.h" + +Derived_i::Derived_i (CORBA::ORB_ptr orb) + : orb_ (orb) +{ +} + +void +Derived_i::BaseOp (void) +{ + ACE_DEBUG ((LM_DEBUG, "BaseOp upcall successful\n")); +} + +void +Derived_i::shutdown (void) +{ + orb_->shutdown (); +} diff --git a/TAO/tests/IDL_Inherited_Operation/InheritedOp_i.h b/TAO/tests/IDL_Inherited_Operation/InheritedOp_i.h new file mode 100644 index 00000000000..2248ee1d872 --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/InheritedOp_i.h @@ -0,0 +1,22 @@ +// -*- C++ -*- +// $Id:$ + +#ifndef INHERITED_OP_I_H +#define INHERITED_OP_I_H + + +#include "InheritedOpS.h" + +class Derived_i : public virtual POA_Outer::Derived +{ +public: + Derived_i (CORBA::ORB_ptr orb); + + virtual void BaseOp (void); + virtual void shutdown (void); + +private: + CORBA::ORB_ptr orb_; +}; + +#endif // INHERITED_OP_I_H diff --git a/TAO/tests/IDL_Inherited_Operation/README b/TAO/tests/IDL_Inherited_Operation/README new file mode 100644 index 00000000000..2bde20e4f2a --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/README @@ -0,0 +1,41 @@ +/** + +@page IDL Inherited Operation Test README File + + This test checks that an IDL compiler bug, fixed by + + Fri Mar 20 16:04:58 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> + + never gets re-introduced. The IDL declarations that caused the + original bug are: + + - A base interface, with an operation, is declared inside 2 + nested modules. + - The nested modules are closed. + - The nested modules are reopened, and forward declaration of + the base interface appears inside. + - The nested modules are closed. + - The outer module is reopened, and a derived interface + declaration appears inside, using the partially scoped + name of the base interface. + + This type of IDL caused the base interface operation to be missing + from the operation table in generated code for the derived + interface. Client calls to this operation on a derived object + would result in a BAD_OPERATION exception. + + The test is here instead of in the IDL_Test directory because + the bug can be detected only at runtime, by a remote call. + IDL_Test is designed to catch only: + + - Error messages incorrectly caused by legal IDL + - Errors from incompilable generated code + - Incorrect repository IDs, fetched by a local stub call + + To run the test use the run_test.pl script: + +$ ./run_test.pl + + the script returns 0 if the test was successful. + +*/ diff --git a/TAO/tests/IDL_Inherited_Operation/client.cpp b/TAO/tests/IDL_Inherited_Operation/client.cpp new file mode 100644 index 00000000000..77c06765b20 --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/client.cpp @@ -0,0 +1,53 @@ +// $Id$ + +#include "InheritedOpC.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + CORBA::ORB_var orb; + Outer::Derived_var target; + + try + { + orb = CORBA::ORB_init (argc, argv); + + CORBA::Object_var tmp = orb->string_to_object (ior); + + target = Outer::Derived::_narrow (tmp.in ()); + + if (CORBA::is_nil (target.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT ("Nil Outer::Derived ") + ACE_TEXT ("reference <%s>\n"), + ior), + 1); + } + + target->BaseOp (); + target->shutdown (); + + orb->destroy (); + } + catch (const CORBA::BAD_OPERATION&) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("client - target operation ") + ACE_TEXT ("BaseOp returned BAD_OPERATION\n"))); + target->shutdown (); + orb->destroy (); + return 1; + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("client - Exception caught:"); + target->shutdown (); + orb->destroy (); + return 1; + } + + return 0; +} diff --git a/TAO/tests/IDL_Inherited_Operation/run_test.pl b/TAO/tests/IDL_Inherited_Operation/run_test.pl new file mode 100755 index 00000000000..5423a45e191 --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/run_test.pl @@ -0,0 +1,52 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create server failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create client failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +$server->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server"); +$CL = $client->CreateProcess ("client"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); + +exit $status; diff --git a/TAO/tests/IDL_Inherited_Operation/server.cpp b/TAO/tests/IDL_Inherited_Operation/server.cpp new file mode 100644 index 00000000000..947cad657b0 --- /dev/null +++ b/TAO/tests/IDL_Inherited_Operation/server.cpp @@ -0,0 +1,75 @@ +// $Id$ + +#include "InheritedOp_i.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior"); + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + Derived_i *derived_impl = 0; + ACE_NEW_RETURN (derived_impl, + Derived_i (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer (derived_impl); + + PortableServer::ObjectId_var id = + root_poa->activate_object (derived_impl); + + CORBA::Object_var object = + root_poa->id_to_reference (id.in ()); + + Outer::Derived_var derived = + Outer::Derived::_narrow (object.in ()); + + CORBA::String_var ior = orb->object_to_string (derived.in ()); + + // Output the IOR to the <ior_output_file> + FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); + + if (output_file == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Cannot open output ") + ACE_TEXT ("file for writing IOR: %s\n"), + ior_output_file), + 1); + } + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + orb->run (); + + root_poa->destroy (true, true); + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("server - Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/tests/IDL_Test/IDL_Test.mpc b/TAO/tests/IDL_Test/IDL_Test.mpc index bd5fc8bcd83..1ce29af84cb 100644 --- a/TAO/tests/IDL_Test/IDL_Test.mpc +++ b/TAO/tests/IDL_Test/IDL_Test.mpc @@ -1,16 +1,9 @@ // -*- MPC -*- // $Id$ - -project(*Main): taoserver, messaging, gen_ostream { - exename = main +project(*IDL): taoserver, messaging, gen_ostream { + custom_only=1 idlflags += -GC -GH -Gd -GT - verbatim(gnuace, macros) { - ifeq ($(OSTYPE),VMS) - CCFLAGS += -Wc/DISTINGUISH_NESTED_ENUMS - endif - } - IDL_Files { array.idl Bug_2350_Regression.idl @@ -66,12 +59,126 @@ project(*Main): taoserver, messaging, gen_ostream { typecode.idl valuetype.idl } +} + +project(*Main): taoserver, messaging, gen_ostream { + exename = main + after += *IDL + verbatim(gnuace, macros) { + ifeq ($(OSTYPE),VMS) + CCFLAGS += -Wc/DISTINGUISH_NESTED_ENUMS + endif + } + + IDL_Files { + } Source_Files { + anonymousA.cpp + anonymousC.cpp + anonymousS.cpp + arrayC.cpp + arrayS.cpp + array_onlyA.cpp + array_onlyC.cpp + array_onlyS.cpp + Bug_2350_RegressionC.cpp + Bug_2350_RegressionS.cpp + Bug_2577_RegressionC.cpp + Bug_2577_RegressionS.cpp + Bug_2582_RegressionC.cpp + Bug_2582_RegressionS.cpp + Bug_2583_RegressionC.cpp + Bug_2583_RegressionS.cpp + Bug_2616_RegressionC.cpp + Bug_2616_RegressionS.cpp + Bug_2619_RegressionC.cpp + Bug_2619_RegressionS.cpp + constantsA.cpp + constantsC.cpp + constantsS.cpp + dif2A.cpp + dif2C.cpp + dif2S.cpp + enum_in_structC.cpp + enum_in_structS.cpp + fullC.cpp + fullS.cpp + fwdC.cpp + fwdS.cpp + generic_objectA.cpp + generic_objectC.cpp + generic_objectS.cpp + gperfC.cpp + gperfS.cpp + includedC.cpp + includedS.cpp + includingC.cpp + includingS.cpp + inheritA.cpp + inheritC.cpp + inheritS.cpp + interfaceC.cpp + interfaceS.cpp + keywordsA.cpp + keywordsC.cpp + keywordsS.cpp main.cpp - *C.cpp - *S.cpp - *A.cpp + moduleA.cpp + moduleC.cpp + moduleS.cpp + nested_scopeC.cpp + nested_scopeS.cpp + old_arrayC.cpp + old_arrayS.cpp + old_constantsC.cpp + old_constantsS.cpp + old_sequenceC.cpp + old_sequenceS.cpp + old_structC.cpp + old_structS.cpp + old_union2C.cpp + old_union2S.cpp + old_unionC.cpp + old_unionS.cpp + paramsC.cpp + paramsS.cpp + pragmaA.cpp + pragmaC.cpp + pragmaS.cpp + primtypesA.cpp + primtypesC.cpp + primtypesS.cpp + reopened_modulesC.cpp + reopened_modulesS.cpp + reopen_include1C.cpp + reopen_include1S.cpp + reopen_include2C.cpp + reopen_include2S.cpp + repo_id_modA.cpp + repo_id_modC.cpp + repo_id_modS.cpp + sequenceC.cpp + sequenceS.cpp + simple2C.cpp + simple2S.cpp + simpleC.cpp + simpleS.cpp + structC.cpp + structS.cpp + typecodeA.cpp + typecodeC.cpp + typecodeS.cpp + typedefA.cpp + typedefC.cpp + typedefS.cpp + typeprefixC.cpp + typeprefixS.cpp + unionC.cpp + unionS.cpp + valuetypeA.cpp + valuetypeC.cpp + valuetypeS.cpp } Template_Files { diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp index 80ed7e05974..2935b601b93 100644 --- a/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp +++ b/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp @@ -25,6 +25,7 @@ #include "ace/Read_Buffer.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" +#include "ace/Malloc_Base.h" ACE_RCSID(MT_Client_Test, client, "$Id$") @@ -178,7 +179,7 @@ MT_Client::run (void) MT_Client::~MT_Client (void) { if (this->object_key_ != 0) - ACE_OS::free (this->object_key_); + ACE_Allocator::instance ()->free (this->object_key_); if (this->argv_ != 0) delete [] this->argv_; } diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp index 04dbf25ca9e..cc902da6345 100644 --- a/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp +++ b/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp @@ -21,8 +21,47 @@ #include "tao/debug.h" #include "ace/OS_NS_stdio.h" +#include "ace/Event_Handler.h" +#include "ace/Sig_Handler.h" + ACE_RCSID(MT_Client_Test, server, "$Id$") +class TestShutdown : public ACE_Event_Handler +{ +public: + TestShutdown (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate (orb)) + { +#if !defined(ACE_LACKS_UNIX_SIGNALS) + this->shutdown_.register_handler (SIGTERM, this); + this->shutdown_.register_handler (SIGINT, this); +#elif defined(ACE_WIN32) + this->shutdown_.register_handler (SIGINT, this); +#endif + } + + ~TestShutdown (void) + { +#if !defined(ACE_LACKS_UNIX_SIGNALS) + this->shutdown_.remove_handler (SIGTERM); + this->shutdown_.remove_handler (SIGINT); +#elif defined(ACE_WIN32) + this->shutdown_.remove_handler (SIGINT); +#endif + } + + virtual int handle_signal (int, siginfo_t*, ucontext_t*) + { + this->orb_->shutdown (); + return 0; + } + +private: + CORBA::ORB_var orb_; + + ACE_Sig_Handler shutdown_; +}; + MT_Object_Server::MT_Object_Server (void) : ior_output_file_ (0) { @@ -103,6 +142,9 @@ MT_Object_Server::init (int argc, ACE_TCHAR** argv) int MT_Object_Server::run (void) { + CORBA::ORB_var orb = this->orb_manager_.orb (); + TestShutdown killer (orb.in ()); + int result = this->orb_manager_.run (); if (result == -1) diff --git a/TAO/tests/Portable_Interceptors/Bug_3582/run_test.pl b/TAO/tests/Portable_Interceptors/Bug_3582/run_test.pl index b35f2687020..de707d44f51 100755 --- a/TAO/tests/Portable_Interceptors/Bug_3582/run_test.pl +++ b/TAO/tests/Portable_Interceptors/Bug_3582/run_test.pl @@ -2,57 +2,70 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; -# -*- perl -*- -# # $Id$ - +# -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$file1base = "test.ior"; -$file1 = PerlACE::LocalFile ("$file1base"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -unlink $file1; +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -if (PerlACE::is_vxworks_test()) { -$SV1 = new PerlACE::ProcessVX ("server", "-o $file1base -n 1"); -} -else { -$SV1 = new PerlACE::Process ("server", "-o $file1 -n 1"); -} -$CL = new PerlACE::Process ("client", "-p file://$file1"); - -$status = 0; +$SV = $server->CreateProcess ("server", "-o $server_iorfile -n 1"); +$CL = $client->CreateProcess ("client", "-p file://$client_iorfile"); print STDERR "\n\n==== Running PortableInterceptor::Redirection test\n"; -$SV1->Spawn (); +$server_status = $SV->Spawn (); + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if (PerlACE::waitforfile_timed ($file1, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$file1>\n"; - $SV1->Kill (); +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill (60); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$SV1->WaitKill (5); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} print "Restarting Client to provoke TRANSIENT exception\n"; -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill (60); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -unlink $file1; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/RTCORBA/Banded_Connections/run_test.pl b/TAO/tests/RTCORBA/Banded_Connections/run_test.pl index 1a7accccdbe..a873e5ec41f 100755 --- a/TAO/tests/RTCORBA/Banded_Connections/run_test.pl +++ b/TAO/tests/RTCORBA/Banded_Connections/run_test.pl @@ -6,17 +6,21 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$status = 0; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +$iorbase1 = "test1.ior"; +$iorbase2 = "test2.ior"; + +$client_iorfile1 = $client->LocalFile ($iorbase1); +$client_iorfile2 = $client->LocalFile ($iorbase2); -$iorfile1base = "test1.ior"; -$iorfile2base = "test2.ior"; -$iorfile1 = PerlACE::LocalFile ("$iorfile1base"); -$iorfile2 = PerlACE::LocalFile ("$iorfile2base"); +$client->DeleteFile ($iorbase1); +$client->DeleteFile ($iorbase2); -unlink $iorfile1; -unlink $iorfile2; +$status = 0; print STDERR "\n********** RTCORBA Priority Banded Connections Unit Test\n"; @@ -43,54 +47,43 @@ else { "-b bands.unix"; } -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", $server_args); -} -else { - $SV = new PerlACE::Process ("server", $server_args); -} -if (PerlACE::is_vxworks_rtp_test()) { - $CL = new PerlACE::ProcessVX ("client", "-n file://$iorfile1base -o file://$iorfile2base"); -} -else { - $CL = new PerlACE::Process ("client", "-n file://$iorfile1 -o file://$iorfile2"); -} +$SV = $server->CreateProcess ("server", $server_args), + +$CL = $client->CreateProcess ("client", "-n file://$client_iorfile1 -o file://$client_iorfile2"); $SV->Spawn(); -if (PerlACE::waitforfile_timed ($iorfile2, $PerlACE::wait_interval_for_process_creation) == -1) -{ - $server = $SV->TimedWait (1); - if ($server == 2) - { + +if ($client->WaitForFileTimed ($iorbase2, + $client->ProcessStartWaitInterval()) == -1) { + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; exit $status; } - else - { - print STDERR "ERROR: cannot find file <$iorfile2>\n"; + else { + print STDERR "ERROR: cannot find file <$client_iorfile2>\n"; $SV->Kill (); exit 1; } } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (30); +$server_status = $SV->WaitKill (30); -if ($server != 0) -{ - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile1; -unlink $iorfile2; +$client->DeleteFile ($iorbase1); +$client->DeleteFile ($iorbase2); # Clean up SHMIOP files PerlACE::check_n_cleanup_files ("server_shmiop_*"); diff --git a/TAO/tests/RTCORBA/Bug_3382_Regression/run_test.pl b/TAO/tests/RTCORBA/Bug_3382_Regression/run_test.pl index cfa55dc34cf..cf568688b34 100755 --- a/TAO/tests/RTCORBA/Bug_3382_Regression/run_test.pl +++ b/TAO/tests/RTCORBA/Bug_3382_Regression/run_test.pl @@ -6,61 +6,54 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib '../../../../bin'; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$status = 0; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -$iorfile = PerlACE::LocalFile ("test.ior"); +$iorbase = "test.ior"; -unlink $iorfile; +$server_iorfile = $server->LocalFile ($iorbase); +$client_iorfile = $client->LocalFile ($iorbase); -if (PerlACE::is_vxworks_test()) { - $TEST = new PerlACE::ProcessVX ("simple_client", , "-ORBSvcConfDirective \"static RT_ORB_Loader '-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping continuous'\""); -} -else { - $TEST = new PerlACE::Process ("simple_client", , "-ORBSvcConfDirective \"static RT_ORB_Loader '-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping continuous'\""); -} +$server->DeleteFile ($iorbase); +$client->DeleteFile ($iorbase); + + +$status = 0; -$test = $TEST->SpawnWaitKill (60); +$PROC = $server->CreateProcess ("simple_client", , "-ORBSvcConfDirective \"static RT_ORB_Loader '-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping continuous'\""); -if ($test != 0) +$proc_status = $PROC->SpawnWaitKill ($server->ProcessStartWaitInterval ()); + +if ($proc_status != 0) { - print STDERR "ERROR: simple_client returned $test\n"; + print STDERR "ERROR: simple_client returned $proc_status\n"; $status = 1; } -if (PerlACE::is_vxworks_test()) { - $TEST = new PerlACE::ProcessVX ("simple_client", , "-ORBSvcConfDirective \"static RT_ORB_Loader '-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping linear'\""); -} -else { - $TEST = new PerlACE::Process ("simple_client", , "-ORBSvcConfDirective \"static RT_ORB_Loader '-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping linear'\""); -} +$PROC = $server->CreateProcess ("simple_client", , "-ORBSvcConfDirective \"static RT_ORB_Loader '-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping linear'\""); -$test = $TEST->SpawnWaitKill (60); +$proc_status = $PROC->SpawnWaitKill ($server->ProcessStartWaitInterval ()); -if ($test != 0) +if ($proc_status != 0) { - print STDERR "ERROR: simple_client returned $test\n"; + print STDERR "ERROR: simple_client returned $proc_status\n"; $status = 1; } - print STDERR "\n RTCORBA CLIENT_PROPAGATED Linear Priority Mapping Unit Test\n\n"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", , "-o test.ior"); -} -else { - $SV = new PerlACE::Process ("server", , "-o $iorfile"); -} -$CL = new PerlACE::Process ("client", "-k file://$iorfile"); +$SV = $server->CreateProcess ("server", , "-o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { - $server = $SV->TimedWait (1); - if ($server == 2) + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; @@ -68,28 +61,29 @@ if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) } else { - print STDERR "ERROR: cannot find file <$iorfile>\n"; + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; $SV->Kill (); exit 1; } } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) +if ($client_status != 0) { - print STDERR "ERROR: client returned $client\n"; + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); -if ($server != 0) +if ($server_status != 0) { - print STDERR "ERROR: server returned $server\n"; + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile ($iorbase); +$client->DeleteFile ($iorbase); exit $status; diff --git a/TAO/tests/RTCORBA/Client_Propagated/run_test.pl b/TAO/tests/RTCORBA/Client_Propagated/run_test.pl index a5b2484f4fd..833ef825961 100755 --- a/TAO/tests/RTCORBA/Client_Propagated/run_test.pl +++ b/TAO/tests/RTCORBA/Client_Propagated/run_test.pl @@ -6,64 +6,67 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfilebase = "test.ior"; -$iorfile = PerlACE::LocalFile ("$iorfilebase"); +$debug_level = '0'; -unlink $iorfile; +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); print STDERR "\n RTCORBA CLIENT_PROPAGATED Priority Unit Test\n\n"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", , "-o $iorfilebase"); -} -else { - $SV = new PerlACE::Process ("server", , "-o $iorfile"); -} -if (PerlACE::is_vxworks_rtp_test()) { - $CL = new PerlACE::ProcessVX ("client", "-k file://$iorfilebase"); -} -else { - $CL = new PerlACE::Process ("client", "-k file://$iorfile"); -} +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-ORBdebuglevel $debug_level -k file://$client_iorfile"); -$SV->Spawn (); +$server_status = $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) -{ +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { $server = $SV->TimedWait (1); - if ($server == 2) - { + if ($server == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; exit $status; - } - else - { - print STDERR "ERROR: cannot find file <$iorfile>\n"; + } else { + print STDERR "ERROR: cannot find file <$iorbase>\n"; $SV->Kill (); exit 1; } } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill (60); -if ($client != 0) -{ - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill (60); -if ($server != 0) -{ - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); exit $status; diff --git a/TAO/tests/RTCORBA/Client_Protocol/run_test.pl b/TAO/tests/RTCORBA/Client_Protocol/run_test.pl index 3fd19cdf619..6b2ab9b6115 100755 --- a/TAO/tests/RTCORBA/Client_Protocol/run_test.pl +++ b/TAO/tests/RTCORBA/Client_Protocol/run_test.pl @@ -6,72 +6,77 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; $status = 0; -$iorfile1base = "test1.ior"; -$iorfile2base = "test2.ior"; -$iorfile1 = PerlACE::LocalFile ("$iorfile1base"); -$iorfile2 = PerlACE::LocalFile ("$iorfile2base"); -unlink $iorfile1; -unlink $iorfile2; +my $iorbase1 = "test1.ior"; +my $iorbase2 = "test2.ior"; + +my $server_iorfile1 = $server->LocalFile ($iorbase1); +my $server_iorfile2 = $server->LocalFile ($iorbase2); + +my $client_iorfile1 = $client->LocalFile ($iorbase1); +my $client_iorfile2 = $client->LocalFile ($iorbase2); + +$server->DeleteFile ($iorbase1); +$server->DeleteFile ($iorbase2); + +$client->DeleteFile ($iorbase1); +$client->DeleteFile ($iorbase2); print STDERR "\n********** RTCORBA Client Protocol Policy Unit Test\n\n"; # Arguments are platform-dependent (UIOP not available on Windows). $server_args = - (PerlACE::is_vxworks_test() ? "" : (($^O eq "MSWin32") ? "-p 1413566210 " : "-p 1413566208 ")) - ."-ORBendpoint iiop:// " - .(PerlACE::is_vxworks_test() ? "" : "-ORBendpoint shmiop:// ") + + (($^O eq "MSWin32") ? "-p 1413566210 " : "-p 1413566208 ") + ."-ORBendpoint iiop:// -ORBendpoint shmiop:// " .(($^O eq "MSWin32" || $^O eq "VMS") ? "" : "-ORBEndpoint uiop:// "); + + $client_args = - "-s file://$iorfile1 -c file://$iorfile2 " + "-s file://$client_iorfile1 -c file://$client_iorfile2 " .(($^O eq "MSWin32" || $^O eq "VMS") ? "" : "-p 1413566210 ") ."-ORBdebuglevel 1 "; -#if ($^O eq "MSWin32") { -# $server_args = -# "-p 1413566210 " -# ."-ORBendpoint iiop:// -ORBendpoint shmiop:// "; -# $client_args = -# "-s file://$iorfile1 -c file://$iorfile2 -ORBdebuglevel 1"; -#} - # Start server. -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-s $iorfile1base -c $iorfile2base $server_args"); -} -else { - $SV = new PerlACE::Process ("server", "-s $iorfile1 -c $iorfile2 $server_args"); -} -$CL = new PerlACE::Process ("client", $client_args); +$SV = $server->CreateProcess ("server", "-s $server_iorfile1 -c $server_iorfile2 $server_args"); + +$CL = $client->CreateProcess ("client", $client_args); $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile2, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile2>\n"; - $SV->Kill (); +if ($server->WaitForFileTimed ($iorbase2, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile2>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } # Start client. -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile1; -unlink $iorfile2; +$server->DeleteFile ($iorbase1); +$server->DeleteFile ($iorbase2); + +$client->DeleteFile ($iorbase1); +$client->DeleteFile ($iorbase2); # Clean up SHMIOP files PerlACE::check_n_cleanup_files ("server_shmiop_*"); diff --git a/TAO/tests/RTCORBA/Collocation/run_test.pl b/TAO/tests/RTCORBA/Collocation/run_test.pl index 46d8206fc43..9fe7d6a1927 100755 --- a/TAO/tests/RTCORBA/Collocation/run_test.pl +++ b/TAO/tests/RTCORBA/Collocation/run_test.pl @@ -6,32 +6,29 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $continuous = ($^O eq 'hpux'); print STDERR "\n********** RTCORBA Collocation Unit Test **********\n\n"; -if (PerlACE::is_vxworks_test()) { - $T = new PerlACE::ProcessVX ("Collocation"); -} -else { - $T = new PerlACE::Process ("Collocation"); -} +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$T = $server->CreateProcess ("Collocation"); if ($continuous) { - $T->Arguments("-ORBSvcConf continuous$PerlACE::svcconf_ext"); + $T->Arguments("-ORBSvcConf continuous$PerlACE::svcconf_ext"); } -$test = $T->SpawnWaitKill(60); +$test = $T->SpawnWaitKill($server->ProcessStartWaitInterval ()); if ($test == 2) { - # Mark as no longer running to avoid errors on exit. - $T->{RUNNING} = 0; + # Mark as no longer running to avoid errors on exit. + $T->{RUNNING} = 0; } else { - if ($test != 0) { - print STDERR "ERROR: test returned $test\n"; - exit 1; - } + if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; + } } exit 0; diff --git a/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl b/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl index 5da7912d505..761cda62243 100755 --- a/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl +++ b/TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl @@ -6,27 +6,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; $continuous = ($^O eq 'hpux'); print STDERR "\n********** RTCORBA Destroy_Thread_Pool Unit Test **********\n\n"; -if (PerlACE::is_vxworks_test()) { - $T = new PerlACE::ProcessVX ("Destroy_Thread_Pool"); -} -else { - $T = new PerlACE::Process ("Destroy_Thread_Pool"); -} - +$SV = $server->CreateProcess ("Destroy_Thread_Pool"); if ($continuous) { - $T->Arguments("-ORBSvcConf continuous$PerlACE::svcconf_ext"); + $SV->Arguments("-ORBSvcConf continuous$PerlACE::svcconf_ext"); } -$test = $T->SpawnWaitKill (60); +$server_status = $SV->SpawnWaitKill (60); -if ($test != 0) { - print STDERR "ERROR: test returned $test\n"; +if ($server_status != 0) { + print STDERR "ERROR: test returned $server_status\n"; exit 1; } diff --git a/TAO/tests/RTCORBA/Dynamic_Thread_Pool/client.cpp b/TAO/tests/RTCORBA/Dynamic_Thread_Pool/client.cpp index eebb1d299ba..4d1a63cc19c 100644 --- a/TAO/tests/RTCORBA/Dynamic_Thread_Pool/client.cpp +++ b/TAO/tests/RTCORBA/Dynamic_Thread_Pool/client.cpp @@ -95,7 +95,6 @@ Task::svc (void) // We need to set the client thread CORBA priority current->the_priority (get_implicit_thread_CORBA_priority (this->orb_.in ())); - CORBA::Long tc = 0; for (int i = 0; i != iterations; ++i) @@ -129,7 +128,7 @@ Task::svc (void) } } - ACE_OS::sleep (10); + ACE_OS::sleep (20); CORBA::Long end = 0; CORBA::Long re = @@ -145,11 +144,6 @@ Task::svc (void) { ACE_ERROR ((LM_ERROR, "Dynamic thread count should be 0, not %d\n", end)); } - - if (shutdown_server) - { - test->shutdown (); - } } catch (const CORBA::Exception& ex) { @@ -173,47 +167,61 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (result != 0) return result; - // Thread Manager for managing task. - ACE_Thread_Manager thread_manager; - - // Create task. - Task task (thread_manager, - orb.in ()); - - // Task activation flags. - long flags = - THR_NEW_LWP | - THR_JOINABLE | - orb->orb_core ()->orb_params ()->thread_creation_flags (); - - // Activate task. - result = - task.activate (flags); - if (result == -1) + if (shutdown_server) { - if (errno == EPERM) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot create thread with scheduling policy %s\n" - "because the user does not have the appropriate privileges, terminating program....\n" - "Check svc.conf options and/or run as root\n", - sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())), - 2); - } - else - // Unexpected error. - ACE_ASSERT (0); - } + CORBA::Object_var object = + orb->string_to_object (ior); - // Wait for task to exit. - result = - thread_manager.wait (); - ACE_ASSERT (result != -1); + test_var test = + test::_narrow (object.in ()); - if (decreased == false) - { - ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Number of threads didn't decrease\n"), -1); + test->shutdown (); } + else + { + + // Thread Manager for managing task. + ACE_Thread_Manager thread_manager; + + // Create task. + Task task (thread_manager, + orb.in ()); + + // Task activation flags. + long flags = + THR_NEW_LWP | + THR_JOINABLE | + orb->orb_core ()->orb_params ()->thread_creation_flags (); + + // Activate task. + result = + task.activate (flags); + if (result == -1) + { + if (errno == EPERM) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot create thread with scheduling policy %s\n" + "because the user does not have the appropriate privileges, terminating program....\n" + "Check svc.conf options and/or run as root\n", + sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())), + 2); + } + else + // Unexpected error. + ACE_ASSERT (0); + } + + // Wait for task to exit. + result = + thread_manager.wait (); + ACE_ASSERT (result != -1); + + if (decreased == false) + { + ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Number of threads didn't decrease\n"), -1); + } + } } catch (const CORBA::Exception& ex) { diff --git a/TAO/tests/RTCORBA/Dynamic_Thread_Pool/run_test.pl b/TAO/tests/RTCORBA/Dynamic_Thread_Pool/run_test.pl index 3c9e0d22062..11c893bb82b 100644 --- a/TAO/tests/RTCORBA/Dynamic_Thread_Pool/run_test.pl +++ b/TAO/tests/RTCORBA/Dynamic_Thread_Pool/run_test.pl @@ -6,23 +6,27 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $number_of_clients = 1; $status = 0; $continuous = ($^O eq 'hpux'); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + @configurations = ( - { + { file => "ior_3", description => "Invoking methods on servant in second RT thread pool (with lanes)", - }, + }, ); for $test (@configurations) { - unlink $test->{file}; + $server->DeleteFile($test->{file}); + $client->DeleteFile($test->{file}); } sub run_clients @@ -33,28 +37,23 @@ sub run_clients for ($i = 0; $i < $clients; $i++) { - $CL[$i] = new PerlACE::Process ("client", $arg); + $CL[$i] = $client->CreateProcess ("client", $arg); $CL[$i]->Spawn (); } for ($i = 0; $i < $clients; $i++) { - $client = $CL[$i]->WaitKill (120); - if ($client != 0) + $client_status = $CL[$i]->WaitKill ($client->ProcessStopWaitInterval () + 90); + if ($client_status != 0) { - print STDERR "ERROR: client returned $client\n"; + print STDERR "ERROR: client returned $client_status\n"; $status = 1; goto kill_server; } } } -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server"); -} -else { - $SV = new PerlACE::Process ("server"); -} +$SV = $server->CreateProcess ("server"); if ($continuous) { $SV->Arguments ("-ORBSvcConf continuous$PerlACE::svcconf_ext"); @@ -64,10 +63,11 @@ $SV->Spawn (); for $test (@configurations) { - if (PerlACE::waitforfile_timed ($test->{file}, $PerlACE::wait_interval_for_process_creation) == -1) + if ($server->WaitForFileTimed ($test->{file}, + $server->ProcessStartWaitInterval()) == -1) { - $server = $SV->TimedWait (1); - if ($server == 2) + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; @@ -88,28 +88,29 @@ for $test (@configurations) print STDERR "$test->{description}\n"; print STDERR "*************************************************************\n\n"; - run_clients ("-k file://".PerlACE::LocalFile($test->{file}), $number_of_clients); + run_clients ("-k file://".$client->LocalFile($test->{file}), $number_of_clients); } print STDERR "\n************************\n"; print STDERR "Shutting down the server\n"; print STDERR "************************\n\n"; -run_clients ("-k file://".PerlACE::LocalFile($configurations[0]->{file})." -i 0 -x", 1); +run_clients ("-k file://".$client->LocalFile($configurations[0]->{file})." -i 1 -x", 1); kill_server: -$server = $SV->WaitKill (5); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval () + (2 * $number_of_clients * 100)); -if ($server != 0) +if ($server_status != 0) { - print STDERR "ERROR: server returned $server\n"; + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } for $test (@configurations) { - unlink $test->{file}; + $server->DeleteFile ($test->{file}); + $client->DeleteFile ($test->{file}); } exit $status diff --git a/TAO/tests/RTCORBA/Explicit_Binding/run_test.pl b/TAO/tests/RTCORBA/Explicit_Binding/run_test.pl index 77203ccc787..0b445fdf8e5 100755 --- a/TAO/tests/RTCORBA/Explicit_Binding/run_test.pl +++ b/TAO/tests/RTCORBA/Explicit_Binding/run_test.pl @@ -6,48 +6,51 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$status = 0; -$iorbase = "test.ior"; -$iorfile = PerlACE::LocalFile ("$iorbase"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; + +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -unlink $iorfile; +$status = 0; print STDERR "\n********** RTCORBA Explicit Binding Unit Test\n\n"; +$SV = $server->CreateProcess ("server", "-o $server_iorfile -ORBendpoint iiop:// -ORBendpoint shmiop://"); -if (PerlACE::is_vxworks_test()) { -$SV = new PerlACE::ProcessVX ("server", "-o $iorbase -ORBendpoint iiop:// -ORBendpoint shmiop://"); -} -else { -$SV = new PerlACE::Process ("server", "-o $iorfile -ORBendpoint iiop:// -ORBendpoint shmiop://"); -} -$CL = new PerlACE::Process ("client", "-o file://$iorfile -ORBdebuglevel 1"); +$CL = $client->CreateProcess ("client", "-o file://$client_iorfile -ORBdebuglevel 1"); $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); # Clean up SHMIOP files PerlACE::check_n_cleanup_files ("server_shmiop_*"); diff --git a/TAO/tests/RTCORBA/Linear_Priority/run_test.pl b/TAO/tests/RTCORBA/Linear_Priority/run_test.pl index 9258e0539ca..72aaa9fa9f4 100755 --- a/TAO/tests/RTCORBA/Linear_Priority/run_test.pl +++ b/TAO/tests/RTCORBA/Linear_Priority/run_test.pl @@ -6,71 +6,54 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); $status = 0; -$iorfile = PerlACE::LocalFile("ior"); -@configurations = - ( - { +@configurations = ({ server => "-b empty_file -l empty_file", - client => "-b empty_file -p empty_file -x", - }, - { + client => "-b empty_file -p empty_file -x",}, { server => "-b bands -l empty_file", - client => "-b empty_file -p empty_file -x", - }, - { + client => "-b empty_file -p empty_file -x",}, { server => "-b empty_file -l lanes", - client => "-b empty_file -p empty_file -x", - }, - { + client => "-b empty_file -p empty_file -x",}, { server => "-b bands -l lanes", - client => "-b empty_file -p empty_file -x", - }, - { + client => "-b empty_file -p empty_file -x",}, { server => "-b empty_file -l empty_file", - client => "-b bands -p empty_file -x", - }, - { + client => "-b bands -p empty_file -x", }, { server => "-b empty_file -l lanes", - client => "-b bands -p empty_file -x", - }, - { + client => "-b bands -p empty_file -x", }, { server => "-b empty_file -l empty_file", - client => "-b empty_file -p invocation_priorities -x", - }, - { + client => "-b empty_file -p invocation_priorities -x",}, { server => "-b bands -l empty_file", - client => "-b empty_file -p invocation_priorities -x", - }, - { + client => "-b empty_file -p invocation_priorities -x",}, { server => "-b bands -l lanes", - client => "-b empty_file -p invocation_priorities -x", - }, - { + client => "-b empty_file -p invocation_priorities -x",}, { server => "-b empty_file -l empty_file", - client => "-b bands -p invocation_priorities -x", - }, - { + client => "-b bands -p invocation_priorities -x",}, { server => "-b empty_file -l lanes", - client => "-b bands -p invocation_priorities -x", - }, - ); + client => "-b bands -p invocation_priorities -x",}, ); sub run_client { my $arg = shift; - $CL = new PerlACE::Process ("client", "-k file://$iorfile " . $arg); + $CL = $client->CreateProcess ("client", "-k file://$client_iorfile " . $arg); $CL->Spawn (); - $client = $CL->WaitKill (120); + $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval ()); - if ($client != 0) - { - print STDERR "ERROR: client returned $client\n"; + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; zap_server (1); } @@ -78,59 +61,53 @@ sub run_client sub run_server { - if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", @_); - } - else { - $SV = new PerlACE::Process ("server", @_); - } + $SV = $server->CreateProcess ("server", @_); if ($SV->Spawn () == -1) { - exit 1; + exit 1; } - - if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) - { + + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { check_supported_priorities ($SV); - print STDERR "ERROR: cannot find ior file: $iorfile\n"; - $status = 1; - zap_server (1); + print STDERR "ERROR: cannot find ior file: $server_iorfile\n"; + $status = 1; + zap_server (1); } } sub zap_server { - $server = $SV->WaitKill (5); + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); - if ($server != 0) - { - print STDERR "ERROR: server returned $server\n"; + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } + + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); - unlink $iorfile; - - if ($_[0]) - { + if ($_[0]) { exit $status; } } sub check_supported_priorities { - $process = shift; - $returnVal = $process->TimedWait (1); - if ($returnVal == 2) { - # Mark as no longer running to avoid errors on exit. - $process->{RUNNING} = 0; - exit 0; - } + $process = shift; + $returnVal = $process->TimedWait (1); + if ($returnVal == 2) { + # Mark as no longer running to avoid errors on exit. + $process->{RUNNING} = 0; + exit 0; + } } -for $test (@configurations) -{ +for $test (@configurations) { print STDERR "\n******************************************************\n"; - unlink $iorfile; + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); run_server ($test->{server}); diff --git a/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl b/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl index 2ccabdd6f4c..e8d6307ca18 100755 --- a/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl +++ b/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl @@ -6,7 +6,10 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; $status = 0; $quiet = 0; @@ -17,9 +20,16 @@ if ($#ARGV >= 0 && $ARGV[0] eq '-q') { } # Test parameters. -$iorfilebase = "test.ior"; -$iorfile = PerlACE::LocalFile ("$iorfilebase"); -$data_file = PerlACE::LocalFile ("test_run.data"); + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$database = "test_run.data"; +$data_file = $server->LocalFile ($database); +$server->DeleteFile ($database); $debug_level = 1; $iterations = 50; @@ -45,26 +55,18 @@ else { $priority2 = 50; } -# Clean up leftovers from previous runs. -unlink $iorfile; -unlink $data_file; - $server_args = "-ORBdebuglevel $debug_level " ."-ORBendpoint iiop:// " .(PerlACE::is_vxworks_test() ? "" : "-ORBendpoint shmiop:// "); $client_args = - "-o file://$iorfile " + "-o file://$client_iorfile " ."-a $priority1 -b $priority2 -e 1413566210 -f 0 -n $iterations"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-o $iorfilebase $server_args"); -} -else { - $SV = new PerlACE::Process ("server", "-o $iorfile $server_args"); -} -$CL = new PerlACE::Process ("client", $client_args); +$SV = $server->CreateProcess ("server", "-o $server_iorfile $server_args"); + +$CL = $client->CreateProcess ("client", $client_args); print STDERR "\n********** MT Client Protocol & CLIENT_PROPAGATED combo Test\n\n"; @@ -82,11 +84,11 @@ $fh = \*OLDERR; # Run server and client. $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) -{ - $server = $SV->TimedWait (1); - if ($server == 2) - { + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Could not change priority levels so exit. # redirect STDOUT away from $data_file and set back to normal @@ -99,27 +101,24 @@ if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_cr $SV->{RUNNING} = 0; exit $status; } - else - { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); + else { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) -{ - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); -if ($server != 0) -{ - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } @@ -128,35 +127,34 @@ close (STDOUT); open (STDOUT, ">&OLDOUT"); open (STDERR, ">&OLDERR"); -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); # Run a processing script on the test output. print STDERR "\n********** Processing test output\n\n"; $errors = system ("perl process-output.pl $data_file $iterations $priority1 $priority2") >> 8; -if ($errors > 0) -{ +if ($errors > 0) { $status = 1; if (!$quiet) { print STDERR "Errors Detected, printing output\n"; - if (open (DATA, "<$data_file")) - { + if (open (DATA, "<$data_file")) { print STDERR "================================= Begin\n"; print STDERR <DATA>; print STDERR "================================= End\n"; close (DATA); } - else - { + else { print STDERR "ERROR: Could not open $data_file\n"; } } } -unlink $iorfile; -unlink $data_file; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); +$server->DeleteFile($database); # Clean up shmiop files PerlACE::check_n_cleanup_files ("server_shmiop_*"); diff --git a/TAO/tests/RTCORBA/ORB_init/run_test.pl b/TAO/tests/RTCORBA/ORB_init/run_test.pl index 3f20a5b7483..87716f406d6 100755 --- a/TAO/tests/RTCORBA/ORB_init/run_test.pl +++ b/TAO/tests/RTCORBA/ORB_init/run_test.pl @@ -6,18 +6,15 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; print STDERR "\n********** RTCORBA ORB_init Unit Test **********\n\n"; -if (PerlACE::is_vxworks_test()) { - $T = new PerlACE::ProcessVX ("ORB_init"); -} -else { - $T = new PerlACE::Process ("ORB_init"); -} +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$SV = $server->CreateProcess ("ORB_init"); -$test = $T->SpawnWaitKill (60); +$test = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); if ($test != 0) { print STDERR "ERROR: test returned $test\n"; diff --git a/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl b/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl index 3eef51efca3..2ee248e195d 100755 --- a/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl +++ b/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl @@ -6,9 +6,13 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; $status = 0; + $iiop_port = 27532; $tp_iiop_port = 27533; @@ -27,20 +31,22 @@ $extra_server_args = ($continuous ? "-ORBSvcConf continuous$PerlACE::svcconf_ext ); @configurations = - ( - { + ({ iorfiles => [ "persistent_ior", "tp_persistent_ior", "transient_ior" ], - server => "-a tp_persistent_ior -p persistent_ior -t transient_ior $extra_server_args", - clients => [ "-k file://".PerlACE::LocalFile("tp_persistent_ior"), - "-k file://".PerlACE::LocalFile("persistent_ior"), - "-k file://".PerlACE::LocalFile("transient_ior")." -x" ], - }, - { + server => "-a ". $server->LocalFile ("tp_persistent_ior") ." -p ". + $server->LocalFile ("persistent_ior") ." -t ". + $server->LocalFile ("transient_ior") ." $extra_server_args", + clients => [ "-k file://".$client->LocalFile("tp_persistent_ior"), + "-k file://".$client->LocalFile("persistent_ior"), + "-k file://".$client->LocalFile("transient_ior")." -x" ], + }, { iorfiles => [ "not_used_ior_1", "not_used_ior_2", "transient_ior" ], - server => "-a not_used_ior_1 -p not_used_ior_2 -t transient_ior $extra_server_args", - clients => [ "-k file://".PerlACE::LocalFile("tp_persistent_ior"), - "-k file://".PerlACE::LocalFile("persistent_ior"), - "-k file://".PerlACE::LocalFile("transient_ior")." -x" ], + server => "-a ". $server->LocalFile ("not_used_ior_1") ." -p ". + $server->LocalFile ("not_used_ior_2") ." -t ". + $server->LocalFile ("transient_ior") ." $extra_server_args", + clients => [ "-k file://".$client->LocalFile("tp_persistent_ior"), + "-k file://".$client->LocalFile("persistent_ior"), + "-k file://".$client->LocalFile("transient_ior")." -x" ], }, ); @@ -48,15 +54,14 @@ sub run_client { print "\nRunning client with the following args: @_\n\n"; - $CL = new PerlACE::Process ("client", @_); + $CL = $client->CreateProcess ("client", @_); $CL->Spawn (); - $client = $CL->WaitKill (120); + $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval ()+200); - if ($client != 0) - { - print STDERR "ERROR: client returned $client\n"; + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; zap_server (1); } @@ -70,25 +75,12 @@ sub run_server print "\nRunning server with the following args: $args\n\n"; - if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", $args); - } - else { - $SV = new PerlACE::Process ("server", $args); - } - + $SV = $server->CreateProcess ("server", $args); $SV->Spawn (); - # $server = $SV->Wait (10); - # if ($server == 0) - # { - # return 0; - # } - - for $file (@$iorfiles) - { - if (PerlACE::waitforfile_timed ($file, 5) == -1) - { + for $file (@$iorfiles) { + if ($server->WaitForFileTimed ($file, + $server->ProcessStartWaitInterval ()) == -1) { print STDERR "ERROR: cannot find ior file: $file\n"; $status = 1; zap_server (1); @@ -98,48 +90,43 @@ sub run_server sub zap_server { - $server = $SV->WaitKill (5); + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); - if ($server != 0) - { - print STDERR "ERROR: server returned $server\n"; + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } - if ($_[0]) - { - for $file (@iorfiles) - { - unlink $file; + if ($_[0]) { + for $file (@iorfiles) { + $server->DeleteFile ($file); } exit $status; } } -for $file (@iorfiles) -{ - unlink $file; +for $file (@iorfiles) { + $server->DeleteFile ($file); + $client->DeleteFile ($file); } -for $test (@configurations) -{ +for $test (@configurations) { print STDERR "\n******************************************************\n"; run_server ($test->{server}, $test->{iorfiles}); my $clients = $test->{clients}; - for $args (@$clients) - { + for $args (@$clients) { run_client ($args); } zap_server (0); } -for $file (@iorfiles) -{ - unlink $file; +for $file (@iorfiles) { + $server->DeleteFile ($file); + $client->DeleteFile ($file); } exit $status; diff --git a/TAO/tests/RTCORBA/Policies/run_test.pl b/TAO/tests/RTCORBA/Policies/run_test.pl index 03c90ceff0b..9629a5c8a64 100755 --- a/TAO/tests/RTCORBA/Policies/run_test.pl +++ b/TAO/tests/RTCORBA/Policies/run_test.pl @@ -6,19 +6,15 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -if (PerlACE::is_vxworks_test()) { - $T = new PerlACE::ProcessVX ("Policies"); -} -else { - $T = new PerlACE::Process ("Policies"); -} +my $policies = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; -$test = $T->SpawnWaitKill (60); +$SV = $policies->CreateProcess ("Policies"); +$status = $SV->SpawnWaitKill ($policies->ProcessStopWaitInterval ()); -if ($test != 0) { - print STDERR "ERROR: test returned $test\n"; +if ($status != 0) { + print STDERR "ERROR: test returns $status\n"; exit 1; } diff --git a/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl b/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl index d36852652b7..0f283da95ba 100755 --- a/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl +++ b/TAO/tests/RTCORBA/Policy_Combinations/run_test.pl @@ -6,10 +6,13 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + @iorfiles = ( "root", @@ -30,48 +33,40 @@ $status = 0; sub run_client { - $CL = new PerlACE::Process ("client", @_); + $CL = $client->CreateProcess ("client", @_); $CL->Spawn (); - $client = $CL->WaitKill (120); + $client_status = $CL->WaitKill ($client->ProcessStartWaitInterval ()); - if ($client != 0) - { - print STDERR "ERROR: client returned $client\n"; + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; goto kill_server; } } -for $file (@iorfiles) -{ - unlink $file; +for $file (@iorfiles) { + $server->DeleteFile ($file); } -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server"); -} -else { - $SV = new PerlACE::Process ("server"); -} +$SV = $server->CreateProcess ("server"); + $SV->Spawn (); -for $file (@iorfiles) -{ - $file = PerlACE::LocalFile($file); - if (PerlACE::waitforfile_timed ($file, $PerlACE::wait_interval_for_process_creation) == -1) - { - $server = $SV->TimedWait (1); - if ($server == 2) - { +for $file (@iorfiles) { + $server_iorfile = $server->LocalFile ($file); + $client_iorfile = $server->LocalFile ($file); + if ($server->WaitForFileTimed ($file, + $server->ProcessStartWaitInterval()) == -1) { + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; exit $status; } - else - { - print STDERR "ERROR: cannot find ior file: $file\n"; + else { + print STDERR "ERROR: cannot find ior file: $server_iorfile\n"; $status = 1; goto kill_server; } @@ -81,32 +76,27 @@ for $file (@iorfiles) print STDERR "Invoking methods on servant in $file poa\n"; print STDERR "******************************************************\n\n"; - run_client ("-k file://$file"); + run_client ("-k file://$client_iorfile"); } -{ - print STDERR "\n**************************\n"; - print STDERR "Shutting down the server\n"; - print STDERR "**************************\n\n"; - - run_client ("-k file://$iorfiles[0] -i 0 -x"); -} +print STDERR "\n**************************\n"; +print STDERR "Shutting down the server\n"; +print STDERR "**************************\n\n"; - kill_server: - -{ - $server = $SV->WaitKill (5); - - if ($server != 0) - { - print STDERR "ERROR: server returned $server\n"; +$ior_file = $client->LocalFile ($iorfiles[0]); +run_client ("-k file://$ior_file -i 0 -x"); + +kill_server: + print STDERR "Killing server...\n"; + $server_status = $SV->Kill ($server->ProcessStopWaitInterval ()); + + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } - - for $file (@iorfiles) - { - unlink $file; + + for $file (@iorfiles) { + $server->DeleteFile ($file); } -} exit $status; diff --git a/TAO/tests/RTCORBA/Priority_Inversion_With_Bands/run_test.pl b/TAO/tests/RTCORBA/Priority_Inversion_With_Bands/run_test.pl index fe69e135062..d4ae066b917 100755 --- a/TAO/tests/RTCORBA/Priority_Inversion_With_Bands/run_test.pl +++ b/TAO/tests/RTCORBA/Priority_Inversion_With_Bands/run_test.pl @@ -6,118 +6,105 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $server_static_threads = 1; $server_dynamic_threads = 0; + $status = 0; + $continuous = ($^O eq 'hpux'); $common_args = ($continuous ? "-ORBSvcConf continuous$PerlACE::svcconf_ext" : ''); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + + @configurations = - ( - { - file => "ior_2", - args => "-b 0", - description => "Invoking methods on servant in thread lanes without bands", - }, - { - file => "ior_2", - args => "-b 1", - description => "Invoking methods on servant in thread lanes with bands", - }, - { - file => "ior_1", - args => "-b 0", - description => "Invoking methods on servant in thread pool without bands", - }, - { - file => "ior_1", - args => "-b 1", - description => "Invoking methods on servant in thread pool with bands", - }, - ); + ({ + file => "ior_2", + args => "-b 0", + description => "Invoking methods on servant in thread lanes without bands", + },{ + file => "ior_2", + args => "-b 1", + description => "Invoking methods on servant in thread lanes with bands", + },{ + file => "ior_1", + args => "-b 0", + description => "Invoking methods on servant in thread pool without bands", + },{ + file => "ior_1", + args => "-b 1", + description => "Invoking methods on servant in thread pool with bands", + },); sub run_test - { - for $test (@configurations) - { - unlink PerlACE::LocalFile($test->{file}); - } +{ + for $test (@configurations) { + $server->DeleteFile ($test->{file}); + } my @parms = @_; $arg = $parms[0]; - if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "$common_args -s $server_static_threads -d $server_dynamic_threads"); - } - else { - $SV = new PerlACE::Process ("server", "$common_args -s $server_static_threads -d $server_dynamic_threads"); + $SV = $server->CreateProcess ("server", "$common_args -s $server_static_threads -d $server_dynamic_threads"); + + $server_status = $SV->Spawn (); + if ($server_status == -1) { + exit $server_status; } - $server = $SV->Spawn (); - if ($server == -1) - { - exit $status; - } - - for $test (@configurations) - { - if (PerlACE::waitforfile_timed (PerlACE::LocalFile($test->{file}),$PerlACE::wait_interval_for_process_creation ) == -1) - { - $server = $SV->TimedWait (1); - if ($server == 2) - { + for $test (@configurations) { + if ($server->WaitForFileTimed ($test->{file}, + $server->ProcessStartWaitInterval()) == -1) { + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; exit $status; - } - else - { + } + else { print STDERR "ERROR: cannot find ior file: $test->{file}\n"; $status = 1; goto kill_server; - } - } + } + } print $test->{file}."\n"; - } + } - $CL[$i] = new PerlACE::Process ("client", "$common_args $arg"); + $CL[$i] = $client->CreateProcess ("client", "$common_args $arg"); $CL[$i]->Spawn (); - $client = $CL[$i]->WaitKill (20); - if ($client != 0) - { - print STDERR "ERROR: client returned $client\n"; + $client_status = $CL[$i]->WaitKill ($client->ProcessStartWaitInterval (60)); + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; goto kill_server; - } + } - kill_server: +kill_server: - $server = $SV->WaitKill (120); + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval (120)); - if ($server != 0) - { - print STDERR "ERROR: server returned $server\n"; + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; - } + } - for $test (@configurations) - { - unlink PerlACE::LocalFile($test->{file}); - } - } + for $test (@configurations) { + $server->DeleteFile ($test->{file}); + } +} -for $test (@configurations) - { +for $test (@configurations) { print STDERR "\n*************************************************************\n"; print STDERR "$test->{description}\n"; print STDERR "*************************************************************\n\n"; - my $file = PerlACE::LocalFile($test->{file}); + my $file = $server->LocalFile($test->{file}); run_test ("-k file://$file $test->{args}"); - } +} exit $status diff --git a/TAO/tests/RTCORBA/Private_Connection/run_test.pl b/TAO/tests/RTCORBA/Private_Connection/run_test.pl index f54ae35555f..0c6655e2976 100755 --- a/TAO/tests/RTCORBA/Private_Connection/run_test.pl +++ b/TAO/tests/RTCORBA/Private_Connection/run_test.pl @@ -6,50 +6,60 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; $status = 0; -$iorfile1 = PerlACE::LocalFile ("test1.ior"); -$iorfile2 = PerlACE::LocalFile ("test2.ior"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -unlink $iorfile1; -unlink $iorfile2; +my $iorbase1 = "test1.ior"; +my $iorbase2 = "test2.ior"; + +my $server_iorfile1 = $server->LocalFile ($iorbase1); +my $client_iorfile1 = $client->LocalFile ($iorbase1); + +my $server_iorfile2 = $server->LocalFile ($iorbase2); +my $client_iorfile2 = $client->LocalFile ($iorbase2); + +$server->DeleteFile ($iorbase1); +$server->DeleteFile ($iorbase2); + +$client->DeleteFile ($iorbase1); +$client->DeleteFile ($iorbase2); print STDERR "\n********** RTCORBA Private Connection Unit Test\n\n"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-o test1.ior -p test2.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-o $iorfile1 -p $iorfile2"); -} -$CL = new PerlACE::Process ("client", "-o file://$iorfile1 -p file://$iorfile2 -ORBdebuglevel 3 "); +$SV = $server->CreateProcess ("server", "-o $server_iorfile1 -p $server_iorfile2"); +$CL = $client->CreateProcess ("client", "-o file://$client_iorfile1 -p file://$client_iorfile2 -ORBdebuglevel 3 "); $SV->Spawn (); -if (PerlACE::waitforfile_timed ($iorfile2, $PerlACE::wait_interval_for_process_creation) == -1) -{ - print STDERR "ERROR: cannot find file <$iorfile2>\n"; - $SV->Kill (); +if ($server->WaitForFileTimed ($iorbase2, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile2>\n"; + $SV->Kill (); $SV->TimedWait (1); exit 1; } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); -if ($server != 0) { - print STDERR "ERROR: server returned $server \n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status \n"; $status = 1; } -unlink $iorfile1; -unlink $iorfile2; +$server->DeleteFile ($iorbase1); +$server->DeleteFile ($iorbase2); + +$client->DeleteFile ($iorbase1); +$client->DeleteFile ($iorbase2); exit $status; diff --git a/TAO/tests/RTCORBA/Profile_And_Endpoint_Selection/run_test.pl b/TAO/tests/RTCORBA/Profile_And_Endpoint_Selection/run_test.pl index 94688ceb93e..ada7040bb13 100755 --- a/TAO/tests/RTCORBA/Profile_And_Endpoint_Selection/run_test.pl +++ b/TAO/tests/RTCORBA/Profile_And_Endpoint_Selection/run_test.pl @@ -6,19 +6,30 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; use English; -$status = 0; -$iorfile = "ior_2"; -$client_debuglevel = 0; -$server_debuglevel = 0; -$client_debug = 0; -$server_debug = 0; -$iiop = 1; -$shmiop = 1; +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; -$extra_client_args = "-k file://$iorfile -ORBdebuglevel $client_debuglevel -d $client_debug -x"; +my $iorbase = "ior_2"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); + +$server->DeleteFile ($iorbase); +$client->DeleteFile ($iorbase); + +my $client_debuglevel = 0; +my $server_debuglevel = 0; + +my $client_debug = 0; +my $server_debug = 0; + +my $iiop = 1; +my $shmiop = 1; +my $status = 0; + +$extra_client_args = "-k file://$client_iorfile -ORBdebuglevel $client_debuglevel -d $client_debug -x"; $extra_server_args = "-ORBdebuglevel $server_debuglevel -d $server_debug"; if ($OSNAME eq "solaris") { @@ -74,16 +85,15 @@ sub run_client my $client_args = "@_" . " $extra_client_args"; print "client $client_args\n"; - - $CL = new PerlACE::Process ("client", "$client_args"); + + $CL = $client->CreateProcess ("client", "$client_args"); $CL->Spawn (); - $client = $CL->WaitKill (120); + $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval (120)); - if ($client != 0) - { - print STDERR "ERROR: client returned $client\n"; + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; zap_server (1); } @@ -95,56 +105,53 @@ sub run_server print "server $server_args\n"; - $SV = new PerlACE::Process ("server", "$server_args"); + $SV = $server->CreateProcess ("server", "$server_args"); $SV->Spawn (); - if (PerlACE::waitforfile_timed ($iorfile,$PerlACE::wait_interval_for_process_creation ) == -1) - { + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { check_supported_priorities ($SV); - print STDERR "ERROR: cannot find ior file: $iorfile\n"; - $status = 1; - zap_server (1); + print STDERR "ERROR: cannot find ior file <$server_iorfile>\n"; + $status = 1; + zap_server (1); } } sub zap_server { - $server = $SV->WaitKill (5); + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); - if ($server != 0) - { - print STDERR "ERROR: server returned $server\n"; + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } - unlink $iorfile; + $server->DeleteFile ($iorbase); - if ($_[0]) - { + if ($_[0]) { exit $status; } } sub check_supported_priorities { - $process = shift; - $returnVal = $process->TimedWait (1); - if ($returnVal == 2) { - # Mark as no longer running to avoid errors on exit. - $process->{RUNNING} = 0; - exit 0; - } + $process = shift; + $returnVal = $process->TimedWait (1); + if ($returnVal == 2) { + # Mark as no longer running to avoid errors on exit. + $process->{RUNNING} = 0; + exit 0; + } } -for $test (@configurations) -{ +for $test (@configurations) { my $clients = $test->{clients}; - for $args (@$clients) - { + for $args (@$clients) { print STDERR "\n******************************************************\n\n"; - unlink $iorfile; + $server->DeleteFile ($iorbase); + $client->DeleteFile ($iorbase); run_server ($test->{server}); @@ -154,7 +161,8 @@ for $test (@configurations) } } -unlink "ior_1"; +$server->DeleteFile ($iorbase); +$client->DeleteFile ($iorbase); # Clean up SHMIOP files PerlACE::check_n_cleanup_files ("server_shmiop_*"); diff --git a/TAO/tests/RTCORBA/RTMutex/run_test.pl b/TAO/tests/RTCORBA/RTMutex/run_test.pl index 30ceabb45c4..502e544ca79 100755 --- a/TAO/tests/RTCORBA/RTMutex/run_test.pl +++ b/TAO/tests/RTCORBA/RTMutex/run_test.pl @@ -6,21 +6,18 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; print STDERR "\n********** RTCORBA RTMutex Unit Test **********\n\n"; -if (PerlACE::is_vxworks_test()) { - $T = new PerlACE::ProcessVX ("server"); -} -else { - $T = new PerlACE::Process ("server"); -} +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$SV = $server->CreateProcess ("server"); -$test = $T->SpawnWaitKill (60); +$server_status = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval (60)); -if ($test != 0) { - print STDERR "ERROR: test returned $test\n"; +if ($server_status != 0) { + print STDERR "ERROR: test returned $server_status\n"; exit 1; } diff --git a/TAO/tests/RTCORBA/Server_Declared/run_test.pl b/TAO/tests/RTCORBA/Server_Declared/run_test.pl index 82d5e912a39..777edcbd732 100755 --- a/TAO/tests/RTCORBA/Server_Declared/run_test.pl +++ b/TAO/tests/RTCORBA/Server_Declared/run_test.pl @@ -6,13 +6,25 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; -$iorfile1 = PerlACE::LocalFile ("test1.ior"); -$iorfile2 = PerlACE::LocalFile ("test2.ior"); +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase1 = "test1.ior"; +my $iorbase2 = "test2.ior"; +my $client_iorfile1 = $client->LocalFile ("$iorbase1"); +my $server_iorfile1 = $server->LocalFile ("$iorbase1"); + +my $client_iorfile2 = $client->LocalFile ("$iorbase2"); +my $server_iorfile2 = $server->LocalFile ("$iorbase2"); + +$server->DeleteFile($iorbase1); +$client->DeleteFile($iorbase1); + +$server->DeleteFile($iorbase2); +$client->DeleteFile($iorbase2); -unlink $iorfile1; -unlink $iorfile2; $status = 0; $server_args = @@ -35,57 +47,54 @@ elsif ($^O eq "hpux") { } if ($continuous) { - $server_args .= " -ORBSvcConf continuous$PerlACE::svcconf_ext"; + $server_args .= " -ORBSvcConf continuous$PerlACE::svcconf_ext"; } -$client_args = "-p file://$iorfile1 -o file://$iorfile2"; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-p test1.ior -o test2.ior $server_args"); -} -else { - $SV = new PerlACE::Process ("server", "-p $iorfile1 -o $iorfile2 $server_args"); -} -$CL = new PerlACE::Process ("client", $client_args); +$SV = $server->CreateProcess ("server", "-p $server_iorfile1 -o $server_iorfile2 $server_args"); +$CL = $client->CreateProcess ("client", "-p file://$client_iorfile1 -o file://$client_iorfile2"); print STDERR "\n********** RTCORBA SERVER_DECLARED Priority Unit Test\n\n"; +$server_status = $SV->Spawn (); -$SV->Spawn (); +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} -if (PerlACE::waitforfile_timed ($iorfile2, $PerlACE::wait_interval_for_process_creation) == -1) -{ - $server = $SV->TimedWait (1); - if ($server == 2) - { +if ($server->WaitForFileTimed ($iorbase2, + $server->ProcessStartWaitInterval ()) == -1) { + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. - $SV->{RUNNING} = 0; - exit $status; - } - else - { - print STDERR "ERROR: cannot find file <$iorfile2>\n"; - $SV->Kill (); + $SV->{RUNNING} = 0; + exit $status; + } + else { + print STDERR "ERROR: cannot find file <$server_iorfile2>\n"; + $SV->Kill (); exit 1; } } -$client = $CL->SpawnWaitKill (60); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); -if ($client != 0) -{ - print STDERR "ERROR: client returned $client\n"; +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } -$server = $SV->WaitKill (60); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); -if ($server != 0) -{ - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } -unlink $iorfile1; -unlink $iorfile2; +$server->DeleteFile($iorbase1); +$client->DeleteFile($iorbase1); + +$server->DeleteFile($iorbase2); +$client->DeleteFile($iorbase2); exit $status; diff --git a/TAO/tests/RTCORBA/Server_Protocol/run_test.pl b/TAO/tests/RTCORBA/Server_Protocol/run_test.pl index 3ebdb34632b..101b3a7a7d5 100755 --- a/TAO/tests/RTCORBA/Server_Protocol/run_test.pl +++ b/TAO/tests/RTCORBA/Server_Protocol/run_test.pl @@ -6,20 +6,23 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; -$iorfilebase = "test.ior"; -$iorfile = PerlACE::LocalFile ("$iorfilebase"); +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -unlink $iorfile; $status = 0; -$server_reverse_conf = PerlACE::LocalFile ("server_reverse$PerlACE::svcconf_ext"); -$server_iiop_conf = PerlACE::LocalFile ("server_iiop$PerlACE::svcconf_ext"); -$server_uiop_conf = PerlACE::LocalFile ("server_uiop$PerlACE::svcconf_ext"); -$server_shmiop_conf = PerlACE::LocalFile ("server_shmiop$PerlACE::svcconf_ext"); -$server_iiop_uiop_conf = PerlACE::LocalFile ("server_iiop_uiop$PerlACE::svcconf_ext"); -$server_iiop_shmiop_conf = PerlACE::LocalFile ("server_iiop_shmiop$PerlACE::svcconf_ext"); -$server_reverse_nt_conf = PerlACE::LocalFile ("server_reverse_nt$PerlACE::svcconf_ext"); +$server_reverse_conf = $server->LocalFile ("server_reverse$PerlACE::svcconf_ext"); +$server_iiop_uiop_conf = $server->LocalFile ("server_iiop_uiop$PerlACE::svcconf_ext"); +$server_iiop_shmiop_conf = $server->LocalFile ("server_iiop_shmiop$PerlACE::svcconf_ext"); +$server_reverse_nt_conf = $server->LocalFile ("server_reverse_nt$PerlACE::svcconf_ext"); # Configurations for all tests to be run. @server_opts = @@ -63,57 +66,50 @@ print STDERR "********** RTCORBA Server Protocol Policy Unit Test\n"; $test_number = 0; -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server"); -} -else { - $SV = new PerlACE::Process ("server"); -} -$CL = new PerlACE::Process ("client"); +$SV = $server->CreateProcess ("server"); + +$CL = $client->CreateProcess ("client"); foreach $o (@server_opts) { print STDERR "\n\n----------------------------------\n"; print STDERR " ".$comments[$test_number]; - if (PerlACE::is_vxworks_test()) { - my $args = "$o -o $iorfilebase"; - } - else { - my $args = "$o -o $iorfile"; - } + my $args = "$o -o $server_iorfile"; - unlink $iorfile; + $server->DeleteFile ($iorbase); $SV->Arguments ($args); $SV->Spawn (); - if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find IOR file <$iorfile>\n"; + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } - $CL->Arguments ("-k file://$iorfile -ORBdebuglevel 1"); + $CL->Arguments ("-k file://$client_iorfile -ORBdebuglevel 1"); - $client = $CL->SpawnWaitKill (60); + $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ()); - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; } - $server = $SV->WaitKill (60); + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ()); - if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; } $test_number++; } -unlink $iorfile; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); # Clean up SHMIOP files PerlACE::check_n_cleanup_files ("server_shmiop_*"); diff --git a/TAO/tests/RTCORBA/Thread_Pool/run_test.pl b/TAO/tests/RTCORBA/Thread_Pool/run_test.pl index 2ef990c01ce..d51b5d263d5 100755 --- a/TAO/tests/RTCORBA/Thread_Pool/run_test.pl +++ b/TAO/tests/RTCORBA/Thread_Pool/run_test.pl @@ -6,31 +6,31 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; $number_of_clients = 4; $status = 0; $continuous = ($^O eq 'hpux'); @configurations = - ( - { - file => "ior_1", - description => "Invoking methods on servant in default thread pool", - }, - { - file => "ior_2", - description => "Invoking methods on servant in first RT thread pool (without lanes)", - }, - { - file => "ior_3", - description => "Invoking methods on servant in second RT thread pool (with lanes)", + ({ + file => "ior_1", + description => "Invoking methods on servant in default thread pool", + },{ + file => "ior_2", + description => "Invoking methods on servant in first RT thread pool (without lanes)", + },{ + file => "ior_3", + description => "Invoking methods on servant in second RT thread pool (with lanes)", }, ); -for $test (@configurations) -{ - unlink $test->{file}; +for $test (@configurations) { + $server->DeleteFile ($test->{file}); + $client->DeleteFile ($test->{file}); } sub run_clients @@ -38,87 +38,78 @@ sub run_clients my @parms = @_; $arg = $parms[0]; $clients = $parms[1]; + - for ($i = 0; $i < $clients; $i++) - { - $CL[$i] = new PerlACE::Process ("client", $arg); + for ($i = 0; $i < $clients; $i++) { + $CL[$i] = $client->CreateProcess ("client", $arg); $CL[$i]->Spawn (); } - for ($i = 0; $i < $clients; $i++) - { - $client = $CL[$i]->WaitKill (120); - if ($client != 0) - { - print STDERR "ERROR: client returned $client\n"; + for ($i = 0; $i < $clients; $i++) { + $client_status = $CL[$i]->WaitKill ($client->ProcessStopWaitInterval (120)); + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; $status = 1; goto kill_server; } } + print STDERR "Finished running clients"; } -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server"); -} -else { - $SV = new PerlACE::Process ("server"); -} +$SV = $server->CreateProcess ("server"); if ($continuous) { - $SV->Arguments ("-ORBSvcConf continuous$PerlACE::svcconf_ext"); + $SV->Arguments ("-ORBSvcConf continuous$PerlACE::svcconf_ext"); } $SV->Spawn (); -for $test (@configurations) -{ - if (PerlACE::waitforfile_timed ($test->{file}, $PerlACE::wait_interval_for_process_creation) == -1) - { - $server = $SV->TimedWait (1); - if ($server == 2) - { +for $test (@configurations) { + if ($server->WaitForFileTimed ($test->{file}, + $server->ProcessStartWaitInterval()) == -1) { + $server_status = $SV->TimedWait (1); + if ($server_status == 2) { # Mark as no longer running to avoid errors on exit. $SV->{RUNNING} = 0; exit $status; } - else - { + else { print STDERR "ERROR: cannot find ior file: $test->{file}\n"; $status = 1; goto kill_server; - } + } } - } - -for $test (@configurations) - { +} + +for $test (@configurations) { print STDERR "\n*************************************************************\n"; print STDERR "$test->{description}\n"; print STDERR "*************************************************************\n\n"; - run_clients ("-k file://".PerlACE::LocalFile($test->{file}), $number_of_clients); - } + $iorfile = $client->LocalFile ($test->{file}); + run_clients ("-k file://$iorfile", $number_of_clients); + print STDERR "Prepare next cycle"; +} print STDERR "\n************************\n"; print STDERR "Shutting down the server\n"; print STDERR "************************\n\n"; -run_clients ("-k file://".PerlACE::LocalFile($configurations[0]->{file})." -i 0 -x", 1); +$client_iorfile = $client->LocalFile ($configurations[0]->{file}); +run_clients ("-k file://$client_iorfile -i 0 -x", 1); kill_server: -$server = $SV->WaitKill (5); +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval () + (2 * $number_of_clients * 100)); -if ($server != 0) - { - print STDERR "ERROR: server returned $server\n"; +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; $status = 1; - } +} -for $test (@configurations) - { - unlink $test->{file}; - } +for $test (@configurations) { + $client->DeleteFile ($test->{file}); + $server->DeleteFile ($test->{file}); +} exit $status - diff --git a/TAO/tests/Sequence_Iterators/Bounded_String.cpp b/TAO/tests/Sequence_Iterators/Bounded_String.cpp new file mode 100644 index 00000000000..5fa03c18753 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/Bounded_String.cpp @@ -0,0 +1,675 @@ +/** + * @file Bounded_String.cpp + * + * @brief test for STL iterator behaviour of CORBA bounded string sequence + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ + +#include "tao/Bounded_Basic_String_Sequence_T.h" +#include "tao/CORBA_String.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +#include <iostream> +#include <iterator> +#include <sstream> + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +typedef TAO::bounded_basic_string_sequence<char, 4> s_sequence; + +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +template <typename ITERATOR_T> +int test_sequence () +{ + s_sequence a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + a.length (4); + + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + a[0] = CORBA::string_dup (elem0_cstr); + a[1] = CORBA::string_dup (elem1_cstr); + a[2] = CORBA::string_dup (elem2_cstr); + a[3] = CORBA::string_dup (elem3_cstr); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //char* value0 = *a_it; + //FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem0_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem0_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem1_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[0]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[2]) != 0); + + // test operator[] write + // NOTE: This now changes the sequence a. + // NOTE: This does not work for const_iterators which are + // sometimes used in this function. + // a_it[0] = CORBA::string_dup (elem0_cstr); + // FAIL_RETURN_IF (ACE_OS::strcmp (a[2],elem0_cstr) != 0); + + // reset content of sequence a + //a[2] = CORBA::string_dup (elem2_cstr); + + // test for loop behaviour + s_sequence b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + s_sequence test; + test.length (4); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<s_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename ITERATOR_T> +int test_const_sequence () +{ + // setup of an example sequence + s_sequence setup; + setup.length (4); + + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + setup[0] = CORBA::string_dup (elem0_cstr); + setup[1] = CORBA::string_dup (elem1_cstr); + setup[2] = CORBA::string_dup (elem2_cstr); + setup[3] = CORBA::string_dup (elem3_cstr); + + const s_sequence a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //char* value0 = *a_it; + //FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem0_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem0_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem1_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[0]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[2]) != 0); + + // test for loop behaviour + s_sequence b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + s_sequence test; + test.length (4); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<s_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_sequence_reverse () +{ + s_sequence a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + a.length (4); + + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + a.length (4); + a[0] = CORBA::string_dup (elem0_cstr); + a[1] = CORBA::string_dup (elem1_cstr); + a[2] = CORBA::string_dup (elem2_cstr); + a[3] = CORBA::string_dup (elem3_cstr); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //char* value0 = *a_it; + //FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem3_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem3_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem2_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[3]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[1]) != 0); + + // test operator[] write + // NOTE: This now changes the sequence a. + // this is not possible for const iterators which are + // sometimes used by this function. + // a_it[0] = CORBA::string_dup (elem0_cstr); + // FAIL_RETURN_IF (ACE_OS::strcmp (a[1],elem0_cstr) != 0); + + // reset content of sequence a + //a[1] = CORBA::string_dup (elem1_cstr); + + // test for loop behaviour + s_sequence b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + s_sequence test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<s_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_const_sequence_reverse () +{ + // setup of an example sequence + s_sequence setup; + setup.length (4); + + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + setup[0] = CORBA::string_dup (elem0_cstr); + setup[1] = CORBA::string_dup (elem1_cstr); + setup[2] = CORBA::string_dup (elem2_cstr); + setup[3] = CORBA::string_dup (elem3_cstr); + + const s_sequence a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //char* value0 = *a_it; + //FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem3_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem3_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem2_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[3]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[1]) != 0); + + // test for loop behaviour + s_sequence b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + s_sequence test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<s_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + + return 0; +} + +#endif + +//----------------------------------------------------------------------------- + +int ACE_TMAIN(int,ACE_TCHAR*[]) +{ + int status = 0; + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + // Test Generic_Sequence_Iterator. + status += test_sequence<s_sequence::iterator> (); + + // Test Const_Generic_Sequence_Iterator with non-const sequence. + status += test_sequence<s_sequence::const_iterator> (); + + // Test Const_Generic_Sequence_Iterator with const sequence. + status += test_const_sequence<s_sequence::const_iterator> (); + + // Test Generic_Sequence_Reverse_Iterator. + status += test_sequence_reverse<s_sequence::reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with non-const sequence. + status += test_sequence_reverse<s_sequence::const_reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with const sequence. + status += test_const_sequence_reverse<s_sequence::const_reverse_iterator> (); + +#endif + + return status; +} + diff --git a/TAO/tests/Sequence_Iterators/Sequence_Iterators.mpc b/TAO/tests/Sequence_Iterators/Sequence_Iterators.mpc new file mode 100644 index 00000000000..2750d6ef2a3 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/Sequence_Iterators.mpc @@ -0,0 +1,31 @@ +// -*- MPC -*- +// $Id$ + +project(StringSeq) : taoexe { + exename = StringSeq + Source_Files { + StringSeq.cpp + } +} + +project(Bounded_String) : taoexe { + exename = Bounded_String + Source_Files { + Bounded_String.cpp + } +} + +project(Unbounded_Value) : taoexe { + exename = Unbounded_Value + Source_Files { + Unbounded_Value.cpp + } +} + +project(Unbounded_Objectref) : taoexe { + exename = Unbounded_Objectref + Source_Files { + mock_reference.cpp + Unbounded_Objectref.cpp + } +} diff --git a/TAO/tests/Sequence_Iterators/StringSeq.cpp b/TAO/tests/Sequence_Iterators/StringSeq.cpp new file mode 100644 index 00000000000..639c0ff6196 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/StringSeq.cpp @@ -0,0 +1,961 @@ +/** + * @file StringSeq.cpp + * + * @brief test for STL iterator behaviour of CORBA unbounded string sequence + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ + +#include "tao/StringSeqC.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +#include <iostream> +#include <iterator> +#include <sstream> + +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +//----------------------------------------------------------------------------- + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +template <typename ITERATOR_T> +int test_sequence () +{ + ::CORBA::StringSeq a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + a.length (4); + // Create a case to test for memory leaks + // in the sequence. + a[0] = CORBA::string_dup (elem0_cstr); + a[0] = CORBA::string_dup (elem0_cstr); + a[1] = CORBA::string_dup (elem1_cstr); + a[2] = CORBA::string_dup (elem2_cstr); + a[3] = CORBA::string_dup (elem3_cstr); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + + // Create a case to test for memory leaks + // in the iterator. + *a_it = CORBA::string_dup (elem0_cstr); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // I'm not sure this test makes sense since what's returned from + // dereferencing the iterator is an r value. + const char* value_seq = a[0]; + FAIL_RETURN_IF (ACE_OS::strcmp (value_seq, elem0_cstr) != 0); + const char* value0 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem0_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem0_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem1_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[0]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[2]) != 0); + + // test operator[] write + // NOTE: This assignment actually modifies the third element + // in the sequence since the iterator was previously positioned + // at the third element. I believe these are the proper semantics + // for using the bracket operator with an iterator. The number + // in the brackets is additive - not absolute. + a_it[0] = CORBA::string_dup (elem2_cstr); + FAIL_RETURN_IF (ACE_OS::strcmp (a[2], elem2_cstr) != 0); + + // reset content of sequence a + a[1] = CORBA::string_dup (elem1_cstr); + + // test for loop behaviour + ::CORBA::StringSeq b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + ::CORBA::StringSeq test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + std::ostream_iterator<CORBA::StringSeq::const_value_type> (ostream, + "\n")); + + // The third sequence element has been modified. Either we need to restore + // the original sequence values or modify the test here. I modified the + // test since it's easier. + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename ITERATOR_T> +int test_sequence_const_iterator () +{ + ::CORBA::StringSeq a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + a.length (4); + a[0] = CORBA::string_dup (elem0_cstr); + a[0] = CORBA::string_dup (elem0_cstr); + a[1] = CORBA::string_dup (elem1_cstr); + a[2] = CORBA::string_dup (elem2_cstr); + a[3] = CORBA::string_dup (elem3_cstr); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // I'm not sure non-const deferencing makes sense since + // we are getting an r value. + const char * value0 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem0_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem0_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem1_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[0]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[2]) != 0); + + // test for loop behaviour + ::CORBA::StringSeq b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + ::CORBA::StringSeq test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + std::ostream_iterator<CORBA::StringSeq::const_value_type>(ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename ITERATOR_T> +int test_const_sequence () +{ + // setup of an example sequence + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + ::CORBA::StringSeq setup; + setup.length (4); + setup[0] = CORBA::string_dup (elem0_cstr); + setup[1] = CORBA::string_dup (elem1_cstr); + setup[2] = CORBA::string_dup (elem2_cstr); + setup[3] = CORBA::string_dup (elem3_cstr); + + const ::CORBA::StringSeq a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + ITERATOR_T c_iter1 (a.begin ()); + ITERATOR_T c_iter2 = a.begin (); + FAIL_RETURN_IF (!(c_iter1 == c_iter2)); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // JWH2 - This test shouldn't be done when dealing with + // a const iterator (which we sometimes do with the current + // testing setup). + //typename ITERATOR_T::element_type value0 = *a_it; + //FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem0_cstr) != 0); + + // test const dereferencing + typename ITERATOR_T::const_element_type value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem0_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem1_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem3_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[0]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[2]) != 0); + + // test for loop behaviour + const ::CORBA::StringSeq b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + ::CORBA::StringSeq test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + std::ostream_iterator<CORBA::StringSeq::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_sequence_reverse () +{ + ::CORBA::StringSeq a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + a.length (4); + a[0] = CORBA::string_dup (elem0_cstr); + a[1] = CORBA::string_dup (elem1_cstr); + a[2] = CORBA::string_dup (elem2_cstr); + a[3] = CORBA::string_dup (elem3_cstr); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + + // Create a case to test for memory leaks + // in the iterator. + *a_it = CORBA::string_dup (elem3_cstr); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + typename REVERSE_ITERATOR_T::element_type value0 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem3_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem3_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem2_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[3]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[1]) != 0); + + // test operator[] write + a_it[0] = CORBA::string_dup (elem0_cstr); + FAIL_RETURN_IF (ACE_OS::strcmp (a[1],elem0_cstr) != 0); + + // reset content of sequence a + a[1] = CORBA::string_dup (elem1_cstr); + + // test for loop behaviour + ::CORBA::StringSeq b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + ::CORBA::StringSeq test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + std::ostream_iterator<CORBA::StringSeq::element_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_sequence_reverse_const_iterator () +{ + ::CORBA::StringSeq a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + a.length (4); + a[0] = CORBA::string_dup (elem0_cstr); + a[1] = CORBA::string_dup (elem1_cstr); + a[2] = CORBA::string_dup (elem2_cstr); + a[3] = CORBA::string_dup (elem3_cstr); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + typename REVERSE_ITERATOR_T::const_element_type value0 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem3_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem3_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem2_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[3]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[1]) != 0); + + // test for loop behaviour + ::CORBA::StringSeq b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + ::CORBA::StringSeq test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + std::ostream_iterator<CORBA::StringSeq::element_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_const_sequence_reverse () +{ + // setup of an example sequence + const char * elem0_cstr = "elem0"; + const char * elem1_cstr = "elem1"; + const char * elem2_cstr = "elem2"; + const char * elem3_cstr = "elem3"; + + ::CORBA::StringSeq setup;; + setup.length (4); + setup[0] = CORBA::string_dup (elem0_cstr); + setup[1] = CORBA::string_dup (elem1_cstr); + setup[2] = CORBA::string_dup (elem2_cstr); + setup[3] = CORBA::string_dup (elem3_cstr); + + const ::CORBA::StringSeq a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + typename REVERSE_ITERATOR_T::const_element_type value0 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value0, elem3_cstr) != 0); + + // test const dereferencing + const char* const value1 = *a_it; + FAIL_RETURN_IF (ACE_OS::strcmp (value1, elem3_cstr) != 0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem2_cstr) != 0); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, elem0_cstr) != 0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[3]) != 0); + a_it += 2; + FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[1]) != 0); + + // test for loop behaviour + ::CORBA::StringSeq b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*a_it, *b_it) != 0); + } + + ::CORBA::StringSeq test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (ACE_OS::strcmp (*copya_iter, *copytest_iter) != 0); + } + + /// Testing - using ostream_iterator + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + std::ostream_iterator<CORBA::StringSeq::const_element_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + + return 0; +} + +#endif + +//----------------------------------------------------------------------------- + +int ACE_TMAIN(int,ACE_TCHAR*[]) +{ + int status = 0; + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + // Test Generic_Sequence_Iterator. + status += test_sequence< ::CORBA::StringSeq::iterator> (); + + // g++ seems to make the conversion from iterator to const_iterator + // and Windows doesn't. Not sure why. + // Test Const_Generic_Sequence_Iterator with non-const sequence. + status += test_sequence_const_iterator < + ::CORBA::StringSeq::const_iterator> (); + + // Test Const_Generic_Sequence_Iterator with const sequence. + status += test_const_sequence< ::CORBA::StringSeq::const_iterator> (); + + // Test Generic_Sequence_Reverse_Iterator. + status += test_sequence_reverse< ::CORBA::StringSeq::reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with non-const sequence. + status += test_sequence_reverse_const_iterator< + ::CORBA::StringSeq::const_reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with const sequence. + status += test_const_sequence_reverse< + ::CORBA::StringSeq::const_reverse_iterator> (); +#endif + + return status; +} diff --git a/TAO/tests/Sequence_Iterators/Unbounded_Objectref.cpp b/TAO/tests/Sequence_Iterators/Unbounded_Objectref.cpp new file mode 100644 index 00000000000..17532c58c3c --- /dev/null +++ b/TAO/tests/Sequence_Iterators/Unbounded_Objectref.cpp @@ -0,0 +1,669 @@ +/** + * @file Unbounded_Objectref.cpp + * + * @brief test for STL iterator behaviour of CORBA unbounded object reference + * sequence + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ + +#include "ace/Log_Msg.h" + +#include <iostream> +#include <iterator> +#include <sstream> + +#include "tao/Object_Reference_Traits_T.h" +#include "mock_reference.hpp" +#include "tao/Unbounded_Object_Reference_Sequence_T.h" + +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +typedef TAO::unbounded_object_reference_sequence<mock_reference, mock_reference_var> tested_sequence; + +template <typename ITERATOR_T> +int test_sequence () +{ + tested_sequence a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + mock_reference* elem0 = mock_reference::allocate (0); + mock_reference* elem1 = mock_reference::allocate (1); + mock_reference* elem2 = mock_reference::allocate (2); + mock_reference* elem3 = mock_reference::allocate (3); + + // setup of an example sequence + a.length (4); + + a[0] = elem0; + a[1] = elem1; + a[2] = elem2; + a[3] = elem3; + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + mock_reference* value0 = *a_it; + FAIL_RETURN_IF (value0->id () != elem0->id ()); + + // test const dereferencing + const mock_reference* const value1 = *a_it; + FAIL_RETURN_IF (value1->id () != elem0->id ()); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF ((*a_it)->id () != elem1->id ()); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem3->id ()); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem3->id ()); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (a_it[0]->id () != a[0]->id ()); + a_it += 2; + FAIL_RETURN_IF (a_it[0]->id () != a[2]->id ()); + + // test for loop behaviour + tested_sequence b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF ((*a_it)->id () != (*b_it)->id ()); + } + + tested_sequence test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF ((*copya_iter)->id () != (*copytest_iter)->id ()); + } + + /// Testing - using ostream_iterator + /// JWH2 - I don't think the ostream test makes sense for object references. + /* + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + std::ostream_iterator<tested_sequence::value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + */ + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename ITERATOR_T> +int test_const_sequence () +{ + // setup of an example sequence + tested_sequence setup; + setup.length (4); + + mock_reference* elem0 = mock_reference::allocate (0); + mock_reference* elem1 = mock_reference::allocate (1); + mock_reference* elem2 = mock_reference::allocate (2); + mock_reference* elem3 = mock_reference::allocate (3); + + // setup of an example sequence + setup[0] = elem0; + setup[1] = elem1; + setup[2] = elem2; + setup[3] = elem3; + + const tested_sequence a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + mock_reference* value0 = *a_it; + FAIL_RETURN_IF (value0->id () != elem0->id ()); + + // test const dereferencing + const mock_reference* const value1 = *a_it; + FAIL_RETURN_IF (value1->id () != elem0->id ()); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF ((*a_it)->id () != elem1->id ()); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem3->id ()); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem3->id ()); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF ((a_it[0])->id () != a[0]->id ()); + a_it += 2; + FAIL_RETURN_IF ((a_it[0])->id () != a[2]->id ()); + + // test for loop behaviour + tested_sequence b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF ((*a_it)->id () != (*b_it)->id ()); + } + + tested_sequence test; + test.length (4); + + /* + * The copy call below causes double deletes and seg faults. + */ + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF ((*copya_iter)->id () != (*copytest_iter)->id ()); + } + + /// Testing - using ostream_iterator + /// JWH2 - I don't think the ostream test makes sense for object references. + /* + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + std::ostream_iterator<tested_sequence::value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0); + */ + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_sequence_reverse () +{ + tested_sequence a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + a.length (4); + + mock_reference* elem0 = mock_reference::allocate (0); + mock_reference* elem1 = mock_reference::allocate (1); + mock_reference* elem2 = mock_reference::allocate (2); + mock_reference* elem3 = mock_reference::allocate (3); + + // setup of an example sequence + a.length (4); + a[0] = elem0; + a[1] = elem1; + a[2] = elem2; + a[3] = elem3; + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + mock_reference* value0 = *a_it; + FAIL_RETURN_IF (value0->id () != elem3->id ()); + + // test const dereferencing + const mock_reference* const value1 = *a_it; + FAIL_RETURN_IF (value1->id () != elem3->id ()); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF ((*a_it)->id () != elem2->id ()); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem0->id ()); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem0->id ()); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF ((a_it[0])->id () != a[3]->id ()); + a_it += 2; + FAIL_RETURN_IF ((a_it[0])->id () != a[1]->id ()); + + // test for loop behaviour + tested_sequence b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF ((*a_it)->id () != (*b_it)->id ()); + } + + tested_sequence test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF ((*copya_iter)->id () != (*copytest_iter)->id ()); + } + + /// Testing - using ostream_iterator + /// JWH2 - I don't think the ostream test makes sense for object references. + /* + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + std::ostream_iterator<tested_sequence::value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + */ + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_const_sequence_reverse () +{ + // setup of an example sequence + tested_sequence setup; + setup.length (4); + + mock_reference* elem0 = mock_reference::allocate (0); + mock_reference* elem1 = mock_reference::allocate (1); + mock_reference* elem2 = mock_reference::allocate (2); + mock_reference* elem3 = mock_reference::allocate (3); + + // setup of an example sequence + setup[0] = elem0; + setup[1] = elem1; + setup[2] = elem2; + setup[3] = elem3; + + const tested_sequence a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + mock_reference* value0 = *a_it; + FAIL_RETURN_IF (value0->id () != elem3->id ()); + + // test const dereferencing + const mock_reference* const value1 = *a_it; + FAIL_RETURN_IF (value1->id () != elem3->id ()); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF ((*a_it)->id () != elem2->id ()); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem0->id ()); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF ((*a_it)->id () != elem0->id ()); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF ((a_it[0])->id () != a[3]->id ()); + a_it += 2; + FAIL_RETURN_IF ((a_it[0])->id () != a[1]->id ()); + + // test operator[] write + // NOTE: This now changes the sequence a. + // this is not possible for const iterators + // a_it[0] = CORBA::string_dup (elem0_cstr); + // FAIL_RETURN_IF (ACE_OS::strcmp (a[1],elem0_cstr) != 0); + + // reset content of sequence a + //a[1] = CORBA::string_dup (elem1_cstr); + + // test for loop behaviour + tested_sequence b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF ((*a_it)->id () != (*b_it)->id ()); + } + + tested_sequence test; + test.length (a.length ()); + + /* + * The copy call below causes double deletes and seg faults. + */ + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF ((*copya_iter)->id () != (*copytest_iter)->id ()); + } + + /// Testing - using ostream_iterator + /// JWH2 - I don't think the ostream test makes sense for object references. + /* + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + std::ostream_iterator<tested_sequence::value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("elem3\nelem2\nelem1\nelem0\n") != 0); + */ + + return 0; +} + +#endif + +//----------------------------------------------------------------------------- + +int ACE_TMAIN(int,ACE_TCHAR*[]) +{ + int status = 0; + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + // Test Generic_Sequence_Iterator. + status += test_sequence< tested_sequence::iterator> (); + + // g++ seems to make the conversion from iterator to const_iterator + // and Windows doesn't. Not sure why. + // Test Const_Generic_Sequence_Iterator with non-const sequence. + status += test_sequence< tested_sequence::const_iterator> (); + + // Test Const_Generic_Sequence_Iterator with const sequence. + status += test_const_sequence< tested_sequence::const_iterator> (); + + // Test Generic_Sequence_Reverse_Iterator. + status += test_sequence_reverse< tested_sequence::reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with non-const sequence. + status += test_sequence_reverse< tested_sequence::const_reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with const sequence. + status += test_const_sequence_reverse< tested_sequence::const_reverse_iterator> (); + +#endif /* TAO_HAS_SEQUENCE_ITERATORS == 1 */ + + return status; +} diff --git a/TAO/tests/Sequence_Iterators/Unbounded_Value.cpp b/TAO/tests/Sequence_Iterators/Unbounded_Value.cpp new file mode 100644 index 00000000000..70b3b8097a4 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/Unbounded_Value.cpp @@ -0,0 +1,692 @@ +/** + * @file Unbounded_Value.cpp + * + * @brief test for STL iterator behaviour of CORBA bounded string sequence + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ + +#include "tao/Unbounded_Value_Sequence_T.h" +#include "ace/Log_Msg.h" + +#include <iostream> +#include <iterator> +#include <sstream> + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + +typedef TAO::unbounded_value_sequence<int> v_sequence; + +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +template <typename ITERATOR_T> +int test_sequence () +{ + v_sequence a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + a.length (4); + + int elem0 = 0; + int elem1 = 1; + int elem2 = 2; + int elem3 = 3; + + a[0] = elem0; + a[1] = elem1; + a[2] = elem2; + a[3] = elem3; + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //int value0 = *a_it; + //FAIL_RETURN_IF (value0 != elem0); + + // test const dereferencing + int value1 = *a_it; + FAIL_RETURN_IF (value1 != elem0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (*a_it != elem1); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem3); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem3); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (a_it[0] != a[0]); + a_it += 2; + FAIL_RETURN_IF (a_it[0] != a[2]); + + // test operator[] write + // NOTE: This now changes the sequence a. + // NOTE: This does not work for const_iterators + // a_it[0] = elem0; + // FAIL_RETURN_IF (a[2] != elem0); + + // reset content of sequence a + //a[2] = elem2; + + // test for loop behaviour + v_sequence b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (*a_it != *b_it); + } + + v_sequence test; + test.length (4); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (*copya_iter != *copytest_iter); + } + + /// Testing - using ostream_iterator + + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<v_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("0\n1\n2\n3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename ITERATOR_T> +int test_const_sequence () +{ + // setup of an example sequence + v_sequence setup; + setup.length (4); + + int elem0 = 0; + int elem1 = 1; + int elem2 = 2; + int elem3 = 3; + + setup[0] = elem0; + setup[1] = elem1; + setup[2] = elem2; + setup[3] = elem3; + + const v_sequence a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + ITERATOR_T a_it (a.begin ()); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test assignment operator + a_it = a.begin (); + FAIL_RETURN_IF (a_it != a.begin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //char* value0 = *a_it; + //FAIL_RETURN_IF (value0 != elem0); + + // test const dereferencing + int value1 = *a_it; + FAIL_RETURN_IF (value1 != elem0); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.begin()); + FAIL_RETURN_IF (*a_it != elem1); + + // test < operator + FAIL_RETURN_IF (!(a.begin () < a_it)); + FAIL_RETURN_IF (a_it < a.begin ()); + + // test difference type + int a_diff = a_it - a.begin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.end (); + a_it--; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem3); + + // test pre-decrement operator + a_it = a.end (); + --a_it; + FAIL_RETURN_IF (a_it == a.end ()); + FAIL_RETURN_IF ((a.end () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem3); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.begin (); + FAIL_RETURN_IF (a_it[0] != a[0]); + a_it += 2; + FAIL_RETURN_IF (a_it[0] != a[2]); + + // test operator[] write + // NOTE: This now changes the sequence a. + // NOTE: This does not work for const_iterators + // a_it[0] = elem0; + // FAIL_RETURN_IF (a[2] != elem0); + + // reset content of sequence a + //a[2] = elem2; + + // test for loop behaviour + v_sequence b = a; + ITERATOR_T b_it = b.begin (); + + for (a_it = a.begin (); + a_it != a.end (); + a_it++, b_it++) + { + FAIL_RETURN_IF (*a_it != *b_it); + } + + v_sequence test; + test.length (4); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + ITERATOR_T copytest_iter = test.begin (); + for (ITERATOR_T copya_iter = a.begin (); + copya_iter != a.end (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (*copya_iter != *copytest_iter); + } + + /// Testing - using ostream_iterator + + std::ostringstream ostream; + std::copy (a.begin (), + a.end (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<v_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("0\n1\n2\n3\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_sequence_reverse () +{ + v_sequence a; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test for correct behaviour for empty sequence + + FAIL_RETURN_IF (a.begin() != a.end ()); + + // setup of an example sequence + a.length (4); + + int elem0 = 0; + int elem1 = 1; + int elem2 = 2; + int elem3 = 3; + + a[0] = elem0; + a[1] = elem1; + a[2] = elem2; + a[3] = elem3; + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //int value0 = *a_it; + //FAIL_RETURN_IF (value0 != elem3); + + // test const dereferencing + int value1 = *a_it; + FAIL_RETURN_IF (value1 != elem3); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (*a_it != elem2); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it[0] != a[3]); + a_it += 2; + FAIL_RETURN_IF (a_it[0] != a[1]); + + // test operator[] write + // NOTE: This now changes the sequence a. + // this is not possible for const iterators + // a_it[0] = elem0; + // FAIL_RETURN_IF (a[1] != elem0); + + // reset content of sequence a + //a[1] = elem1; + + // test for loop behaviour + v_sequence b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (*a_it != *b_it); + } + + v_sequence test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (*copya_iter != *copytest_iter); + } + + /// Testing - using ostream_iterator + + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<v_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("3\n2\n1\n0\n") != 0); + + return 0; +} + +//----------------------------------------------------------------------------- + +template <typename REVERSE_ITERATOR_T> +int test_const_sequence_reverse () +{ + // setup of an example sequence + v_sequence setup; + setup.length (4); + + int elem0 = 0; + int elem1 = 1; + int elem2 = 2; + int elem3 = 3; + + setup[0] = elem0; + setup[1] = elem1; + setup[2] = elem2; + setup[3] = elem3; + + const v_sequence a = setup; + + // test equality operator + FAIL_RETURN_IF (!(a.begin () == a.begin ())); + + // test non-equality operator + FAIL_RETURN_IF (a.end () != a.end ()); + + // test iterator copy constructor + REVERSE_ITERATOR_T a_it (a.rbegin ()); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test assignment operator + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it != a.rbegin ()); + + // test non const dereferencing + // JWH2 - I don't think this test makes sense. I believe the compiler + // will always return a const value since the dereference is on + // the right hand side of the assignment (i.e., r value). + //int value0 = *a_it; + //FAIL_RETURN_IF (value0 != elem3); + + // test const dereferencing + int value1 = *a_it; + FAIL_RETURN_IF (value1 != elem3); + + // test increment operation + a_it++; + FAIL_RETURN_IF (a_it == a.rbegin()); + FAIL_RETURN_IF (*a_it != elem2); + + // test < operator + FAIL_RETURN_IF (!(a.rbegin () < a_it)); + FAIL_RETURN_IF (a_it < a.rbegin ()); + + // test difference type + int a_diff = a_it - a.rbegin (); + FAIL_RETURN_IF (a_diff != 1); + + // test copy constructor + REVERSE_ITERATOR_T a_it1 (a_it); + FAIL_RETURN_IF (a_it1 != a_it); + + // test preincrement operator + ++a_it1; + FAIL_RETURN_IF ((a_it1 - a_it) != 1); + + // test = and += operator + REVERSE_ITERATOR_T a_it2 = a_it += 3; + FAIL_RETURN_IF (a_it2 != a_it); + FAIL_RETURN_IF ((a_it - a_it1) != 2); + + // test + operator + a_it2 = a_it1 + 3; + FAIL_RETURN_IF ((a_it2 - a_it1) != 3); + + // test post-decrement operation + a_it = a.rend (); + a_it--; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem0); + + // test pre-decrement operator + a_it = a.rend (); + --a_it; + FAIL_RETURN_IF (a_it == a.rend ()); + FAIL_RETURN_IF ((a.rend () - a_it) != 1); + FAIL_RETURN_IF (*a_it != elem0); + + // test -= operator + a_it -= 3; + FAIL_RETURN_IF ((a_it1 - a_it) != 2); + + // test - operator + a_it2 = a_it1 - 2; + FAIL_RETURN_IF ((a_it1 - a_it2) != 2); + + // test operator[] read + a_it = a.rbegin (); + FAIL_RETURN_IF (a_it[0] != a[3]); + a_it += 2; + FAIL_RETURN_IF (a_it[0] != a[1]); + + // test operator[] write + // NOTE: This now changes the sequence a. + // this is not possible for const iterators + // a_it[0] = elem0; + // FAIL_RETURN_IF (a[1] != elem0); + + // reset content of sequence a + //a[1] = elem1; + + // test for loop behaviour + v_sequence b = a; + REVERSE_ITERATOR_T b_it = b.rbegin (); + + for (a_it = a.rbegin (); + a_it != a.rend (); + a_it++, b_it++) + { + FAIL_RETURN_IF (*a_it != *b_it); + } + + v_sequence test; + test.length (a.length ()); + + std::copy (a.begin (), + a.end (), + test.begin ()); + + FAIL_RETURN_IF (test.length () != a.length ()); + + REVERSE_ITERATOR_T copytest_iter = test.rbegin (); + for (REVERSE_ITERATOR_T copya_iter = a.rbegin (); + copya_iter != a.rend (); + ++copya_iter, ++copytest_iter) + { + FAIL_RETURN_IF (*copya_iter != *copytest_iter); + } + + /// Testing - using ostream_iterator + + std::ostringstream ostream; + std::copy (a.rbegin (), + a.rend (), + // JWH2 - I changed value_type to const_value_type. Is that + // the correct approach? + std::ostream_iterator<v_sequence::const_value_type> (ostream, + "\n")); + + FAIL_RETURN_IF ( + ostream.str ().compare ("3\n2\n1\n0\n") != 0); + + return 0; +} + +#endif + +//----------------------------------------------------------------------------- + +int ACE_TMAIN(int,ACE_TCHAR*[]) +{ + int status = 0; + +#if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1 + + // Test Generic_Sequence_Iterator. + status += test_sequence<v_sequence::iterator> (); + + // g++ seems to make the conversion from iterator to const_iterator + // and Windows doesn't. Not sure why. + // Test Const_Generic_Sequence_Iterator with non-const sequence. + status += test_sequence<v_sequence::const_iterator> (); + + // Test Const_Generic_Sequence_Iterator with const sequence. + status += test_const_sequence<v_sequence::const_iterator> (); + + // Test Generic_Sequence_Reverse_Iterator. + status += test_sequence_reverse<v_sequence::reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with non-const sequence. + status += test_sequence_reverse<v_sequence::const_reverse_iterator> (); + + // Test Const_Generic_Sequence_Reverse_Iterator with const sequence. + status += test_const_sequence_reverse<v_sequence::const_reverse_iterator> (); +#endif + + return status; +} diff --git a/TAO/tests/Sequence_Iterators/mock_reference.cpp b/TAO/tests/Sequence_Iterators/mock_reference.cpp new file mode 100644 index 00000000000..a1115c0f094 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/mock_reference.cpp @@ -0,0 +1,90 @@ +/** + * @file + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@atdesk.com> + */ +#include "mock_reference.hpp" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +mock_reference:: +~mock_reference() +{ +} + +mock_reference * mock_reference:: +allocate(int id) +{ + return new mock_reference(id); +} + +mock_reference * mock_reference:: +_nil() +{ + return 0; +} + +mock_reference * mock_reference:: +_duplicate(mock_reference * rhs) +{ + if (rhs == 0) + { + return 0; + } + return new mock_reference(*rhs); +} + +void mock_reference:: +_tao_release(mock_reference * rhs) +{ + delete rhs; +} + +void CORBA::release(mock_reference * r) +{ + mock_reference::_tao_release(r); +} + +mock_reference * +TAO::Objref_Traits<mock_reference>::duplicate ( + mock_reference_ptr p + ) +{ + return mock_reference::_duplicate (p); +} + +void +TAO::Objref_Traits<mock_reference>::release ( + mock_reference_ptr p + ) +{ + CORBA::release (p); +} + +mock_reference_ptr +TAO::Objref_Traits<mock_reference>::nil (void) +{ + return mock_reference::_nil (); +} + +CORBA::Boolean +TAO::Objref_Traits<mock_reference>::marshal ( + const mock_reference_ptr, + TAO_OutputCDR & + ) +{ + return true; +} + +CORBA::Boolean operator<< (TAO_OutputCDR &, const mock_reference *) +{ + return true; +} +CORBA::Boolean operator>> (TAO_InputCDR &, mock_reference *&) +{ + return true; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tests/Sequence_Iterators/mock_reference.hpp b/TAO/tests/Sequence_Iterators/mock_reference.hpp new file mode 100644 index 00000000000..ecac1eb6eb1 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/mock_reference.hpp @@ -0,0 +1,102 @@ +#ifndef guard_mock_reference_hpp +#define guard_mock_reference_hpp +/** + * @file + * + * @brief Mock an object reference so we can test the sequences in + * isolation. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "ace/config-all.h" + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL +// Forward declare the class a CORBA::release function for it. That +// avoids having to introduce CORBA::Object into the tests. +// Ideally the T_var and T_out types should accept mock objects +// too, but that is too much to bite in the current iteration. +class mock_reference; +namespace CORBA +{ +void release(mock_reference*); +} + +class mock_stream; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include "tao/Objref_VarOut_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +typedef mock_reference *mock_reference_ptr; +typedef TAO_Objref_Var_T<mock_reference> mock_reference_var; +typedef TAO_Objref_Out_T<mock_reference> mock_reference_out; + +/** + * @class mock_reference + * + * @brief Implement a concrete class with the right interface for an + * object reference. + */ +class mock_reference +{ +public: + virtual ~mock_reference(); + + typedef mock_reference_var _var_type; + typedef mock_reference_out _out_type; + + static mock_reference * allocate(int id); + static mock_reference * _nil(); + + static mock_reference * _duplicate(mock_reference * rhs); + static void _tao_release(mock_reference * rhs); + + inline bool operator==(mock_reference const & rhs) const + { + return id_ == rhs.id_; + } + + inline bool operator!=(mock_reference const & rhs) const + { + return !(*this == rhs); + } + + inline int id() const + { + return id_; + } + +private: + mock_reference (); + + inline mock_reference(int id) + : id_(id) + {} + +private: + int id_; +}; + +CORBA::Boolean operator<< (TAO_OutputCDR &, const mock_reference *); +CORBA::Boolean operator>> (TAO_InputCDR &, mock_reference *&); + +namespace TAO +{ + template<> + struct Objref_Traits< mock_reference> + { + static mock_reference_ptr duplicate (mock_reference_ptr); + static void release (mock_reference_ptr); + static mock_reference_ptr nil (void); + static CORBA::Boolean marshal (const mock_reference_ptr p, TAO_OutputCDR & cdr); + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL +#endif // guard_mock_reference_hpp diff --git a/TAO/tests/Sequence_Iterators/run_test.pl b/TAO/tests/Sequence_Iterators/run_test.pl new file mode 100755 index 00000000000..8adb8be1389 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/run_test.pl @@ -0,0 +1,46 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +use strict; + +my $final_result = 0; + +my @testsToRun = qw( + StringSeq + Bounded_String + Unbounded_Value + Unbounded_Objectref + ); + +foreach my $process (@testsToRun) { + + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + my $P = $server->CreateProcess ($process); + print "Running $process ...\n"; + my $result = $P->Spawn; + if ($result != 0) { + print "FAILED $process\n"; + $final_result = 1; + next; + } + $result = $P->WaitKill($server->ProcessStartWaitInterval()); + if ($result != 0) { + print "FAILED $process\n"; + $final_result = 1; + next; + } + print "SUCCESS\n"; +} + +exit $final_result; + + + + + diff --git a/TAO/tests/Sequence_Iterators/testing_counters.hpp b/TAO/tests/Sequence_Iterators/testing_counters.hpp new file mode 100644 index 00000000000..3c8d6e5b7ec --- /dev/null +++ b/TAO/tests/Sequence_Iterators/testing_counters.hpp @@ -0,0 +1,106 @@ +#ifndef guard_testing_counters_hpp +#define guard_testing_counters_hpp +/** + * @file + * + * @brief Some unit tests need to count how many times a function is + * called. Here we implement some simple helper classes for that + * purpose. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "testing_exception.hpp" + +#include <boost/utility.hpp> + +#include <iostream> + +/** + * @brief Used to count how many times a function gets called. The + * unit test should create one instance per function. + */ +class call_counter +{ +public: + inline call_counter() + : count_(0) + , failure_countdown_(0) + {} + + inline long current_count() const + { + return count_; + } + + inline void failure_countdown(long countdown) + { + failure_countdown_ = countdown; + } + + inline void operator()() + { + ++count_; + if (--failure_countdown_ == 0) + { + throw testing_exception(); + } + } + +private: + long count_; + long failure_countdown_; +}; + +/** + * @brief Used to detect if a testing_counter is "called" the right + * number of times. + */ +class expected_calls + : private boost::noncopyable +{ +public: + inline expected_calls(call_counter const & counter) + : current_count_(counter.current_count()) + , previous_count_(counter.current_count()) + , counter_(counter) + { } + + inline bool expect(long n) + { + reset(); + return (previous_count_ + n == current_count_); + } + + inline void reset() + { + previous_count_ = current_count_; + current_count_ = counter_.current_count(); + } + + inline long current_count() const + { + return current_count_; + } + + inline long previous_count() const + { + return previous_count_; + } + +private: + long current_count_; + long previous_count_; + call_counter const & counter_; +}; + +inline std::ostream & operator<<(std::ostream & os, expected_calls const & x) +{ + return os << "current=" << x.current_count() + << ",previous=" << x.previous_count(); + +} + +#endif // guard_testing_counters_hpp diff --git a/TAO/tests/Sequence_Iterators/testing_exception.hpp b/TAO/tests/Sequence_Iterators/testing_exception.hpp new file mode 100644 index 00000000000..2fc4c540197 --- /dev/null +++ b/TAO/tests/Sequence_Iterators/testing_exception.hpp @@ -0,0 +1,15 @@ +#ifndef guard_testing_exception_hpp +#define guard_testing_exception_hpp +/** + * @file + * + * @brief Simple exception to raise in the tests. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +struct testing_exception {}; + +#endif // guard_testing_exception_hpp diff --git a/TAO/tests/Sequence_Unit_Tests/Makefile.am b/TAO/tests/Sequence_Unit_Tests/Makefile.am index fe4accdd028..c5ed091dd25 100644 --- a/TAO/tests/Sequence_Unit_Tests/Makefile.am +++ b/TAO/tests/Sequence_Unit_Tests/Makefile.am @@ -411,9 +411,9 @@ endif BUILD_BOOST if BUILD_BOOST if BUILD_EXCEPTIONS -noinst_PROGRAMS += unbounded_octet_sequence_no_copy_ut +noinst_PROGRAMS += unbounded_octet_sequence_nocopy_ut -unbounded_octet_sequence_no_copy_ut_CPPFLAGS = \ +unbounded_octet_sequence_nocopy_ut_CPPFLAGS = \ -I$(ACE_ROOT) \ -I$(ACE_BUILDDIR) \ -I$(TAO_ROOT) \ @@ -421,15 +421,15 @@ unbounded_octet_sequence_no_copy_ut_CPPFLAGS = \ -I$(BOOST_ROOT)/include/$(BOOST_VERSION) \ -I$(BOOST_ROOT)/. -unbounded_octet_sequence_no_copy_ut_SOURCES = \ +unbounded_octet_sequence_nocopy_ut_SOURCES = \ mock_reference.cpp \ unbounded_octet_sequence_nocopy_ut.cpp \ mock_reference.hpp -unbounded_octet_sequence_no_copy_ut_LDFLAGS = \ +unbounded_octet_sequence_nocopy_ut_LDFLAGS = \ -L$(BOOST_ROOT)/lib -unbounded_octet_sequence_no_copy_ut_LDADD = \ +unbounded_octet_sequence_nocopy_ut_LDADD = \ $(TAO_BUILDDIR)/tao/libTAO.la \ $(ACE_BUILDDIR)/ace/libACE.la \ -l$(BOOST_STATIC_LIB_PREFIX)boost_unit_test_framework$(BOOST_CFG) diff --git a/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc b/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc index 4c71d40e683..6e76ff7bee5 100644 --- a/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc +++ b/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc @@ -31,7 +31,7 @@ project(*Bounded_String) : taoexe { } } -project(*UB_Arr_Seq): taoexe, boost_unit_test_framework { +project(*UB_Arr_Seq): taoexe { // Temporarily disabled this test, need to change the mock_array a lot requires += dummy_label exename = unbounded_array_sequence_ut @@ -41,7 +41,7 @@ project(*UB_Arr_Seq): taoexe, boost_unit_test_framework { } } -project(*Obj_Ref_Seq_Elem): taoexe, boost_unit_test_framework { +project(*Obj_Ref_Seq_Elem): taoexe { exename = object_reference_sequence_element_ut Source_Files { mock_reference.cpp @@ -49,7 +49,7 @@ project(*Obj_Ref_Seq_Elem): taoexe, boost_unit_test_framework { } } -project(*UB_Obj_Ref_Seq): taoexe, boost_unit_test_framework { +project(*UB_Obj_Ref_Seq): taoexe { exename = unbounded_object_reference_sequence_ut Source_Files { mock_reference.cpp @@ -57,7 +57,7 @@ project(*UB_Obj_Ref_Seq): taoexe, boost_unit_test_framework { } } -project(*UB_Sequence_CDR): taoexe, boost_unit_test_framework { +project(*UB_Sequence_CDR): taoexe { exename = unbounded_sequence_cdr_ut Source_Files { mock_reference.cpp @@ -65,7 +65,7 @@ project(*UB_Sequence_CDR): taoexe, boost_unit_test_framework { } } -project(*B_Sequence_CDR): taoexe, boost_unit_test_framework { +project(*B_Sequence_CDR): taoexe { exename = bounded_sequence_cdr_ut Source_Files { mock_reference.cpp @@ -73,7 +73,7 @@ project(*B_Sequence_CDR): taoexe, boost_unit_test_framework { } } -project(*UB_Fwd_Ob_Ref_Seq): taoexe, boost_unit_test_framework { +project(*UB_Fwd_Ob_Ref_Seq): taoexe { exename = unbounded_fwd_object_reference_sequence_ut Source_Files { fwd_mock_reference.cpp @@ -81,7 +81,7 @@ project(*UB_Fwd_Ob_Ref_Seq): taoexe, boost_unit_test_framework { } } -project(*UB_Octet_Sequence): taoexe, boost_unit_test_framework { +project(*UB_Octet_Sequence): taoexe { exename = unbounded_octet_sequence_ut Source_Files { mock_reference.cpp @@ -89,15 +89,15 @@ project(*UB_Octet_Sequence): taoexe, boost_unit_test_framework { } } -project(*UB_Oct_Seq_No_Cpy): taoexe, boost_unit_test_framework { - exename = unbounded_octet_sequence_no_copy_ut +project(*UB_Oct_Seq_No_Cpy): taoexe { + exename = unbounded_octet_sequence_nocopy_ut Source_Files { mock_reference.cpp unbounded_octet_sequence_nocopy_ut.cpp } } -project(*B_Obj_Ref_Seq): taoexe, boost_unit_test_framework { +project(*B_Obj_Ref_Seq): taoexe { exename = bounded_object_reference_sequence_ut Source_Files { mock_reference.cpp @@ -105,42 +105,42 @@ project(*B_Obj_Ref_Seq): taoexe, boost_unit_test_framework { } } -project(*String_Seq_Elem): taoexe, boost_unit_test_framework { +project(*String_Seq_Elem): taoexe { exename = string_sequence_element_ut Source_Files { string_sequence_element_ut.cpp } } -project(*UB_String_Seq): taoexe, boost_unit_test_framework { +project(*UB_String_Seq): taoexe { exename = unbounded_string_sequence_ut Source_Files { unbounded_string_sequence_ut.cpp } } -project(*B_String_Seq): taoexe, boost_unit_test_framework { +project(*B_String_Seq): taoexe { exename = bounded_string_sequence_ut Source_Files { bounded_string_sequence_ut.cpp } } -project(*Test_Alloc_Traits): taoexe, boost_unit_test_framework { +project(*Test_Alloc_Traits): taoexe { exename = testing_allocation_traits_ut Source_Files { testing_allocation_traits_ut.cpp } } -project(*UB_Value_Sequence): taoexe, boost_unit_test_framework { +project(*UB_Value_Sequence): taoexe { exename = unbounded_value_sequence_ut Source_Files { unbounded_value_sequence_ut.cpp } } -project(*B_Value_Sequence): taoexe, boost_unit_test_framework { +project(*B_Value_Sequence): taoexe { exename = bounded_value_sequence_ut Source_Files { bounded_value_sequence_ut.cpp diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp index 21a8fb14451..c5fd630ab97 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp @@ -16,11 +16,9 @@ #include "tao/Bounded_Object_Reference_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const TMAX = 64; @@ -35,7 +33,7 @@ struct Tester typedef tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -43,16 +41,17 @@ struct Tester { tested_sequence x; - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(false, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_buffer_constructor_release_true() + int test_buffer_constructor_release_true() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -63,17 +62,20 @@ struct Tester a.reset(); tested_sequence x(maximum / 2, data, true); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), true); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), true); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // 64 is here because this is a bounded sequence and spec requires + // that maximum() elements are allocated for them by allocbuf. + FAIL_RETURN_IF_NOT(i.expect(64), i); + return 0; } - void test_buffer_constructor_release_false() + int test_buffer_constructor_release_false() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -85,23 +87,25 @@ struct Tester { tested_sequence x(maximum / 2, data, false); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), false); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), false); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + // Same as above. allocbuf default initializes maximum() elements. + FAIL_RETURN_IF_NOT(i.expect(64), i); tested_sequence::freebuf(data); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -111,30 +115,33 @@ struct Tester tested_sequence y(x); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor() + int test_copy_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); expected_calls f(tested_allocation_traits::freebuf_calls); - expected_calls i(tested_element_traits::default_initializer_calls); + expected_calls di(tested_element_traits::default_initializer_calls); expected_calls d(mock_reference::duplicate_calls); expected_calls r(mock_reference::release_calls); CORBA::ULong const l = 16; { tested_sequence x; - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(a.expect(0), a); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + // length() allocates a buffer of size maximum() and + // default initializes it. + FAIL_RETURN_IF_NOT(di.expect(TMAX), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -143,23 +150,24 @@ struct Tester d.reset(); r.reset(); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); - BOOST_CHECK_MESSAGE(d.expect(l), d); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, y.length()); + FAIL_RETURN_IF_NOT(d.expect(l), d); + FAIL_RETURN_IF_NOT(di.expect(TMAX - l), d); for(CORBA::ULong i = 0; i != l; ++i) { - BOOST_CHECK_EQUAL(int(i), y[i]->id()); + CHECK_EQUAL(int(i), y[i]->id()); } } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(2*TMAX), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(2*TMAX), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_copy_constructor_throw_duplicate() + int test_copy_constructor_throw_duplicate() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -170,38 +178,42 @@ struct Tester CORBA::ULong const l = 16; { tested_sequence x; - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(a.expect(0), a); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); - - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); - for(CORBA::ULong i = 0; i != l; ++i) + // length() allocates a buffer of size maximum() and + // default initializes it. + FAIL_RETURN_IF_NOT(i.expect(TMAX), i); + FAIL_RETURN_IF_NOT(a.expect(1), i); + + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); + for(CORBA::ULong inc = 0; inc != l; ++inc) { - x[i] = mock_reference::allocate(i); + x[inc] = mock_reference::allocate(inc); } d.reset(); r.reset(); mock_reference::duplicate_calls.failure_countdown(8); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(da.expect(0), da); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(8), d); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(da.expect(0), da); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(8), d); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // There are TMAX-16 default initializer calls. + FAIL_RETURN_IF_NOT(i.expect(48), i); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -211,18 +223,21 @@ struct Tester tested_sequence x; x.length(8); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + // length() allocates a buffer of size maximum() and + // default initializes it. + FAIL_RETURN_IF_NOT(i.expect(TMAX), i); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -230,26 +245,29 @@ struct Tester expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(a.expect(0), a); x.length(16); - BOOST_CHECK_MESSAGE(i.expect(16), i); - - BOOST_CHECK_THROW(x.length(2 * TMAX), std::runtime_error); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); - - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + // length() allocates a buffer of size maximum() and + // default initializes it. + FAIL_RETURN_IF_NOT(i.expect(TMAX), i); + + CHECK_THROW(x.length(2 * TMAX), std::runtime_error); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(CORBA::ULong(16), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } value_type * alloc_and_init_buffer() { - value_type * buf = tested_sequence::allocbuf(TMAX); + value_type * buf = tested_sequence::allocbuf(); buf[0] = mock_reference::allocate(1); buf[1] = mock_reference::allocate(4); buf[2] = mock_reference::allocate(9); @@ -258,15 +276,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_replace_release_true() + int test_replace_release_true() { value_type * buffer = alloc_and_init_buffer(); @@ -275,24 +294,26 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a; - a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - - BOOST_CHECK_EQUAL(TMAX, a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + a.replace(4, buffer, true); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(TMAX, a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Since we've given away the ownership the buffer is deallocated by + // the sequence. + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + return 0; } - void test_replace_release_false() + int test_replace_release_false() { value_type * buffer = alloc_and_init_buffer(); @@ -302,23 +323,24 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - - BOOST_CHECK_EQUAL(TMAX, a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(TMAX, a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + return 0; } - void test_replace_release_default() + int test_replace_release_default() { value_type * buffer = alloc_and_init_buffer(); @@ -328,83 +350,40 @@ struct Tester { tested_sequence a; a.replace(4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - - BOOST_CHECK_EQUAL(TMAX, a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(TMAX, a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + return 0; } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_throw_duplicate, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_default, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); - - return ts; + int status = 0; + Tester mytester; + + status += mytester.test_default_constructor(); + status += mytester.test_buffer_constructor_release_true(); + status += mytester.test_buffer_constructor_release_false(); + status += mytester.test_copy_constructor_from_default(); + status += mytester.test_copy_constructor(); + status += mytester.test_copy_constructor_throw_duplicate(); + status += mytester.test_set_length_less_than_maximum(); + status += mytester.test_set_length_more_than_maximum(); + status += mytester.test_replace_release_true(); + status += mytester.test_replace_release_false(); + status += mytester.test_replace_release_default(); + + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp index 85f112d7dc7..7ebdad108ea 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp @@ -23,11 +23,9 @@ #include "tao/Bounded_Sequence_CDR_T.h" #include "tao/CDR.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const TMAX = 64; @@ -55,7 +53,7 @@ struct Tester value_type * alloc_and_init_buffer() { - value_type * buf = tested_sequence::allocbuf(8); + value_type * buf = tested_sequence::allocbuf(); buf[0] = mock_reference::allocate(1); buf[1] = mock_reference::allocate(4); buf[2] = mock_reference::allocate(9); @@ -64,15 +62,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_stream() + int test_stream() { value_type * buffer = alloc_and_init_buffer(); @@ -81,50 +80,28 @@ struct Tester tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(64), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(64), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); TAO_OutputCDR stream; stream << a; - BOOST_CHECK_MESSAGE(s.expect(4), s); + FAIL_RETURN_IF_NOT(s.expect(4), s); } tested_sequence::freebuf(buffer); + return 0; } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_stream, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); + int status = 0; + Tester mytester; - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + status += mytester.test_stream(); - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp index 4cf5ea06a96..372baf585c9 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp @@ -21,13 +21,9 @@ #include "ace/OS_NS_string.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" -#include <sstream> -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const MAXIMUM = 32; @@ -44,7 +40,7 @@ struct Tester typedef typename tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -53,67 +49,80 @@ struct Tester tested_sequence x; x.length(8); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); - - BOOST_CHECK_MESSAGE(i.expect(8), i); + // length() after default constructed sequence leads to + // buffer allocation. + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); + + // 32 is here because allocbuf for bounded sequences + // initializes all elements. + FAIL_RETURN_IF_NOT(i.expect(32), i); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { tested_sequence x; - BOOST_CHECK_THROW(x.length(64), std::runtime_error); + CHECK_THROW(x.length(64), std::runtime_error); + return 0; } value_type * alloc_and_init_buffer() { value_type * buf = tested_sequence::allocbuf(); + delete[] buf[0]; buf[0] = helper::to_string(1); + delete[] buf[1]; buf[1] = helper::to_string(4); + delete[] buf[2]; buf[2] = helper::to_string(9); + delete[] buf[3]; buf[3] = helper::to_string(16); return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK(helper::compare(1, a[0])); - BOOST_CHECK(helper::compare(4, a[1])); - BOOST_CHECK(helper::compare(9, a[2])); - BOOST_CHECK(helper::compare(16, a[3])); + CHECK(helper::compare(1, a[0])); + CHECK(helper::compare(4, a[1])); + CHECK(helper::compare(9, a[2])); + CHECK(helper::compare(16, a[3])); + return 0; } - void test_regression_2201() + int test_regression_2201() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls r(tested_element_traits::release_calls); { - tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); - a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); - a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK(helper::compare_empty(a[3])); + tested_sequence x(4, buffer, true); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK_EQUAL(buffer, x.get_buffer()); + CHECK_EQUAL(true, x.release()); + x.length (3); + CHECK_EQUAL(CORBA::ULong(3), x.length()); + x.length (4); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK(helper::compare_empty(x[3])); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // 1 additional release call happens when we shrink + // the sequence to length 3. + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM + 1), r); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -121,19 +130,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -141,19 +151,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -161,18 +172,19 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -182,23 +194,26 @@ struct Tester { tested_sequence a; a.replace(4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer + // thus nothing to release and free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); @@ -208,23 +223,25 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); @@ -233,46 +250,52 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a; - a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + a.replace(4, buffer, true); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Since we've given away the ownership the buffer is deallocated by + // the sequence. + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -280,112 +303,71 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), b.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), b.maximum()); + CHECK_EQUAL(CORBA::ULong(0), b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(0), c); + // Ownership was taken by get_buffer(true) and later get_buffer call + // allocated a new buffer. + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - BOOST_CHECK_MESSAGE(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(c.expect(0), c); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - } - - void add_all(test_suite * ts) - { - typedef string_sequence_tester<tested_sequence> common; - boost::shared_ptr<common> tester(common::allocate(true)); - tester->add_all(ts); - - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - static boost::shared_ptr<Tester> allocate() + int test_all () { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; + int status = 0; - return ptr; + typedef string_sequence_tester<tested_sequence> common; + common X; + status += X.test_all (); + + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_regression_2201(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_default(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("bounded string sequence unit test"); + int status = 0; - { - typedef TAO::bounded_basic_string_sequence<char, MAXIMUM> s_sequence; - typedef Tester<s_sequence> nTester; - boost::shared_ptr<nTester> tester(nTester::allocate()); - tester->add_all(ts); - } + typedef TAO::bounded_basic_string_sequence<char, MAXIMUM> s_sequence; + typedef Tester<s_sequence> nTester; + nTester myntester; - { - typedef TAO::bounded_basic_string_sequence<CORBA::WChar, MAXIMUM> w_sequence; - typedef Tester<w_sequence> wTester; - boost::shared_ptr<wTester> tester(wTester::allocate()); - tester->add_all(ts); - } + status += myntester.test_all(); + +#if defined(ACE_HAS_WCHAR) + typedef TAO::bounded_basic_string_sequence<CORBA::WChar, MAXIMUM> w_sequence; + typedef Tester<w_sequence> wTester; + wTester mywtester; + status += mywtester.test_all(); +#endif - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp index 4ed1a2d2041..1a34645b8a6 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp @@ -15,11 +15,9 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const MAXIMUM = 32; @@ -33,7 +31,7 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -41,19 +39,22 @@ struct Tester tested_sequence x; x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + // Naturally buffer in x is allocated after length() was called. + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { tested_sequence x; - BOOST_CHECK_THROW(x.length(64), std::runtime_error); + CHECK_THROW(x.length(64), std::runtime_error); + return 0; } value_type * alloc_and_init_buffer() @@ -64,36 +65,36 @@ struct Tester return buf; } - void test_regression_2201 () + int test_regression_2201 () { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { - tested_sequence a(32, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); - a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); - a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(int( 0), a[3]); + tested_sequence x(32, buffer, true); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(buffer, x.get_buffer()); + CHECK_EQUAL(int( 1), x[0]); + CHECK_EQUAL(int( 4), x[1]); + CHECK_EQUAL(int( 9), x[2]); + CHECK_EQUAL(int(16), x[3]); + CHECK_EQUAL(true, x.release()); + x.length (3); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(3), x.length()); + x.length (4); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK_EQUAL(int( 0), x[3]); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -101,62 +102,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -165,24 +169,26 @@ struct Tester { tested_sequence a; a.replace(4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -191,24 +197,26 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -217,144 +225,107 @@ struct Tester { tested_sequence a; a.replace(4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::default_buffer_allocation_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(MAXIMUM, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(MAXIMUM, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), c); tested_sequence::freebuf(buffer); + return 0; } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - + int status = 0; + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_regression_2201(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded value sequence unit test"); - + int status = 0; { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + Tester tester; + status += tester.test_all (); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate(true)); - tester->add_all(ts); + common tester; + status += tester.test_all (); } - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp b/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp index 20cfafac6ea..6115f4e13b9 100644 --- a/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp @@ -11,27 +11,16 @@ #include "testing_object_reference_traits.hpp" #include "mock_reference.hpp" #include "tao/Object_Reference_Sequence_Element_T.h" - -#include <sstream> -#include <stdexcept> -#include <iostream> - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO::details; -using namespace boost::unit_test_framework; - -struct Tester -{ typedef object_reference_traits<mock_reference,mock_reference_var,true> tested_element_traits; typedef object_reference_sequence_element<tested_element_traits> tested_element; typedef mock_reference * reference_type; typedef tested_element_traits::object_type_var reference_var; - void test_assignment_from_var_release_true() + int test_assignment_from_var_release_true() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -42,30 +31,32 @@ struct Tester tested_element x(xe, true); reference_var y(mock_reference::allocate(2)); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(x); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0),d ); + FAIL_RETURN_IF_NOT(r.expect(0),r ); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); + + return 0; } - void test_assignment_from_var_release_false() + int test_assignment_from_var_release_false() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -77,31 +68,32 @@ struct Tester tested_element x(xe, false); reference_var y(mock_reference::allocate(2)); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d ); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(x); tested_element_traits::release(oldxe); - BOOST_CHECK_MESSAGE(r.expect(2), r); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(r.expect(2), r); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0),d ); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); + return 0; } - void test_assignment_from_var_throw() + int test_assignment_from_var_throw() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -112,33 +104,34 @@ struct Tester tested_element x(xe, true); reference_var y(mock_reference::allocate(2)); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); mock_reference::duplicate_calls.failure_countdown(1); - BOOST_CHECK_THROW(x = y, testing_exception); + CHECK_THROW(x = y, testing_exception); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); - BOOST_CHECK_EQUAL(1, x->id()); - BOOST_CHECK_EQUAL(2, y->id()); + CHECK_EQUAL(1, x->id()); + CHECK_EQUAL(2, y->id()); tested_element_traits::release(x); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); + return 0; } - void test_assignment_from_element_release_true() + int test_assignment_from_element_release_true() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -151,31 +144,32 @@ struct Tester reference_type ye = mock_reference::allocate(2); tested_element y(ye, true); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0) ,r); x = y; - BOOST_CHECK_MESSAGE(d.expect(1), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(d.expect(1), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); tested_element_traits::release(ye); - BOOST_CHECK_MESSAGE(r.expect(2), r); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(r.expect(2),r ); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - void test_assignment_from_element_release_false() + int test_assignment_from_element_release_false() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -189,32 +183,33 @@ struct Tester reference_type ye = mock_reference::allocate(2); tested_element y(ye, true); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(1), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(1), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); tested_element_traits::release(oldxe); tested_element_traits::release(ye); - BOOST_CHECK_MESSAGE(r.expect(3), r); - BOOST_CHECK_MESSAGE(mr.expect(3), mr); + FAIL_RETURN_IF_NOT(r.expect(3), r); + FAIL_RETURN_IF_NOT(mr.expect(3), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - void test_assignment_from_reference_release_true() + int test_assignment_from_reference_release_true() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -226,30 +221,31 @@ struct Tester reference_type y = mock_reference::allocate(2); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - void test_assignment_from_reference_release_false() + int test_assignment_from_reference_release_false() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -262,81 +258,43 @@ struct Tester reference_type y = mock_reference::allocate(2); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); tested_element_traits::release(oldxe); - BOOST_CHECK_MESSAGE(r.expect(2), r); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(r.expect(2), 2); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var_throw, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_element_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_element_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_reference_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_reference_release_false, - shared_this)); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; -}; - -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("object reference sequence element unit test"); + int status = 0; - boost::shared_ptr<Tester > mock_reference_tester( - Tester::allocate()); - mock_reference_tester->add_all(ts); + status += test_assignment_from_var_release_true (); + status += test_assignment_from_var_release_false (); + status += test_assignment_from_var_throw (); + status += test_assignment_from_element_release_true (); + status += test_assignment_from_element_release_false (); + status += test_assignment_from_reference_release_true (); + status += test_assignment_from_reference_release_false (); - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/run_test.pl b/TAO/tests/Sequence_Unit_Tests/run_test.pl index 3b3ec000483..2de72fc741f 100755 --- a/TAO/tests/Sequence_Unit_Tests/run_test.pl +++ b/TAO/tests/Sequence_Unit_Tests/run_test.pl @@ -6,37 +6,24 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; use strict; -if ($ARGV[0] =~ /^-h/i || $ARGV[0] =~ /^-\?/i) { - print "Usage: run_test.pl [-boost|-noboost]\n". - "\tDefault is to run all tests, specifying -boost or -noboost will\n". - "\teither run the tests that require the boost unit test library or\n". - "\tthe other tests, respectively.\n"; - exit 0; -} - my $final_result = 0; -my @tests = qw(unbounded_value_sequence_ut - unbounded_array_sequence_ut +my @testsToRun = qw(unbounded_value_sequence_ut bounded_value_sequence_ut string_sequence_element_ut unbounded_string_sequence_ut bounded_string_sequence_ut testing_allocation_traits_ut unbounded_octet_sequence_ut - unbounded_octet_sequence_no_copy_ut object_reference_sequence_element_ut unbounded_object_reference_sequence_ut unbounded_fwd_object_reference_sequence_ut bounded_object_reference_sequence_ut bounded_sequence_cdr_ut unbounded_sequence_cdr_ut - ); - -my @testsNoBoost = qw( Unbounded_Octet Unbounded_Simple_Types Bounded_Simple_Types @@ -44,51 +31,28 @@ my @testsNoBoost = qw( Bounded_String ); -my @testsToRun = qw(); - -push(@testsToRun, @tests) if ($#ARGV < 0 || $ARGV[0] eq '-boost'); -push(@testsToRun, @testsNoBoost) if ($#ARGV < 0 || $ARGV[0] eq '-noboost'); - +if ($^O ne "MSWin32") { + push @testsToRun, qw(unbounded_octet_sequence_nocopy_ut); +} foreach my $process (@testsToRun) { - - - my $P = 0; - if (PerlACE::is_vxworks_test()) { - $P = new PerlACE::ProcessVX ($process, - '--log_level=nothing ' - .'--report_level=no'); - } - else { - $P = new PerlACE::Process ($process, - '--log_level=nothing ' - .'--report_level=no'); - } - my $executable = $P->Executable; - - # Not all the binaries are generated in all configurations. - if (PerlACE::is_vxworks_test()) { - next unless -e $executable; - } - else { - next unless -x $executable; - } - - print "Running $process ..."; - my $result = $P->Spawn; - if ($result != 0) { - print "FAILED\n"; - $final_result = 1; - next; - } - $result = $P->WaitKill($PerlACE::wait_interval_for_process_creation); - if ($result != 0) { - print "FAILED\n"; - $final_result = 1; - next; - } - print "SUCCESS\n"; + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + my $P = $server->CreateProcess ($process); + print "Running $process ...\n"; + my $result = $P->Spawn; + if ($result != 0) { + print "FAILED $process\n"; + $final_result = 1; + next; + } + $result = $P->WaitKill($server->ProcessStartWaitInterval()); + if ($result != 0) { + print "FAILED $process\n"; + $final_result = 1; + next; + } + print "SUCCESS\n"; } exit $final_result; diff --git a/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp b/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp index 3bf93b550e4..0512cc36b51 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp @@ -15,388 +15,395 @@ #include "ace/OS_NS_string.h" -#include <sstream> -#include <stdexcept> -#include <iostream> - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO::details; -using namespace boost::unit_test_framework; + template<typename charT> -struct helper {}; +struct helper +{ +}; template<> -struct helper<char> +struct helper <char> { - static char const * empty() { + static char const * + empty () + { return ""; } - static char const * sample0() { + static char const * + sample0 () + { return "Hello"; } - static char const * sample1() { + static char const * + sample1 () + { return "World"; } - static char * dup_sample0() { - return string_traits<char,true>::duplicate(sample0()); + static char * + dup_sample0 () + { + return string_traits <char, true>::duplicate (sample0 ()); } - static char * dup_sample1() { - return string_traits<char,true>::duplicate(sample1()); + static char * + dup_sample1 () + { + return string_traits <char, true>::duplicate (sample1 ()); } - static bool equal(char const * lhs, char const * rhs) { - return ACE_OS::strcmp(lhs, rhs) == 0; + static bool + equal (char const *lhs, char const *rhs) + { + return ACE_OS::strcmp (lhs, rhs) == 0; } }; +#if defined(ACE_HAS_WCHAR) template<> -struct helper<CORBA::WChar> +struct helper <CORBA::WChar> { - static CORBA::WChar const * empty() { + static CORBA::WChar const * + empty () + { return L""; } - static CORBA::WChar const * sample0() { + static CORBA::WChar const * + sample0 () + { return L"Hello"; } - static CORBA::WChar const * sample1() { + static CORBA::WChar const * + sample1 () + { return L"World"; } - static CORBA::WChar * dup_sample0() { - return string_traits<CORBA::WChar,true>::duplicate(sample0()); + static CORBA::WChar * + dup_sample0 () + { + return string_traits <CORBA::WChar, true>::duplicate (sample0 ()); } - static CORBA::WChar * dup_sample1() { - return string_traits<CORBA::WChar,true>::duplicate(sample1()); + static CORBA::WChar * + dup_sample1 () + { + return string_traits <CORBA::WChar, true>::duplicate (sample1 ()); } - static bool equal(CORBA::WChar const * lhs, CORBA::WChar const * rhs) { - return ACE_OS::strcmp(lhs, rhs) == 0; + static bool + equal (CORBA::WChar const *lhs, CORBA::WChar const *rhs) + { + return ACE_OS::strcmp (lhs, rhs) == 0; } }; +#endif template<class charT> struct Tester { - typedef string_traits<charT,true> tested_element_traits; - typedef string_sequence_element<tested_element_traits> tested_element; - typedef charT * string_type; - typedef charT const * const_string_type; + typedef string_traits <charT, true> tested_element_traits; + typedef string_sequence_element <tested_element_traits> tested_element; + typedef charT *string_type; + typedef charT const *const_string_type; typedef typename tested_element_traits::string_var string_var; typedef typename tested_element_traits::string_mgr string_mgr; - void test_assignment_from_const_string() + int + test_assignment_from_const_string () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); - const_string_type y = helper<charT>::sample1(); - d.reset(); r.reset(); + string_type xe = helper <charT>::dup_sample0 (); + const_string_type y = helper <charT>::sample1 (); + d.reset (); + r.reset (); tested_element x(xe, true); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample1(), xe), - "Mismatch after assignment from const. expected=" - << helper<charT>::sample0() - << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample1(), xe), + "Mismatch after assignment from const. expected=" + << helper<charT>::sample0() + << ", got=" << x); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_element() + int + test_assignment_from_element () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); + string_type xe = helper <charT>::dup_sample0 (); tested_element x(xe, true); - string_type ye = helper<charT>::dup_sample1(); + string_type ye = helper <charT>::dup_sample1 (); tested_element y(ye, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample1(), xe), - "Mismatch after assignment from element. expected=" - << helper<charT>::sample1() - << ", got=" << xe); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample1(), xe), + "Mismatch after assignment from element. expected=" + << helper<charT>::sample1() + << ", got=" << xe); - tested_element_traits::release(xe); - tested_element_traits::release(ye); - BOOST_CHECK_MESSAGE(r.expect(2), r); + tested_element_traits::release (xe); + tested_element_traits::release (ye); + FAIL_RETURN_IF_NOT(r.expect(2), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_self_assignment() + int + test_self_assignment () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); + string_type xe = helper <charT>::dup_sample0 (); tested_element x(xe, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); x = x; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after self assignment. expected=" - << helper<charT>::sample0() - << ", got=" << xe); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after self assignment. expected=" + << helper<charT>::sample0() + << ", got=" << xe); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_non_const_string() + int + test_assignment_from_non_const_string () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { string_type xe = 0; tested_element x(xe, true); string_type y = - tested_element_traits::duplicate(helper<charT>::sample0()); - BOOST_CHECK_MESSAGE(d.expect(1), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + tested_element_traits::duplicate (helper <charT>::sample0 ()); + FAIL_RETURN_IF_NOT(d.expect(1), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment from non-const. expected=" - << helper<charT>::sample0() - << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment from non-const. expected=" + << helper<charT>::sample0() + << ", got=" << x); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_copy_constructor() + int + test_copy_constructor () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { string_type xe = - tested_element_traits::duplicate(helper<charT>::sample0()); + tested_element_traits::duplicate (helper <charT>::sample0 ()); tested_element x(xe, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); - tested_element y(x); + tested_element y (x); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), y), - "Mismatch after copy constructor. expected=" - << helper<charT>::sample0() - << ", got=" << y); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), y), + "Mismatch after copy constructor. expected=" + << helper<charT>::sample0() + << ", got=" << y); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_copy() + int + test_assignment_from_copy () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); + string_type xe = helper <charT>::dup_sample0 (); tested_element x(xe, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); - tested_element y(x); + tested_element y (x); x = y; - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment. expected=" - << helper<charT>::sample0() - << ", got=" << xe); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment. expected=" + << helper<charT>::sample0() + << ", got=" << xe); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), y), - "Mismatch after assignment. expected=" - << helper<charT>::sample0() - << ", got=" << y); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), y), + "Mismatch after assignment. expected=" + << helper<charT>::sample0() + << ", got=" << y); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_var() + int + test_assignment_from_var () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample1(); + string_type xe = helper <charT>::dup_sample1 (); tested_element x(xe, true); - BOOST_CHECK_MESSAGE(d.expect(1), d); + FAIL_RETURN_IF_NOT(d.expect(1), d); - string_var y(helper<charT>::sample0()); + string_var y (helper <charT>::sample0()); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment from var. expected=" - << helper<charT>::sample0() - << ", got=" << x); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment from var. expected=" + << helper<charT>::sample0() + << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_mgr() + int + test_assignment_from_mgr () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample1(); + string_type xe = helper <charT>::dup_sample1 (); tested_element x(xe, true); - BOOST_CHECK_MESSAGE(d.expect(1), d); + FAIL_RETURN_IF_NOT(d.expect(1), d); string_mgr y; - y = helper<charT>::sample0(); + y = helper <charT>::sample0 (); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment from mgr. expected=" - << helper<charT>::sample0() - << ", got=" << x); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment from mgr. expected=" + << helper<charT>::sample0() + << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - - void add_all(test_suite * ts) + int + test_all () { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_const_string, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_element, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_self_assignment, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_non_const_string, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_copy, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_mgr, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_assignment_from_const_string (); + status += this->test_assignment_from_element (); + status += this->test_self_assignment (); + status += this->test_assignment_from_non_const_string (); + status += this->test_copy_constructor (); + status += this->test_assignment_from_copy (); + status += this->test_assignment_from_var (); + status += this->test_assignment_from_mgr (); + return status; } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) -{ - test_suite * ts = - BOOST_TEST_SUITE("string sequence element unit test"); - - boost::shared_ptr<Tester<char> > char_tester( - Tester<char>::allocate()); - char_tester->add_all(ts); - - boost::shared_ptr<Tester<CORBA::WChar> > wchar_tester( - Tester<CORBA::WChar>::allocate()); - wchar_tester->add_all(ts); - - return ts; -} +int ACE_TMAIN (int, ACE_TCHAR*[]) + { + int status = 0; + Tester <char> char_tester; + status += char_tester.test_all (); + Tester <char> wchar_tester; + status += wchar_tester.test_all (); + return status; + } diff --git a/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp b/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp index 2b4d3d6406f..3eba6d93cad 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp +++ b/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp @@ -13,9 +13,7 @@ #include "ace/OS_NS_string.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #include <sstream> @@ -64,6 +62,7 @@ struct string_sequence_test_helpers<char> } }; +#if defined(ACE_HAS_WCHAR) template<> struct string_sequence_test_helpers<CORBA::WChar> { @@ -103,8 +102,7 @@ struct string_sequence_test_helpers<CORBA::WChar> return ACE_OS::strcmp(value, L"") == 0; } }; - - +#endif /* ACE_HAS_WCHAR */ template<class tested_sequence> struct string_sequence_tester @@ -116,24 +114,25 @@ struct string_sequence_tester typedef typename tested_sequence::element_traits tested_element_traits; typedef typename tested_sequence::allocation_traits tested_allocation_traits; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_EQUAL( + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + // Nothing was allocated then there is nothing to free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -145,30 +144,35 @@ struct string_sequence_tester a.reset(); f.reset(); i.reset(); d.reset(); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); - BOOST_CHECK_MESSAGE(d.expect(0), d); - - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + // Default constructed sequence doesn't have elements, + // thus there is nothing to allocate/copy in copy constructor. + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + // Nothing was allocated then there is nothing to free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_index_accessor() + int test_index_accessor() { tested_sequence x; x.length(8); tested_sequence const & y = x; character_type const * t = y[4]; - BOOST_CHECK_MESSAGE(helper::compare_empty(t), + FAIL_RETURN_IF_NOT(helper::compare_empty(t), "Unexpected string value " << t); + return 0; } - void test_index_modifier() + int test_index_modifier() { tested_sequence x; x.length(8); @@ -180,16 +184,17 @@ struct string_sequence_tester character_type const * t = y[4]; - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(text, x[4]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(text, x[4]) == 0, "Mismatched values expected=" << text << ", got=" << x[4]); - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(text, y[4]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(text, y[4]) == 0, "Mismatched values expected=" << text << ", got=" << y[4]); - BOOST_CHECK(text != t); + CHECK(text != t); + return 0; } - void test_index_checking() + int test_index_checking() { tested_sequence x; x.length(8); @@ -197,11 +202,12 @@ struct string_sequence_tester tested_sequence const & y = x; character_type const * lhs = 0; character_type const * rhs = 0; - BOOST_CHECK_THROW(lhs = y[32], std::range_error); - BOOST_CHECK_THROW(x[32] = rhs, std::range_error); + CHECK_THROW(lhs = y[32], std::range_error); + CHECK_THROW(x[32] = rhs, std::range_error); + return 0; } - void test_copy_constructor_values() + int test_copy_constructor_values() { tested_sequence a; a.length(16); @@ -216,66 +222,67 @@ struct string_sequence_tester CORBA::ULong max; { tested_sequence b(a); - BOOST_CHECK_MESSAGE(d.expect(16), d); + FAIL_RETURN_IF_NOT(d.expect(16), d); max = b.maximum(); - BOOST_CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.length(), b.length()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(a[i], b[i]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(a[i], b[i]) == 0, "Mismatched elements at index=" << i << ", a=" << a[i] << ", b=" << b[i]); } } - BOOST_CHECK_MESSAGE(r.expect(max), r); + FAIL_RETURN_IF_NOT(r.expect(max), r); + return 0; } - void test_freebuf_releases_elements() + int test_freebuf_releases_elements() { value_type * buffer = tested_sequence::allocbuf(32); - for(int i = 0; i != 32; ++i) - { - buffer[i] = helper::allocate_test_string(); - } expected_calls r(tested_element_traits::release_calls); expected_calls f(tested_allocation_traits::freebuf_calls); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(32), r); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(32), r); + return 0; } - void test_assignment_from_default() + int test_assignment_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL( + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_ , x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + // Default constructed sequence doesn't have elements, + // thus there is nothing to allocate/copy in operator=. + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + // Nothing was allocated then there is nothing to free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_assignment_values() + int test_assignment_values() { tested_sequence a; a.length(16); @@ -290,24 +297,25 @@ struct string_sequence_tester { tested_sequence b; b = a; - BOOST_CHECK_MESSAGE(d.expect(16), d); + FAIL_RETURN_IF_NOT(d.expect(16), d); max = b.maximum(); - BOOST_CHECK_EQUAL(a.maximum(), b.maximum()); - BOOST_CHECK_EQUAL(a.length(), b.length()); - BOOST_CHECK_EQUAL(a.release(), b.release()); + CHECK_EQUAL(a.maximum(), b.maximum()); + CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.release(), b.release()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(a[i], b[i]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(a[i], b[i]) == 0, "Mismatched elements at index " << i); } r.reset(); } - BOOST_CHECK_MESSAGE(r.expect(max), r); + FAIL_RETURN_IF_NOT(r.expect(max), r); + return 0; } - void test_exception_in_copy_constructor() + int test_exception_in_copy_constructor() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -316,13 +324,14 @@ struct string_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_assignment() + int test_exception_in_assignment() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -333,17 +342,18 @@ struct string_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); f.reset(); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(y = x, testing_exception); + CHECK_THROW(y = x, testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(3), y.length()); + CHECK_EQUAL(CORBA::ULong(3), y.length()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_duplicate_exception_in_copy_constructor() + int test_duplicate_exception_in_copy_constructor() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -361,16 +371,17 @@ struct string_sequence_tester tested_element_traits::duplicate_calls.failure_countdown(4); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(4), d); - BOOST_CHECK_MESSAGE(r.expect(x.maximum()), r); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(4), d); + FAIL_RETURN_IF_NOT(r.expect(x.maximum()), r); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_duplicate_exception_in_assignment() + int test_duplicate_exception_in_assignment() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -393,33 +404,34 @@ struct string_sequence_tester { y[i] = helper::allocate_test_string(); } - + a.reset(); d.reset(); r.reset(); f.reset(); tested_element_traits::duplicate_calls.failure_countdown(4); - BOOST_CHECK_THROW(y = x, testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(4), d); - BOOST_CHECK_MESSAGE(r.expect(x.maximum()), r); + CHECK_THROW(y = x, testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(4), d); + FAIL_RETURN_IF_NOT(r.expect(x.maximum()), r); - BOOST_CHECK_EQUAL(CORBA::ULong(4), y.length()); + CHECK_EQUAL(CORBA::ULong(4), y.length()); for(CORBA::ULong i = 0; i != 4; ++i) { - BOOST_CHECK_MESSAGE( + FAIL_RETURN_IF_NOT( helper::compare_test_string(y[i]), "Mismatch in element " << i << ", got=" << y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_const() + int test_get_buffer_const() { tested_sequence a; a.length(8); tested_sequence const & b = a; @@ -427,79 +439,33 @@ struct string_sequence_tester const_value_type const * buffer = b.get_buffer(); a[0] = helper::test_string(); - BOOST_CHECK_EQUAL(buffer, b.get_buffer()); - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(a[0], buffer[0]) == 0, + CHECK_EQUAL(buffer, b.get_buffer()); + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(a[0], buffer[0]) == 0, "Mismatched elements a[0]=" << a[0] << ", buffer[0]=" << buffer[0]); + return 0; } - void add_all(boost::unit_test_framework::test_suite * ts) - { - boost::shared_ptr<string_sequence_tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_default_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_index_accessor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_index_modifier, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_index_checking, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_copy_constructor_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_freebuf_releases_elements, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_assignment_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_assignment_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_exception_in_assignment, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_duplicate_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_duplicate_exception_in_assignment, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_get_buffer_const, - shared_this)); - - - } - - static boost::shared_ptr<string_sequence_tester> allocate(bool bounded = false) + int test_all () { - boost::shared_ptr<string_sequence_tester> ptr( - new string_sequence_tester(bounded)); - ptr->self_ = ptr; - - return ptr; + int status=0; + status += this->test_default_constructor(); + status += this->test_copy_constructor_from_default(); + status += this->test_index_accessor(); + status += this->test_index_modifier(); + status += this->test_index_checking(); + status += this->test_copy_constructor_values(); + status += this->test_freebuf_releases_elements(); + status += this->test_assignment_from_default(); + status += this->test_assignment_values(); + status += this->test_exception_in_copy_constructor(); + status += this->test_exception_in_assignment(); + status += this->test_duplicate_exception_in_copy_constructor(); + status += this->test_duplicate_exception_in_assignment(); + status += this->test_get_buffer_const(); + + return status; } - -private: - string_sequence_tester(bool bounded) - : bounded_(bounded) - {} - - bool bounded_; - - boost::weak_ptr<string_sequence_tester> self_; }; #endif // guard_string_sequence_tester_hpp diff --git a/TAO/tests/Sequence_Unit_Tests/string_ut.cpp b/TAO/tests/Sequence_Unit_Tests/string_ut.cpp index 5ff67e39e0d..3dac99b2e4c 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/string_ut.cpp @@ -12,13 +12,7 @@ #include "ace/OS_NS_string.h" -#include <sstream> -#include <stdexcept> -#include <iostream> - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" using namespace TAO::details; diff --git a/TAO/tests/Sequence_Unit_Tests/test_macros.h b/TAO/tests/Sequence_Unit_Tests/test_macros.h new file mode 100644 index 00000000000..2db80f1410f --- /dev/null +++ b/TAO/tests/Sequence_Unit_Tests/test_macros.h @@ -0,0 +1,43 @@ +// $Id$ + +#include "ace/Log_Msg.h" + +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +#define FAIL_RETURN_IF_NOT(CONDITION, X) \ + if (!(CONDITION)) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } +#define CHECK_EQUAL(X, Y) \ + if ((X) != (Y)) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } +#define CHECK(X) \ + if (!(X)) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +#define CHECK_THROW(X, Y) \ + try { \ + X; \ + } \ + catch (Y const &) \ + { \ + } \ + catch (...) \ + { \ + return 1; \ + } \ + + diff --git a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits.hpp b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits.hpp index 57d3cb859f7..8ebdeada068 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits.hpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits.hpp @@ -37,6 +37,13 @@ struct testing_allocation_traits : public base return base::allocbuf(maximum); } + // allocbuf_calls must be updated when allocbuf_noinit is called as well. + inline static value_type * allocbuf_noinit(CORBA::ULong maximum) + { + allocbuf_calls(); + return base::allocbuf_noinit(maximum); + } + static call_counter freebuf_calls; inline static void freebuf(value_type * buffer) { diff --git a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp index de4426c4f16..ae7445e53b4 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp @@ -8,18 +8,15 @@ * @author Carlos O'Ryan */ #include "testing_allocation_traits.hpp" - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #define CHECK_NO_THROW(statement) \ try { statement; } catch(...) { \ - BOOST_ERROR("unexpected exception raised"); } + return 1; } using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO::details; -using namespace boost::unit_test_framework; + CORBA::ULong const MAXIMUM = 32; @@ -30,7 +27,7 @@ struct Tester typedef bounded_value_allocation_traits<value_type,MAXIMUM,true> bounded; template<class aspect> - void test_allocbuf() + int test_allocbuf() { expected_calls c(aspect::allocbuf_calls); @@ -38,15 +35,16 @@ struct Tester value_type * s = 0; CHECK_NO_THROW(s = aspect::allocbuf(4)); aspect::freebuf(s); - BOOST_CHECK_THROW(s = aspect::allocbuf(4), testing_exception); + CHECK_THROW(s = aspect::allocbuf(4), testing_exception); CHECK_NO_THROW(s = aspect::allocbuf(4)); aspect::freebuf(s); - BOOST_CHECK_MESSAGE(c.expect(3), c); + FAIL_RETURN_IF_NOT(c.expect(3), c); + return 0; } template<class aspect> - void test_freebuf() + int test_freebuf() { expected_calls c(aspect::freebuf_calls); @@ -54,34 +52,38 @@ struct Tester value_type * s = aspect::allocbuf(4); CHECK_NO_THROW(aspect::freebuf(s)); s = aspect::allocbuf(4); - BOOST_CHECK_THROW(aspect::freebuf(s), testing_exception); + CHECK_THROW(aspect::freebuf(s), testing_exception); aspect::freebuf(s); s = aspect::allocbuf(4); CHECK_NO_THROW(aspect::freebuf(s)); - BOOST_CHECK_MESSAGE(c.expect(4), c); + FAIL_RETURN_IF_NOT(c.expect(4), c); + return 0; } - void test_default_buffer_allocation_value() + int test_default_buffer_allocation_value() { expected_calls u(unbounded::default_buffer_allocation_calls); expected_calls b(bounded::default_buffer_allocation_calls); value_type * s = unbounded::default_buffer_allocation(); - BOOST_CHECK_MESSAGE(u.expect(1), u); - BOOST_CHECK_MESSAGE(b.expect(0), b); - BOOST_CHECK_EQUAL(static_cast<value_type*>(0), s); + FAIL_RETURN_IF_NOT(u.expect(1), u); + FAIL_RETURN_IF_NOT(b.expect(0), b); + CHECK_EQUAL(static_cast<value_type*>(0), s); bounded::freebuf(s); s = bounded::default_buffer_allocation(); - BOOST_CHECK_MESSAGE(u.expect(0), u); - BOOST_CHECK_MESSAGE(b.expect(1), b); - BOOST_CHECK(static_cast<value_type*>(0) != s); + FAIL_RETURN_IF_NOT(u.expect(0), u); + FAIL_RETURN_IF_NOT(b.expect(1), b); + // default_buffer_allocation doesn't allocate a buffer for + // bounded sequences (see bug 3042). + CHECK_EQUAL(static_cast<value_type*>(0), s); bounded::freebuf(s); + return 0; } template<class aspect> - void test_default_buffer_allocation() + int test_default_buffer_allocation() { expected_calls c(aspect::default_buffer_allocation_calls); @@ -90,112 +92,80 @@ struct Tester CHECK_NO_THROW( s = aspect::default_buffer_allocation()); aspect::freebuf(s); - BOOST_CHECK_THROW( + CHECK_THROW( s = aspect::default_buffer_allocation(), testing_exception); CHECK_NO_THROW( s = aspect::default_buffer_allocation()); aspect::freebuf(s); - BOOST_CHECK_MESSAGE(c.expect(3), c); - } - - void test_default_buffer_allocation_unbounded() - { - test_default_buffer_allocation<unbounded>(); + FAIL_RETURN_IF_NOT(c.expect(3), c); + return 0; } - void test_default_buffer_allocation_bounded() + int test_default_buffer_allocation_unbounded() { - test_default_buffer_allocation<bounded>(); + return test_default_buffer_allocation<unbounded>(); } - void test_allocbuf_unbounded() + int test_default_buffer_allocation_bounded() { - test_allocbuf<unbounded>(); + return test_default_buffer_allocation<bounded>(); } - void test_allocbuf_bounded() + int test_allocbuf_unbounded() { - test_allocbuf<bounded>(); + return test_allocbuf<unbounded>(); } - void test_freebuf_unbounded() + int test_allocbuf_bounded() { - test_freebuf<unbounded>(); + return test_allocbuf<bounded>(); } - void test_freebuf_bounded() + int test_freebuf_unbounded() { - test_freebuf<bounded>(); + return test_freebuf<unbounded>(); } - void add_all(test_suite * ts) + int test_freebuf_bounded() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_value, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_bounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_allocbuf_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_allocbuf_bounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_freebuf_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_freebuf_bounded, - shared_this)); + return test_freebuf<bounded>(); } - static boost::shared_ptr<Tester> allocate() + int test_all() { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_default_buffer_allocation_value(); + status += this->test_default_buffer_allocation_unbounded(); + status += this->test_default_buffer_allocation_bounded(); + status += this->test_allocbuf_unbounded(); + status += this->test_allocbuf_bounded(); + status += this->test_freebuf_unbounded(); + status += this->test_freebuf_bounded(); + return status; } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; struct Foo { int y; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("testing allocation traits unit test"); - + int status = 0; { - boost::shared_ptr<Tester<int> > tester( - Tester<int>::allocate()); - tester->add_all(ts); + Tester<int> tester; + status += tester.test_all (); } { - boost::shared_ptr<Tester<Foo> > tester( - Tester<Foo>::allocate()); - tester->add_all(ts); + Tester<Foo> tester; + status += tester.test_all (); } { - boost::shared_ptr<Tester<char*> > tester( - Tester<char*>::allocate()); - tester->add_all(ts); + Tester<char*> tester; + status += tester.test_all (); } - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp b/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp index e5f20bb8ee1..7963526de82 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp @@ -13,8 +13,7 @@ */ #include "testing_exception.hpp" - -#include <boost/utility.hpp> +#include "ace/Copy_Disabled.h" #include <iostream> @@ -59,7 +58,7 @@ private: * number of times. */ class expected_calls - : private boost::noncopyable + : private ACE_Copy_Disabled { public: inline expected_calls(call_counter const & counter) @@ -100,7 +99,6 @@ inline std::ostream & operator<<(std::ostream & os, expected_calls const & x) { return os << "current=" << x.current_count() << ",previous=" << x.previous_count(); - } #endif // guard_testing_counters_hpp diff --git a/TAO/tests/Sequence_Unit_Tests/testing_object_reference_traits.hpp b/TAO/tests/Sequence_Unit_Tests/testing_object_reference_traits.hpp index 043c85ad06a..c627f477b3a 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_object_reference_traits.hpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_object_reference_traits.hpp @@ -43,7 +43,7 @@ struct testing_object_reference_traits static void release(object_type * s) { release_calls(); - return real_traits::release(s); + real_traits::release(s); } }; diff --git a/TAO/tests/Sequence_Unit_Tests/testing_string_traits.hpp b/TAO/tests/Sequence_Unit_Tests/testing_string_traits.hpp index 0c316da6dc3..c333e70f932 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_string_traits.hpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_string_traits.hpp @@ -43,7 +43,7 @@ struct testing_string_traits static void release(char_type * s) { release_calls(); - return real_traits::release(s); + real_traits::release(s); } static void not_released_from_const( diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp index 9648158918a..6f988b979d8 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp @@ -14,64 +14,37 @@ #include "tao/Unbounded_Array_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -using namespace boost::unit_test_framework; -using namespace TAO; - -struct Tester -{ - typedef unbounded_array_sequence<my_array, my_array_slice, my_array_tag> tested_sequence; - typedef tested_sequence::value_type value_type; - typedef tested_sequence::const_value_type const_value_type; - - typedef tested_sequence::element_traits tested_element_traits; - typedef tested_sequence::allocation_traits tested_allocation_traits; - typedef TAO::details::range_checking<value_type,true> range; - - void test_default_constructor() +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +typedef unbounded_array_sequence<my_array, my_array_slice, my_array_tag> tested_sequence; +typedef tested_sequence::value_type value_type; +typedef tested_sequence::const_value_type const_value_type; + +typedef tested_sequence::element_traits tested_element_traits; +typedef tested_sequence::allocation_traits tested_allocation_traits; +typedef TAO::details::range_checking<value_type,true> range; + +int test_default_constructor() { { tested_sequence x; - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF(CORBA::ULong(0), x.maximum()); + FAIL_RETURN_IF(CORBA::ULong(0), x.length()); + FAIL_RETURN_IF(true, x.release()); } } - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; -}; - -test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded array sequence unit test"); + int status = 0; - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + status += test_default_constructor (); - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp index 0116dd37dcb..8ca1fca4193 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp @@ -16,11 +16,9 @@ #include "tao/Unbounded_Object_Reference_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; struct Tester @@ -33,7 +31,7 @@ struct Tester typedef tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -41,46 +39,22 @@ struct Tester { tested_sequence x; - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(false, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(false, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + int status = 0; + Tester x; + status += x.test_default_constructor (); - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp index 263576143d9..eee6e01f5e3 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp @@ -16,11 +16,9 @@ #include "tao/Unbounded_Object_Reference_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; struct Tester @@ -33,7 +31,7 @@ struct Tester typedef tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -41,16 +39,17 @@ struct Tester { tested_sequence x; - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(false, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(false, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -58,30 +57,34 @@ struct Tester { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // ulong constructor calls allocbuf and thus there must be + // maximum() default initilized elements. + FAIL_RETURN_IF_NOT(i.expect(16), i); + return 0; } - void test_ulong_constructor_throw() + int test_ulong_constructor_throw() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); + CHECK_THROW(tested_sequence x(16), testing_exception); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_buffer_constructor_release_true() + int test_buffer_constructor_release_true() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -92,17 +95,19 @@ struct Tester a.reset(); tested_sequence x(maximum, maximum / 2, data, true); - BOOST_CHECK_EQUAL(x.maximum(), maximum); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), true); + CHECK_EQUAL(x.maximum(), maximum); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), true); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // allocbuf default initializes maximum elements. + FAIL_RETURN_IF_NOT(i.expect(32), i); + return 0; } - void test_buffer_constructor_release_false() + int test_buffer_constructor_release_false() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -114,23 +119,25 @@ struct Tester { tested_sequence x(maximum, maximum / 2, data, false); - BOOST_CHECK_EQUAL(x.maximum(), maximum); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), false); + CHECK_EQUAL(x.maximum(), maximum); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), false); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + // allocbuf default initializes maximum elements. + FAIL_RETURN_IF_NOT(i.expect(64), i); tested_sequence::freebuf(data); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -140,12 +147,13 @@ struct Tester tested_sequence y(x); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor() + int test_copy_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -156,11 +164,11 @@ struct Tester { tested_sequence x(l); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); + FAIL_RETURN_IF_NOT(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -169,23 +177,24 @@ struct Tester d.reset(); r.reset(); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); - BOOST_CHECK_MESSAGE(d.expect(l), d); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(d.expect(l), d); for(CORBA::ULong i = 0; i != l; ++i) { - BOOST_CHECK_EQUAL(int(i), y[i]->id()); + CHECK_EQUAL(int(i), y[i]->id()); } } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(2*l), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(2*l), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(2), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_throw_duplicate() + int test_copy_constructor_throw_duplicate() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -197,11 +206,11 @@ struct Tester tested_sequence x(l); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); + FAIL_RETURN_IF_NOT(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -210,20 +219,21 @@ struct Tester d.reset(); r.reset(); mock_reference::duplicate_calls.failure_countdown(8); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(8), d); - BOOST_CHECK_MESSAGE(r.expect(l), r); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(8), d); + FAIL_RETURN_IF_NOT(r.expect(l), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(l), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(l), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -232,116 +242,124 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + // allocbuf default initializes 16 elements. + FAIL_RETURN_IF_NOT(i.expect(16), i); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(32), i); + // ulong constructor calls allocbuf and thus there must be + // maximum() default initilized elements + length() leads to buffer + // reallocation maximum() gets set to a new value. + FAIL_RETURN_IF_NOT(i.expect(48), i); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_copy_elements() + int test_set_length_copy_elements() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.length()); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), a); - BOOST_CHECK_MESSAGE(i.expect(16), i); + CHECK_EQUAL(CORBA::ULong(16), x.length()); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), a); + FAIL_RETURN_IF_NOT(i.expect(16), i); for(int j = 0; j != 16; ++j) { - BOOST_CHECK_EQUAL(mock_reference::_nil(), x[j]); + CHECK_EQUAL(mock_reference::_nil(), x[j]); x[j] = mock_reference::allocate(j); } x.length(32); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(16), i); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(16), i); tested_sequence const & y = x; for(CORBA::ULong i = 0; i != 16UL; ++i) { - BOOST_REQUIRE(mock_reference::_nil() != y[i]); - BOOST_CHECK_EQUAL(int(i), y[i]->id()); + CHECK(mock_reference::_nil() != y[i]); + CHECK_EQUAL(int(i), y[i]->id()); } for(CORBA::ULong i = 16; i != 32UL; ++i) { - BOOST_CHECK_EQUAL(mock_reference::_nil(), y[i]); + CHECK_EQUAL(mock_reference::_nil(), y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_set_length_throw() + int test_set_length_throw() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(16); - BOOST_CHECK_MESSAGE(i.expect(16), i); + FAIL_RETURN_IF_NOT(i.expect(16), i); for(int j = 0; j != 16; ++j) { - BOOST_CHECK_EQUAL(mock_reference::_nil(), x[j]); + CHECK_EQUAL(mock_reference::_nil(), x[j]); x[j] = mock_reference::allocate(j); } tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(32), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.length()); - BOOST_CHECK_MESSAGE(i.expect(0), i); + CHECK_THROW(x.length(32), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), x.length()); + FAIL_RETURN_IF_NOT(i.expect(0), i); tested_sequence const & y = x; for(int j = 0; j != 16; ++j) { - BOOST_REQUIRE(mock_reference::_nil() != y[j]); - BOOST_CHECK_EQUAL(j, y[j]->id()); + CHECK(mock_reference::_nil() != y[j]); + CHECK_EQUAL(j, y[j]->id()); } } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } value_type * alloc_and_init_buffer() @@ -355,15 +373,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_replace_release_true() + int test_replace_release_true() { value_type * buffer = alloc_and_init_buffer(); @@ -372,24 +391,26 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a; - a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + a.replace(8, 4, buffer, true); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Since we've given away the ownership the buffer is deallocated by + // the sequence. + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_release_false() + int test_replace_release_false() { value_type * buffer = alloc_and_init_buffer(); @@ -399,23 +420,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_release_default() + int test_replace_release_default() { value_type * buffer = alloc_and_init_buffer(); @@ -425,95 +447,54 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor_throw, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_throw_duplicate, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_copy_elements, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_throw, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_default, - shared_this)); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - static boost::shared_ptr<Tester> allocate() + int test_all() { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_default_constructor(); + status += this->test_ulong_constructor(); + status += this->test_ulong_constructor_throw(); + status += this->test_buffer_constructor_release_true(); + status += this->test_buffer_constructor_release_false(); + status += this->test_copy_constructor_from_default(); + status += this->test_copy_constructor(); + status += this->test_copy_constructor_throw_duplicate(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_set_length_copy_elements(); + status += this->test_set_length_throw(); + status += this->test_replace_release_true(); + status += this->test_replace_release_false(); + status += this->test_replace_release_default(); + return status; } -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + int status = 0; + { + Tester tester; + status += tester.test_all(); + } - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp index 56162ac842a..0bc62b60efa 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp @@ -15,16 +15,14 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #include "tao/Basic_Types.h" #include "tao/CDR.h" #include "ace/OS_NS_stdio.h" -using namespace boost::unit_test_framework; + using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; typedef unbounded_value_sequence<CORBA::Octet> tested_sequence; @@ -36,81 +34,87 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_assignment_from_ulong() + int test_assignment_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); x.length(8); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + // Since above no allocation for y was done then + // no deallocation needed during assignment. + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -118,34 +122,36 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_set_length() + int test_exception_in_set_length() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -153,10 +159,13 @@ struct Tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(x.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + // length() above tried to allocate a buffer but it didn't reach + // new[] and sequence was not changed, thus no need to deallocate. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } value_type * alloc_and_init_buffer() @@ -178,7 +187,7 @@ struct Tester return mb; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -186,62 +195,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -250,24 +262,26 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -276,24 +290,26 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -302,187 +318,138 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Default constructed sequence doesn't allocate a buffer. + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); + return 0; } - void test_no_copy_octet() + int test_no_copy_octet() { #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) ACE_Message_Block * mb = alloc_and_init_mb(); tested_sequence a (8, mb); - BOOST_CHECK_EQUAL(CORBA::Octet( 't'), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 'g'), a[6]); + CHECK_EQUAL(CORBA::Octet( 't'), a[0]); + CHECK_EQUAL(CORBA::Octet( 'g'), a[6]); char upperbuf[256]; ACE_OS::sprintf (upperbuf, "%s", "THIS IS A TEST"); size_t n = (ACE_OS::strlen (upperbuf) + 1) * sizeof (char); ACE_Message_Block * upper_mb = 0; - ACE_NEW (upper_mb, - ACE_Message_Block (n)); + ACE_NEW_RETURN (upper_mb, + ACE_Message_Block (n), 1); // Copy buf into the Message_Block and update the wr_ptr (). upper_mb->copy ((char *) upperbuf, n); a.replace (n, upper_mb); - BOOST_CHECK_EQUAL(CORBA::Octet( 'T'), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 'S'), a[6]); + CHECK_EQUAL(CORBA::Octet( 'T'), a[0]); + CHECK_EQUAL(CORBA::Octet( 'S'), a[6]); + delete upper_mb; + delete mb; #endif + return 0; } - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_no_copy_octet, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - - } - - static boost::shared_ptr<Tester> allocate() + int test_all() { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_no_copy_octet(); + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_assignment_from_ulong(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_set_length(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded no copy octet sequence unit test"); - + int status = 0; { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + Tester tester; + status += tester.test_all(); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); + common tester; + status += tester.test_all (); } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp index acc347afc39..20146e92b2e 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp @@ -8,10 +8,6 @@ * @author Johnny Willemsen */ -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - #include "testing_allocation_traits.hpp" #include "testing_range_checking.hpp" @@ -19,11 +15,13 @@ #include "value_sequence_tester.hpp" +#include "test_macros.h" + #include "tao/Basic_Types.h" #include "tao/CDR.h" using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; -using namespace boost::unit_test_framework; + typedef unbounded_value_sequence<CORBA::Octet> tested_sequence; typedef tested_sequence::element_traits tested_element_traits; @@ -34,81 +32,85 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_assignment_from_ulong() + int test_assignment_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); x.length(8); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -116,34 +118,36 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_set_length() + int test_exception_in_set_length() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -151,10 +155,11 @@ struct Tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(x.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } value_type * alloc_and_init_buffer() @@ -165,7 +170,7 @@ struct Tester return buf; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -173,62 +178,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -237,24 +245,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -263,24 +272,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -289,162 +299,114 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Since we've given away the ownership the buffer is deallocated by + // the sequence. + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); + return 0; } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - + int status = 0; + + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_assignment_from_ulong(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_set_length(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -using namespace boost::unit_test_framework; - -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded octet sequence unit test"); - + int status = 0; { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + Tester tester; + status += tester.test_all (); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); + common tester; + status += tester.test_all (); } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp index 99043e4bd97..6d320b5254d 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp @@ -22,11 +22,9 @@ #include "tao/Unbounded_Sequence_CDR_T.h" #include "tao/CDR.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; typedef unbounded_object_reference_sequence<mock_reference, mock_reference_var> tested_sequence; @@ -61,15 +59,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_stream() + int test_stream() { value_type * buffer = alloc_and_init_buffer(); @@ -78,50 +77,26 @@ struct Tester tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); TAO_OutputCDR stream; stream << a; - BOOST_CHECK_MESSAGE(s.expect(4), s); + FAIL_RETURN_IF_NOT(s.expect(4), s); } tested_sequence::freebuf(buffer); + return 0; } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_stream, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + int status = 0; + Tester x; + status += x.test_stream (); - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp index 0293fb0a4f0..f2639091b7d 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp @@ -17,11 +17,9 @@ #include "string_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; template<class tested_sequence> @@ -36,7 +34,7 @@ struct Tester typedef typename tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -44,46 +42,60 @@ struct Tester { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // ulong constructor calls allocbuf and thus there must be + // maximum() default initilized elements. + FAIL_RETURN_IF_NOT(i.expect(16), i); + return 0; } - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); + expected_calls r(tested_element_traits::release_calls); expected_calls d(tested_element_traits::duplicate_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); + // ulong constructor calls allocbuf and thus there must be + // maximum() default initilized elements. + FAIL_RETURN_IF_NOT(i.expect(16), i); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + // length() doesn't default initialize anything since initialization + // was done in ulong constructor. + FAIL_RETURN_IF_NOT(i.expect(0), i); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); - - BOOST_CHECK_MESSAGE(d.expect(8), d); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); + + FAIL_RETURN_IF_NOT(d.expect(8), d); + // Copy constructor must duplicate length() elements and default + // initilize rest maximum()-length(). + FAIL_RETURN_IF_NOT(i.expect(8), d); } - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(f.expect(2), f); + // There must be 32 elements released since maximum() is 16. + FAIL_RETURN_IF_NOT(r.expect(32), i); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -92,51 +104,59 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + // ulong constructor calls allocbuf and thus there must be + // maximum() default initilized elements. + FAIL_RETURN_IF_NOT(i.expect(16), i); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(32), i); + // ulong constructor calls allocbuf and thus there must be + // maximum() default initilized elements + length() leads to buffer + // reallocation maximum() gets set to a new value. + FAIL_RETURN_IF_NOT(i.expect(48), i); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_exception_in_length() + int test_exception_in_length() { expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -154,29 +174,30 @@ struct Tester r.reset(); f.reset(); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(y.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + CHECK_THROW(y.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); - BOOST_CHECK_EQUAL(CORBA::ULong(4), y.length()); + CHECK_EQUAL(CORBA::ULong(4), y.length()); for(CORBA::ULong i = 0; i != 4; ++i) { - BOOST_CHECK_MESSAGE( + FAIL_RETURN_IF_NOT( helper::compare_test_string(y[i]), "Mismatch in element " << i << ", got=" << y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_duplicate_exception_in_length() + int test_default_initializer_exception_in_length() { expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls a(tested_allocation_traits::allocbuf_calls); - expected_calls d(tested_element_traits::duplicate_calls); + expected_calls d(tested_element_traits::default_initializer_calls); expected_calls r(tested_element_traits::release_calls); { tested_sequence y; y.length(4); @@ -189,45 +210,51 @@ struct Tester d.reset(); r.reset(); f.reset(); - tested_element_traits::duplicate_calls.failure_countdown(3); - BOOST_CHECK_THROW(y.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(3), d); - BOOST_CHECK_MESSAGE(r.expect(8), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(4), y.length()); + tested_element_traits::default_initializer_calls.failure_countdown(3); + CHECK_THROW(y.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(3), d); + FAIL_RETURN_IF_NOT(r.expect(8), r); + + CHECK_EQUAL(CORBA::ULong(4), y.length()); for(CORBA::ULong i = 0; i != 4; ++i) { - BOOST_CHECK_MESSAGE( + FAIL_RETURN_IF_NOT( helper::compare_test_string(y[i]), "Mismatch in element " << i << ", got=" << y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } value_type * alloc_and_init_buffer() { value_type * buf = tested_sequence::allocbuf(8); + delete[] buf[0]; buf[0] = helper::to_string(1); + delete[] buf[1]; buf[1] = helper::to_string(4); + delete[] buf[2]; buf[2] = helper::to_string(9); + delete[] buf[3]; buf[3] = helper::to_string(16); return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK(helper::compare(1, a[0])); - BOOST_CHECK(helper::compare(4, a[1])); - BOOST_CHECK(helper::compare(9, a[2])); - BOOST_CHECK(helper::compare(16, a[3])); + CHECK(helper::compare(1, a[0])); + CHECK(helper::compare(4, a[1])); + CHECK(helper::compare(9, a[2])); + CHECK(helper::compare(16, a[3])); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -235,19 +262,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -255,19 +283,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -275,18 +304,19 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -296,23 +326,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); @@ -322,23 +353,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); @@ -347,46 +379,51 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a; - a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + a.replace(8, 4, buffer, true); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(c.expect(0), c); + // Since we've given away the ownership the buffer is deallocated by + // the sequence. + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -394,149 +431,99 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_regression_2201() + int test_regression_2201() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls r(tested_element_traits::release_calls); { - tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); - check_values(a); - a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); - a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK(helper::compare_empty(a[3])); + tested_sequence x(8, 4, buffer, true); + CHECK_EQUAL(CORBA::ULong(8), x.maximum()); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK_EQUAL(buffer, x.get_buffer()); + CHECK_EQUAL(true, x.release()); + check_values(x); + x.length (3); + CHECK_EQUAL(CORBA::ULong(3), x.length()); + x.length (4); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK(helper::compare_empty(x[3])); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + // 1 additional release call happens when we shrink + // the sequence to length 3. + FAIL_RETURN_IF_NOT(r.expect(9), r); + return 0; } - void add_all(test_suite * ts) + int test_all() { + int status = 0; typedef string_sequence_tester<tested_sequence> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); - - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_length, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_duplicate_exception_in_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201, - shared_this)); + common tester; + status += tester.test_all (); + + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_exception_in_length(); + status += this->test_default_initializer_exception_in_length(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_default(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + status += this->test_regression_2201(); + return status; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded string sequence unit test"); - + int status = 0; { typedef Tester<unbounded_basic_string_sequence <char> > nTester; - boost::shared_ptr<nTester> tester(nTester::allocate()); - tester->add_all(ts); + nTester ntester; + status += ntester.test_all (); } +#if defined(ACE_HAS_WCHAR) { typedef Tester<unbounded_basic_string_sequence <CORBA::WChar> > wTester; - boost::shared_ptr<wTester> tester(wTester::allocate()); - tester->add_all(ts); + wTester wtester; + status += wtester.test_all (); } +#endif - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp index 2c42548cd69..8edf040fb69 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp @@ -15,11 +15,9 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; typedef unbounded_value_sequence<int> tested_sequence; @@ -31,81 +29,85 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_assignment_from_ulong() + int test_assignment_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); x.length(8); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -113,34 +115,36 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_set_length() + int test_exception_in_set_length() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -148,10 +152,11 @@ struct Tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(x.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } value_type * alloc_and_init_buffer() @@ -162,34 +167,34 @@ struct Tester return buf; } - void test_regression_2201 () + int test_regression_2201 () { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { - tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); - a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); - a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(int(0), a[3]); + tested_sequence x(8, 4, buffer, true); + CHECK_EQUAL(CORBA::ULong(8), x.maximum()); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK_EQUAL(buffer, x.get_buffer()); + CHECK_EQUAL(int( 1), x[0]); + CHECK_EQUAL(int( 4), x[1]); + CHECK_EQUAL(int( 9), x[2]); + CHECK_EQUAL(int(16), x[3]); + CHECK_EQUAL(true, x.release()); + x.length (3); + CHECK_EQUAL(CORBA::ULong(3), x.length()); + x.length (4); + CHECK_EQUAL(CORBA::ULong(4), x.length()); + CHECK_EQUAL(int(0), x[3]); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - tested_sequence::freebuf(buffer); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -197,62 +202,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -261,24 +269,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -287,24 +296,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -313,165 +323,107 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); + return 0; } - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201 , - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - - } - - static boost::shared_ptr<Tester> allocate() + int test_all() { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_assignment_from_ulong(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_set_length(); + status += this->test_regression_2201 (); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded value sequence unit test"); - - { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); - } + int status = 0; + Tester tester; + status += tester.test_all (); - { - typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); - } + typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; + common tester2; + status += tester2.test_all (); - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp b/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp index 7e502dc966d..0ed88485cf9 100644 --- a/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp +++ b/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp @@ -11,9 +11,7 @@ */ #include "tao/Basic_Types.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -24,57 +22,62 @@ struct value_sequence_tester typedef typename tested_sequence::value_type value_type; typedef typename tested_sequence::const_value_type const_value_type; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_EQUAL( + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + // Nothing was allocated then there is nothing to free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL( + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + // Default constructed sequence doesn't have elements, + // thus there is nothing to allocate/copy in copy constructor. + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + // Nothing was allocated then there is nothing to free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_index_accessor() + int test_index_accessor() { tested_sequence x; x.length(8); tested_sequence const & y = x; const_value_type & z = y[4]; - BOOST_CHECK_EQUAL(z, y[4]); + CHECK_EQUAL(z, y[4]); + return 0; } - void test_index_modifier() + int test_index_modifier() { tested_sequence x; x.length(8); @@ -82,12 +85,13 @@ struct value_sequence_tester tested_sequence const & y = x; const_value_type & z = y[4]; x[4] = 4; - BOOST_CHECK_EQUAL(4, x[4]); - BOOST_CHECK_EQUAL(4, y[4]); - BOOST_CHECK_EQUAL(4, z); + CHECK_EQUAL(4, x[4]); + CHECK_EQUAL(4, y[4]); + CHECK_EQUAL(4, z); + return 0; } - void test_index_checking() + int test_index_checking() { tested_sequence x; x.length(8); @@ -95,52 +99,57 @@ struct value_sequence_tester tested_sequence const & y = x; int z = 0; - BOOST_CHECK_THROW(z = y[32], std::range_error); - BOOST_CHECK_THROW(x[32] = z, std::range_error); + CHECK_THROW(z = y[32], std::range_error); + CHECK_THROW(x[32] = z, std::range_error); + return 0; } - void test_copy_constructor_values() + int test_copy_constructor_values() { tested_sequence a; a.length(16); for(CORBA::ULong i = 0; i != 16; ++i) a[i] = i*i; tested_sequence b(a); - BOOST_CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.length(), b.length()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(a[i] == b[i], + FAIL_RETURN_IF_NOT(a[i] == b[i], "Mismatched elements at index " << i); } + return 0; } - void test_assignment_from_default() + int test_assignment_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL( + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + // Default constructed sequence doesn't have elements, + // thus there is nothing to allocate/copy in operator=. + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + // Nothing was allocated then there is nothing to free. + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_assignment_values() + int test_assignment_values() { tested_sequence a; a.length(16); @@ -148,17 +157,18 @@ struct value_sequence_tester tested_sequence b; b = a; - BOOST_CHECK_EQUAL(a.maximum(), b.maximum()); - BOOST_CHECK_EQUAL(a.length(), b.length()); - BOOST_CHECK_EQUAL(a.release(), b.release()); + CHECK_EQUAL(a.maximum(), b.maximum()); + CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.release(), b.release()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(a[i] == b[i], + FAIL_RETURN_IF_NOT(a[i] == b[i], "Mismatched elements at index " << i); } + return 0; } - void test_exception_in_copy_constructor() + int test_exception_in_copy_constructor() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -167,13 +177,14 @@ struct value_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_assignment() + int test_exception_in_assignment() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -184,17 +195,18 @@ struct value_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); f.reset(); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(y = x, testing_exception); + CHECK_THROW(y = x, testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(3), y.length()); + CHECK_EQUAL(CORBA::ULong(3), y.length()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_get_buffer_const() + int test_get_buffer_const() { tested_sequence a; a.length(4); tested_sequence const & b = a; @@ -202,70 +214,30 @@ struct value_sequence_tester value_type const * buffer = b.get_buffer(); a[0] = 1; a[1] = 4; a[2] = 9; a[3] = 16; - BOOST_CHECK_EQUAL(1, buffer[0]); - BOOST_CHECK_EQUAL(4, buffer[1]); - BOOST_CHECK_EQUAL(9, buffer[2]); - BOOST_CHECK_EQUAL(16, buffer[3]); + CHECK_EQUAL(1, buffer[0]); + CHECK_EQUAL(4, buffer[1]); + CHECK_EQUAL(9, buffer[2]); + CHECK_EQUAL(16, buffer[3]); + return 0; } - void add_all(boost::unit_test_framework::test_suite * ts) + int test_all() { - boost::shared_ptr<value_sequence_tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_default_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_accessor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_modifier, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_checking, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_copy_constructor_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_assignment_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_assignment_values, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_exception_in_assignment, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_get_buffer_const, - shared_this)); + int status = 0; + + status +=this->test_default_constructor(); + status +=this->test_copy_constructor_from_default(); + status +=this->test_index_accessor(); + status +=this->test_index_modifier(); + status +=this->test_index_checking(); + status +=this->test_copy_constructor_values(); + status +=this->test_assignment_from_default(); + status +=this->test_assignment_values(); + status +=this->test_exception_in_copy_constructor(); + status +=this->test_exception_in_assignment(); + status +=this->test_get_buffer_const(); + return status; } - - static boost::shared_ptr<value_sequence_tester> allocate(bool bounded = false) - { - boost::shared_ptr<value_sequence_tester> ptr( - new value_sequence_tester(bounded)); - ptr->self_ = ptr; - - return ptr; - } - -private: - value_sequence_tester(bool bounded) - : bounded_ (bounded) - {} - - bool bounded_; - boost::weak_ptr<value_sequence_tester> self_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tests/TransportCurrent/lib/Client_Request_Interceptor.cpp b/TAO/tests/TransportCurrent/lib/Client_Request_Interceptor.cpp index 1d173d3423d..8a27b51a923 100644 --- a/TAO/tests/TransportCurrent/lib/Client_Request_Interceptor.cpp +++ b/TAO/tests/TransportCurrent/lib/Client_Request_Interceptor.cpp @@ -87,7 +87,7 @@ namespace Test { ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_); - ACE_OS::sprintf (temp, "%d", this->requestID_); + ACE_OS::sprintf (temp, "%ld", this->requestID_); ++this->requestID_; } diff --git a/TAO/tests/Transport_Cache_Manager/run_test.pl b/TAO/tests/Transport_Cache_Manager/run_test.pl index b9fe5f3fd00..8758546c585 100755 --- a/TAO/tests/Transport_Cache_Manager/run_test.pl +++ b/TAO/tests/Transport_Cache_Manager/run_test.pl @@ -11,14 +11,10 @@ use strict; my $final_result = 0; -my @tests = qw(Bug_3549_Regression +my @testsToRun = qw(Bug_3549_Regression Bug_3558_Regression ); -my @testsToRun = qw(); - -push(@testsToRun, @tests); - foreach my $process (@testsToRun) { my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; diff --git a/TAO/tests/Xt_Stopwatch/Client.h b/TAO/tests/Xt_Stopwatch/Client.h index 3ca196aea06..45162e4daf3 100644 --- a/TAO/tests/Xt_Stopwatch/Client.h +++ b/TAO/tests/Xt_Stopwatch/Client.h @@ -19,7 +19,7 @@ #include "testC.h" -#include "tao/XtResource_Loader.h" +#include "tao/XtResource/XtResource_Loader.h" class Control; class Client diff --git a/TAO/tests/Xt_Stopwatch/Stopwatch_display.cpp b/TAO/tests/Xt_Stopwatch/Stopwatch_display.cpp index 05cdcd2ccc8..35c42b14cbe 100644 --- a/TAO/tests/Xt_Stopwatch/Stopwatch_display.cpp +++ b/TAO/tests/Xt_Stopwatch/Stopwatch_display.cpp @@ -50,7 +50,7 @@ Stopwatch_display::set_time (CORBA::Float time) XmString xmstr = XmStringCreateSimple (buf); // Display the string in the Label widget - XtVaSetValues (this->label_, XmNlabelString, xmstr, 0); + XtVaSetValues (this->label_, XmNlabelString, xmstr, static_cast<void *>(0)); //??Can use XtSetValues with ac and al values.. // The compound string can be freed once passed to the widget diff --git a/TAO/tests/Xt_Stopwatch/server.cpp b/TAO/tests/Xt_Stopwatch/server.cpp index 3400a68bdd5..80fc60a15f4 100644 --- a/TAO/tests/Xt_Stopwatch/server.cpp +++ b/TAO/tests/Xt_Stopwatch/server.cpp @@ -8,7 +8,7 @@ ACE_RCSID (Xt_Stopwatch, server, "$Id$") -#include "tao/XtResource_Loader.h" +#include "tao/XtResource/XtResource_Loader.h" #include <Xm/Xm.h> #include "Stopwatch_display.h" #include "timer.h" diff --git a/TAO/tests/Xt_Stopwatch/timer.cpp b/TAO/tests/Xt_Stopwatch/timer.cpp index ce807616e3e..c4fbf9ce71c 100644 --- a/TAO/tests/Xt_Stopwatch/timer.cpp +++ b/TAO/tests/Xt_Stopwatch/timer.cpp @@ -13,6 +13,10 @@ Timer_imp::Timer_imp (XtAppContext &app, { } +Timer_imp::~Timer_imp () +{ +} + void Timer_imp::start (void) { diff --git a/TAO/tests/Xt_Stopwatch/timer.h b/TAO/tests/Xt_Stopwatch/timer.h index 6c2362cb1a3..1708bbc8428 100644 --- a/TAO/tests/Xt_Stopwatch/timer.h +++ b/TAO/tests/Xt_Stopwatch/timer.h @@ -29,7 +29,10 @@ class Timer_imp Timer_imp (XtAppContext &, CORBA::Long, Stopwatch_display *); - // Constructor.. + // Constructor + + virtual ~Timer_imp (); + // Destructor void start (void); // Resets, and starts the clock ticking diff --git a/TAO/tests/ZIOP/Hello.cpp b/TAO/tests/ZIOP/Hello.cpp index db7ffe13818..ab73744cbe1 100644 --- a/TAO/tests/ZIOP/Hello.cpp +++ b/TAO/tests/ZIOP/Hello.cpp @@ -27,6 +27,12 @@ Hello::get_big_reply () reply_mesg->length (this->length_); + for (unsigned int i = 0; i < this->length_; ++i) + { + int size = 128; + for (int ch = 0; ch < size && i < this->length_ - 1; ++ch) + reply_mesg[++i] = ACE_OS::rand() % size--; + } return reply_mesg._retn (); } diff --git a/TAO/tests/ZIOP/TestCompressor/TAO_TestCompressor.pc.in b/TAO/tests/ZIOP/TestCompressor/TAO_TestCompressor.pc.in new file mode 100644 index 00000000000..dbcaedd3928 --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TAO_TestCompressor.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: TAO_TEST_COMPRESSOR +Description: TAO Zlib Compression Library +Requires: TAO_Compression +Version: @VERSION@ +Libs: -L${libdir} -lTAO_TEST_Compressor +Cflags: -I${includedir} diff --git a/TAO/tests/ZIOP/TestCompressor/TAO_TestCompressor.rc b/TAO/tests/ZIOP/TestCompressor/TAO_TestCompressor.rc new file mode 100644 index 00000000000..9ed1be28a2e --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TAO_TestCompressor.rc @@ -0,0 +1,30 @@ +#include "..\..\tao\Version.h" + +1 VERSIONINFO + FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0 + PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "FileDescription", "TESTCOMPRESSOR\0" + VALUE "FileVersion", TAO_VERSION "\0" + VALUE "InternalName", "TAO_TESTCOMPRESSORDLL\0" + VALUE "LegalCopyright", "\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TAO_TESTCOMPRESSOR.DLL\0" + VALUE "ProductName", "TAO\0" + VALUE "ProductVersion", TAO_VERSION "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/TAO/tests/ZIOP/TestCompressor/TestCompressor.cpp b/TAO/tests/ZIOP/TestCompressor/TestCompressor.cpp new file mode 100644 index 00000000000..ef1bba0bc57 --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TestCompressor.cpp @@ -0,0 +1,36 @@ +#include "TestCompressor.h" + +ACE_RCSID (TEST, + TestCompressor, + "$Id$") + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +TestCompressor::TestCompressor ( + ::Compression::CompressionLevel compression_level, + ::Compression::CompressorFactory_ptr compressor_factory) : + BaseCompressor (compression_level, compressor_factory) +{ +} + +void +TestCompressor::compress ( + const ::Compression::Buffer &, + ::Compression::Buffer &) +{ + throw ::Compression::CompressionException (0, ""); +} + +void +TestCompressor::decompress ( + const ::Compression::Buffer &, + ::Compression::Buffer &) +{ + throw ::Compression::CompressionException (0, ""); +} +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tests/ZIOP/TestCompressor/TestCompressor.h b/TAO/tests/ZIOP/TestCompressor/TestCompressor.h new file mode 100644 index 00000000000..4cc3b4ee8a0 --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TestCompressor.h @@ -0,0 +1,53 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file TestCompressor.h + * + * $Id$ + * + * See http://www.zlib.net/manual.html for the zlib interface itself + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_TESTCOMPRESSOR_H +#define TAO_TESTCOMPRESSOR_H + +#include /**/ "ace/pre.h" + +#include "TestCompressor_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Compression/Compression.h" +#include "tao/Compression/Base_Compressor.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + class TAO_TESTCOMPRESSOR_Export TestCompressor : public BaseCompressor + { + public: + TestCompressor (::Compression::CompressionLevel compression_level, + ::Compression::CompressorFactory_ptr compressor_factory); + + virtual void compress ( + const ::Compression::Buffer &, + ::Compression::Buffer &); + + virtual void decompress ( + const ::Compression::Buffer &, + ::Compression::Buffer &); + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_TESTCOMPRESSOR_H */ diff --git a/TAO/tests/ZIOP/TestCompressor/TestCompressor_Factory.cpp b/TAO/tests/ZIOP/TestCompressor/TestCompressor_Factory.cpp new file mode 100644 index 00000000000..276edc0c121 --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TestCompressor_Factory.cpp @@ -0,0 +1,33 @@ +#include "TestCompressor_Factory.h" +#include "TestCompressor.h" + +ACE_RCSID (TEST, + TestCompressor_Factory, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +Test_CompressorFactory::Test_CompressorFactory (void) : + ::TAO::CompressorFactory (COMPRESSORID_FOR_TESTING), + compressor_ (::Compression::Compressor::_nil ()) +{ +} + +::Compression::Compressor_ptr +Test_CompressorFactory::get_compressor ( + ::Compression::CompressionLevel compression_level) +{ + // @todo, make a array based on compression level + if (CORBA::is_nil (compressor_.in ())) + { + compressor_ = new TestCompressor (compression_level, this); + } + + return ::Compression::Compressor::_duplicate (compressor_.in ()); +} +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tests/ZIOP/TestCompressor/TestCompressor_Factory.h b/TAO/tests/ZIOP/TestCompressor/TestCompressor_Factory.h new file mode 100644 index 00000000000..3fd02e8d68a --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TestCompressor_Factory.h @@ -0,0 +1,50 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file TestCompressor_Factory.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_TESTCOMPRESSOR_FACTORY_H +#define TAO_TESTCOMPRESSOR_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "TestCompressor_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Compression/Compression.h" +#include "tao/Compression/Compressor_Factory.h" + +#define COMPRESSORID_FOR_TESTING 10 + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + class TAO_TESTCOMPRESSOR_Export Test_CompressorFactory : + public ::TAO::CompressorFactory + { + public: + Test_CompressorFactory (void); + + virtual ::Compression::Compressor_ptr get_compressor ( + ::Compression::CompressionLevel compression_level); + private: + ::Compression::Compressor_var compressor_; + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_TESTCOMPRESSOR_FACTORY_H */ diff --git a/TAO/tests/ZIOP/TestCompressor/TestCompressor_export.h b/TAO/tests/ZIOP/TestCompressor/TestCompressor_export.h new file mode 100644 index 00000000000..47490000514 --- /dev/null +++ b/TAO/tests/ZIOP/TestCompressor/TestCompressor_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef TAO_TESTCOMPRESSOR_EXPORT_H +#define TAO_TESTCOMPRESSOR_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (TAO_TESTCOMPRESSOR_HAS_DLL) +# define TAO_TESTCOMPRESSOR_HAS_DLL 0 +# endif /* ! TAO_TESTCOMPRESSOR_HAS_DLL */ +#else +# if !defined (TAO_TESTCOMPRESSOR_HAS_DLL) +# define TAO_TESTCOMPRESSOR_HAS_DLL 1 +# endif /* ! TAO_TESTCOMPRESSOR_HAS_DLL */ +#endif + +#if defined (TAO_TESTCOMPRESSOR_HAS_DLL) && (TAO_TESTCOMPRESSOR_HAS_DLL == 1) +# if defined (TAO_TESTCOMPRESSOR_BUILD_DLL) +# define TAO_TESTCOMPRESSOR_Export ACE_Proper_Export_Flag +# define TAO_TESTCOMPRESSOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_TESTCOMPRESSOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_TESTCOMPRESSOR_BUILD_DLL */ +# define TAO_TESTCOMPRESSOR_Export ACE_Proper_Import_Flag +# define TAO_TESTCOMPRESSOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_TESTCOMPRESSOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_TESTCOMPRESSOR_BUILD_DLL */ +#else /* TAO_TESTCOMPRESSOR_HAS_DLL == 1 */ +# define TAO_TESTCOMPRESSOR_Export +# define TAO_TESTCOMPRESSOR_SINGLETON_DECLARATION(T) +# define TAO_TESTCOMPRESSOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_TESTCOMPRESSOR_HAS_DLL == 1 */ + +#endif /* TAO_TESTCOMPRESSOR_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/tests/ZIOP/ZIOP.mpc b/TAO/tests/ZIOP/ZIOP.mpc index 1028aff1069..46851aab44f 100644 --- a/TAO/tests/ZIOP/ZIOP.mpc +++ b/TAO/tests/ZIOP/ZIOP.mpc @@ -1,6 +1,43 @@ // -*- MPC -*- // $Id$ +project(TestCompressor) : taolib, compression, taoidldefaults { + sharedname = TAO_TestCompressor + dynamicflags = TAO_TESTCOMPRESSOR_BUILD_DLL + + Source_Files { + TestCompressor + } + + Header_Files { + TestCompressor + } + + Inline_Files { + TestCompressor + } + + Template_Files { + TestCompressor + } + + Resource_Files { + TestCompressor + } + + PIDL_Files { + TestCompressor + } + + IDL_Files { + TestCompressor + } + + Pkgconfig_Files { + TestCompressor/TAO_TestCompressor.pc.in + } +} + project(*idl): taoidldefaults { IDL_Files { Test.idl @@ -8,7 +45,7 @@ project(*idl): taoidldefaults { custom_only = 1 } -project(*Server): taoserver, compression, ziop, codecfactory, zlibcompressor { +project(*Server): taoserver, compression, ziop, codecfactory, zlibcompressor, bzip2compressor, testcompressor { after += *idl Source_Files { Hello.cpp @@ -22,7 +59,7 @@ project(*Server): taoserver, compression, ziop, codecfactory, zlibcompressor { } } -project(*Client): taoclient, compression, ziop, codecfactory, zlibcompressor, tc { +project(*Client): taoclient, compression, ziop, codecfactory, zlibcompressor, bzip2compressor, testcompressor, tc { after += *idl Source_Files { client.cpp diff --git a/TAO/tests/ZIOP/client.cpp b/TAO/tests/ZIOP/client.cpp index badddc7e070..0f4304527a1 100644 --- a/TAO/tests/ZIOP/client.cpp +++ b/TAO/tests/ZIOP/client.cpp @@ -5,17 +5,23 @@ #include "tao/ZIOP/ZIOP.h" #include "ace/OS.h" #include "tao/Compression/zlib/ZlibCompressor_Factory.h" -#include "tao/ORB_Constants.h" -#include "tao/TransportCurrent/TCC.h" +#include "tao/Compression/bzip2/Bzip2Compressor_Factory.h" +#include "TestCompressor//TestCompressor_Factory.h" ACE_RCSID(Hello, client, "$Id$") +#define DEFAULT_COMPRESSION_LEVEL 6 +::Compression::CompressionManager_var compression_manager = 0; const ACE_TCHAR *ior = ACE_TEXT("file://test.ior"); +int test = 1; + +int start_tests (Test::Hello_ptr hello, CORBA::ORB_ptr orb); + int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:t:")); int c; while ((c = get_opts ()) != -1) @@ -24,6 +30,9 @@ parse_args (int argc, ACE_TCHAR *argv[]) case 'k': ior = get_opts.opt_arg (); break; + case 't': + test = ACE_OS::atoi (get_opts.opt_arg ()); + break; case '?': default: @@ -38,34 +47,250 @@ parse_args (int argc, ACE_TCHAR *argv[]) return 0; } -void log_statistics (ACE_TCHAR* test, - ::TAO::CounterT initial_bytes_send, - ::TAO::CounterT initial_bytes_recv, - ::TAO::CounterT bytes_send_after_test, - ::TAO::CounterT bytes_recv_after_test) +int +register_factories (CORBA::ORB_ptr orb) +{ + CORBA::Object_var compression_manager_obj = + orb->resolve_initial_references("CompressionManager"); + + compression_manager = ::Compression::CompressionManager::_narrow ( + compression_manager_obj.in ()); + + if (CORBA::is_nil(compression_manager.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil compression manager\n"), + 1); + //register Zlib compressor + ::Compression::CompressorFactory_ptr compressor_factory; + ACE_NEW_RETURN (compressor_factory, TAO::Zlib_CompressorFactory (), 1); + ::Compression::CompressorFactory_var compr_fact = compressor_factory; + compression_manager->register_factory(compr_fact.in ()); + + // register bzip2 compressor + ACE_NEW_RETURN (compressor_factory, TAO::Bzip2_CompressorFactory (), 1); + compr_fact = compressor_factory; + compression_manager->register_factory(compr_fact.in ()); + + // register test compressor + ACE_NEW_RETURN (compressor_factory, TAO::Test_CompressorFactory (), 1); + compr_fact = compressor_factory; + compression_manager->register_factory(compr_fact.in ()); + return 0; +} + +CORBA::Policy_ptr +create_compressor_id_level_list_policy (CORBA::ORB_ptr orb, bool add_zlib_for_test_1) +{ + ::Compression::CompressorIdLevelList compressor_id_list; + + switch (test) + { + case 1: + if (add_zlib_for_test_1) + compressor_id_list.length(2); + else + compressor_id_list.length(1); + compressor_id_list[0].compressor_id = ::Compression::COMPRESSORID_LZO; + compressor_id_list[0].compression_level = DEFAULT_COMPRESSION_LEVEL; + if (add_zlib_for_test_1) + { + compressor_id_list[1].compressor_id = ::Compression::COMPRESSORID_ZLIB; + compressor_id_list[1].compression_level = DEFAULT_COMPRESSION_LEVEL; + } + break; + case 2: + compressor_id_list.length(1); + compressor_id_list[0].compressor_id = COMPRESSORID_FOR_TESTING; + compressor_id_list[0].compression_level = DEFAULT_COMPRESSION_LEVEL; + break; + case 3: + case 4: + default: + compressor_id_list.length(2); + compressor_id_list[0].compressor_id = ::Compression::COMPRESSORID_ZLIB; + compressor_id_list[0].compression_level = DEFAULT_COMPRESSION_LEVEL; + compressor_id_list[1].compressor_id = ::Compression::COMPRESSORID_BZIP2; + compressor_id_list[1].compression_level = DEFAULT_COMPRESSION_LEVEL; + break; + } + CORBA::Any compressor_id_any; + compressor_id_any <<= compressor_id_list; + + return orb->create_policy (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID, compressor_id_any); +} + +CORBA::Policy_ptr +create_low_value_policy (CORBA::ORB_ptr orb) +{ + // Setting policy for minimum amount of bytes that needs to be + // compressed. If a message is smaller than this, it doesn't get + // compressed. + // make sure everything gets compressed. + CORBA::ULong compression_low_value = 10; + if (test == 3) + compression_low_value = 5000000; + + CORBA::Any low_value_any; + low_value_any <<= compression_low_value; + + return orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, low_value_any); +} + +CORBA::Policy_ptr +create_compression_enabled_policy (CORBA::ORB_ptr orb) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("%s statistics:") - ACE_TEXT (" initial bytes sent:%d") - ACE_TEXT (" initial bytes recv:%d") - ACE_TEXT (" bytes sent after test:%d") - ACE_TEXT (" bytes recv after test:%d\n"), - test, - initial_bytes_send, - initial_bytes_recv, - bytes_send_after_test, - bytes_recv_after_test)); + // Setting policy whether compression is used. + CORBA::Boolean compression_enabling = true; + CORBA::Any compression_enabling_any; + compression_enabling_any <<= CORBA::Any::from_boolean(compression_enabling); + + return orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); } -void start_low_value_test(Test::Hello_ptr hello, ::TAO::Transport::Current_ptr) +CORBA::Policy_ptr +create_min_ratio_policy (CORBA::ORB_ptr orb) { -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT == 1 -// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); -// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); + CORBA::Any min_compression_ratio_any; + CORBA::Long min_compression_ratio = 50; + min_compression_ratio_any <<= min_compression_ratio; + + return orb->create_policy (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID, min_compression_ratio_any); +} + +Test::Hello_var +create_policies (CORBA::ORB_ptr orb, bool add_zlib_compressor) +{ + CORBA::PolicyList policies(4); + policies.length(4); + + policies[0] = create_compressor_id_level_list_policy (orb, add_zlib_compressor); + policies[1] = create_low_value_policy (orb); + policies[2] = create_compression_enabled_policy (orb); + policies[3] = create_min_ratio_policy (orb); + + CORBA::Object_var tmp = orb->string_to_object(ior); + CORBA::Object_var tmp2 = tmp->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE); + Test::Hello_var hello = Test::Hello::_narrow(tmp2.in ()); + return hello._retn (); +} + +Test::Hello_var +prepare_tests (CORBA::ORB_ptr orb, bool create_factories=true) +{ + +#if defined TAO_HAS_ZIOP && TAO_HAS_ZIOP == 1 + if (create_factories) + register_factories(orb); + + return create_policies (orb, !create_factories); +#else + ACE_UNUSED_ARG (create_factories); + CORBA::Object_var tmp = orb->string_to_object(ior); + Test::Hello_var hello = Test::Hello::_narrow(tmp.in ()); + return hello._retn (); #endif +} +int +check_results (CORBA::ORB_ptr orb) +{ +#if defined TAO_HAS_ZIOP && TAO_HAS_ZIOP == 1 + switch (test) + { + case 1: + try + { + // should throw an exception + compression_manager->get_compressor (::Compression::COMPRESSORID_LZO, + DEFAULT_COMPRESSION_LEVEL); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, ") + ACE_TEXT ("no exception thrown when applying for ") + ACE_TEXT ("LZO Compressor\n")), + 1); + } + catch (::Compression::UnknownCompressorId) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("check_results, expected exception caught, ") + ACE_TEXT ("(unknown factory)\n"))); + Test::Hello_var hello = prepare_tests (orb, false); + test = -1; + return start_tests (hello.in (), orb); + } + break; + case -1: + { + ::Compression::Compressor_ptr compressor = + compression_manager->get_compressor (::Compression::COMPRESSORID_ZLIB, + DEFAULT_COMPRESSION_LEVEL); + if (!CORBA::is_nil (compressor)) + { + if (compressor->compressed_bytes () == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, no compression used ") + ACE_TEXT ("during test 1a\n")), + 1); + else + return 0; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, zlib compressor not found ") + ACE_TEXT ("during test 1a\n")), + 1); + } + } + break; + case 2: + return 0; + break; + case 3: + case 4: + { + // low value policy test. No compression should be used. + ::Compression::Compressor_ptr compressor = + compression_manager->get_compressor (::Compression::COMPRESSORID_ZLIB, + DEFAULT_COMPRESSION_LEVEL); + if (!CORBA::is_nil (compressor)) + { + if (compressor->compressed_bytes () != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, compression used ") + ACE_TEXT ("during test %d\n"), test), + 1); + else + return 0; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, zlib compressor not found ") + ACE_TEXT ("during test %d\n"), test), + 1); + } + } + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, unknown test ID\n")), + 1); + } + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : check_results, unexpected\n")), + 1); +#else + ACE_UNUSED_ARG (orb); + return 0; +#endif +} + +int +run_string_test (Test::Hello_ptr hello) +{ ACE_DEBUG((LM_DEBUG, - ACE_TEXT("Start get_string; large compression ratio\n"))); + ACE_TEXT("run_string_test, start\n"))); CORBA::String_var the_string = hello->get_string ("This is a test string" "This is a test string" @@ -78,237 +303,109 @@ void start_low_value_test(Test::Hello_ptr hello, ::TAO::Transport::Current_ptr) "This is a test string"); ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", the_string.in ())); + if (ACE_OS::strstr (the_string._retn (), ACE_TEXT ("Hello there")) == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : run_string_test, unexpected string received\n")), + 1); + } -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// log_statistics ("low_value_test", initial_bytes_sent, initial_bytes_recv, -// tc->bytes_sent (), tc->bytes_received ()); -#endif -} - -void start_min_ratio_test (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr) -{ -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); -// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); -#endif - - ACE_DEBUG((LM_DEBUG, - ACE_TEXT("Start get_string; small compression ratio\n"))); - - //shouldn't compress since compress_ratio < min_ratio - CORBA::String_var the_string = hello->get_string ("!@#$#%^#@&^%*$@#GFGSd" - "fgdbdfgwe%^@#$#$%EQRT" - "sfdgdafs56#$@@#$&((%$" - "#4&%3#4%^21@!sdfSADHv" - "dsaAhn~1`2#$#sAFDGHdf"); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n", - the_string.in ())); - -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// log_statistics ("min_ratio_test", initial_bytes_sent, initial_bytes_recv, -// tc->bytes_sent (), tc->bytes_received ()); -#endif + return 0; } -void start_big_reply_test (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr) +int +run_big_reply_test (Test::Hello_ptr hello) { -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); -// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); -#endif - ACE_DEBUG((LM_DEBUG, - ACE_TEXT("Start get_big_reply; large compression ratio\n"))); + ACE_TEXT("start get_big_reply\n"))); //Prepare to send a large number of bytes. Should be compressed Test::Octet_Seq_var dummy = hello->get_big_reply (); - if (dummy.ptr ()->length () > 0) + if (dummy->length () > 0) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("Client side BLOB received\n"))); + ACE_TEXT("get_big_reply, received = %d bytes\n"), + dummy->length ())); } else { - ACE_DEBUG ((LM_ERROR, - ACE_TEXT("Error recieving BLOB on Client\n"))); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ERROR : get_big_reply, ") + ACE_TEXT ("error receiving client side blob\n")), + 1); } - -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// log_statistics ("big_reply_test",initial_bytes_sent, initial_bytes_recv, -// tc->bytes_sent (), tc->bytes_received ()); -#endif + return 0; } -void start_big_request_test (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr) +int +run_big_request_test (Test::Hello_ptr hello) { -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// ::TAO::CounterT initial_bytes_sent = tc->bytes_sent (); -// ::TAO::CounterT initial_bytes_recv = tc->bytes_received (); -#endif - - ACE_DEBUG((LM_DEBUG, - ACE_TEXT("Start big_request; large compression ratio\n"))); - //ACE_OS::sleep(1); - int length = 2000; + int length = 40000; Test::Octet_Seq send_msg(length); send_msg.length (length); - hello->big_request(send_msg); + ACE_DEBUG((LM_DEBUG, + ACE_TEXT("run_big_request_test, send = %d bytes\n"), length)); -#if defined (TAO_HAS_TRANSPORT_CURRENT) && TAO_HAS_TRANSPORT_CURRENT ==1 -// log_statistics ("big_request_test", initial_bytes_sent, initial_bytes_recv, -// tc->bytes_sent (), tc->bytes_received ()); -#endif + hello->big_request(send_msg); + return 0; } -void start_tests (Test::Hello_ptr hello, ::TAO::Transport::Current_ptr tc) +int +start_tests (Test::Hello_ptr hello, CORBA::ORB_ptr orb) { - //::CORBA::String_var rhost (tc->remote_host ()); - //::CORBA::String_var lhost (tc->local_host ()); - //::CORBA::Long id = tc->id (); - //::TAO::CounterT bs = tc->bytes_sent (); - //::TAO::CounterT br = tc->bytes_received (); - //::TAO::CounterT rs = tc->messages_sent (); - //::TAO::CounterT rr = tc->messages_received (); - - -#if !defined (TAO_HAS_TRANSPORT_CURRENT) || TAO_HAS_TRANSPORT_CURRENT == 0 - ACE_DEBUG((LM_DEBUG, - ACE_TEXT ("No statistical information available since TAO_HAS_TRANSPORT_CURRENT is not set"))); -#endif - - start_low_value_test (hello, tc); - - start_min_ratio_test (hello, tc); - - start_big_reply_test (hello, tc); + int result = 0; + if (test != 4) + { + result += run_string_test (hello); + result += run_big_request_test (hello); + } + result += run_big_reply_test (hello); - start_big_request_test (hello, tc); + result += check_results (orb); + return result; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { - int extra_argc = 2; - + int result = 0; try { - ACE_TCHAR **extra = 0; - ACE_NEW_RETURN (extra, ACE_TCHAR *[extra_argc], -1); - extra[0] = ACE::strnew (ACE_TEXT ("-ORBSvcConfDirective")); - extra[1] = ACE::strnew (ACE_TEXT ("dynamic TAO_Transport_Current_Loader Service_Object") - ACE_TEXT (" * TAO_TC:_make_TAO_Transport_Current_Loader() ''")); - - ACE_TCHAR **largv = new ACE_TCHAR *[argc+extra_argc]; - for (int i = 0; i < argc; i++) - largv[i] = argv[i]; - - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client adding args: "))); - for (int i = 0; i < extra_argc; i++) - { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s "), extra[i])); - largv[argc+i] = extra[i]; - } - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); - - argc += extra_argc; - - CORBA::ORB_var orb = CORBA::ORB_init (argc, largv); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; - CORBA::Object_var compression_manager = - orb->resolve_initial_references("CompressionManager"); - - Compression::CompressionManager_var manager = - Compression::CompressionManager::_narrow (compression_manager.in ()); - - if (CORBA::is_nil(manager.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Panic: nil compression manager\n"), - 1); - - Compression::CompressorFactory_ptr compressor_factory; - - ACE_NEW_RETURN (compressor_factory, TAO::Zlib_CompressorFactory (), 1); - - Compression::CompressorFactory_var compr_fact = compressor_factory; - manager->register_factory(compr_fact.in ()); - - Compression::CompressorIdLevelList compressor_id_list(2); - compressor_id_list.length(2); - compressor_id_list[0].compressor_id = Compression::COMPRESSORID_ZLIB; - compressor_id_list[0].compression_level = 5; - compressor_id_list[1].compressor_id = Compression::COMPRESSORID_BZIP2; - compressor_id_list[1].compression_level = 5; - - //Setting policy whether compression is used. - CORBA::Boolean compression_enabling = true; - CORBA::Any compression_enabling_any; - compression_enabling_any <<= CORBA::Any::from_boolean(compression_enabling); - - //Setting policy for minimum amount of bytes that needs to be - //compressed. If a message is smaller than this, it doesn't get - //compressed - CORBA::ULong compression_low_value = 100; - CORBA::Any low_value_any; - low_value_any <<= compression_low_value; - - CORBA::Any min_compression_ratio_any; - CORBA::Long min_compression_ratio = 75; - min_compression_ratio_any <<= min_compression_ratio; - - CORBA::Any compressor_id_any; - compressor_id_any <<= compressor_id_list; - - CORBA::PolicyList policies(4); - policies.length(4); - - policies[0] = orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); - policies[1] = orb->create_policy (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID, compressor_id_any); - policies[2] = orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, low_value_any); - policies[3] = orb->create_policy (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID, min_compression_ratio_any); - - CORBA::Object_var tmp = orb->string_to_object(ior); - CORBA::Object_var tmp2 = tmp->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE); - - Test::Hello_var hello = Test::Hello::_narrow(tmp2.in ()); + Test::Hello_var hello = prepare_tests (orb.in ()); if (CORBA::is_nil (hello.in ())) { ACE_ERROR_RETURN ((LM_DEBUG, - "Nil Test::Hello reference <%s>\n", + "ERROR : Nil Test::Hello reference <%C>\n", ior), 1); } - CORBA::Object_var tcobject = - orb->resolve_initial_references ("TAO::Transport::Current"); - - ::TAO::Transport::Current_var tc = - ::TAO::Transport::Current::_narrow (tcobject.in ()); - if (CORBA::is_nil (tc.in ())) - throw ::CORBA::INTERNAL (); - - start_tests(hello.in (), tc.in ()); + try + { + result += start_tests(hello.in (), orb.in ()); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + ++result; + } hello->shutdown (); - - orb->destroy (); - for (int i = 0; i < extra_argc; i++) - ACE::strdelete (extra[i]); - delete [] extra; - delete [] largv; + orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); - return 1; + ++result; } - return 0; + return result; } - diff --git a/TAO/tests/ZIOP/run_test.pl b/TAO/tests/ZIOP/run_test.pl index a036aecd5f3..f770bc27055 100755 --- a/TAO/tests/ZIOP/run_test.pl +++ b/TAO/tests/ZIOP/run_test.pl @@ -23,48 +23,57 @@ my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 fail my $iorbase = "server.ior"; my $server_iorfile = $server->LocalFile ($iorbase); my $client_iorfile = $client->LocalFile ($iorbase); -$server->DeleteFile($iorbase); -$client->DeleteFile($iorbase); - -$SV = $server->CreateProcess ("server", "-o $server_iorfile -ORBdebuglevel $debug_level"); -$CL = $client->CreateProcess ("client", "-k file://$client_iorfile -ORBdebuglevel $debug_level"); -$server_status = $SV->Spawn (); - -if ($server_status != 0) { - print STDERR "ERROR: server returned $server_status\n"; - exit 1; -} - -if ($server->WaitForFileTimed ($iorbase, - $server->ProcessStartWaitInterval()) == -1) { - print STDERR "ERROR: cannot find file <$server_iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; -} - -if ($server->GetFile ($iorbase) == -1) { - print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; -} -if ($client->PutFile ($iorbase) == -1) { - print STDERR "ERROR: cannot set file <$client_iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; -} - -$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); - -if ($client_status != 0) { - print STDERR "ERROR: client returned $client_status\n"; - $status = 1; -} -$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); -if ($server_status != 0) { - print STDERR "ERROR: server returned $server_status\n"; - $status = 1; +for ($test = 1; $test <= 4 && $status == 0; ++$test) +{ + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); + + $SV = $server->CreateProcess ("server", "-o $server_iorfile -t $test -ORBdebuglevel $debug_level"); + $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -t $test -ORBdebuglevel $debug_level"); + $server_status = $SV->Spawn (); + + print "\n\n\n====== START TEST $test/4 ======\n\n\n"; + + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; + } + + if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + + if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; + } + + $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + + if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; + } + + $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + + if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; + } + $server->DeleteFile($iorbase); + $client->DeleteFile($iorbase); } $server->GetStderrLog(); diff --git a/TAO/tests/ZIOP/server.cpp b/TAO/tests/ZIOP/server.cpp index 7af7f1885c0..66ced845c6e 100644 --- a/TAO/tests/ZIOP/server.cpp +++ b/TAO/tests/ZIOP/server.cpp @@ -5,6 +5,8 @@ #include "ace/OS_NS_stdio.h" #include "tao/ZIOP/ZIOP.h" #include "tao/Compression/zlib/ZlibCompressor_Factory.h" +#include "tao/Compression/bzip2/Bzip2Compressor_Factory.h" +#include "TestCompressor/TestCompressor_Factory.h" #include "tao/Policy_ManagerC.h" #include "tao/Policy_CurrentC.h" #include "tao/Transport.h" @@ -14,12 +16,12 @@ ACE_RCSID (Hello, "$Id$") const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior"); -Compression::CompressionLevel level = 6; +int test = 1; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:l:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:t:")); int c; while ((c = get_opts ()) != -1) @@ -28,8 +30,8 @@ parse_args (int argc, ACE_TCHAR *argv[]) case 'o': ior_output_file = get_opts.opt_arg (); break; - case 'l': - level = ACE_OS::atoi (get_opts.opt_arg ()); + case 't': + test = ACE_OS::atoi (get_opts.opt_arg ()); break; case '?': @@ -46,117 +48,182 @@ parse_args (int argc, ACE_TCHAR *argv[]) } int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +register_factories (CORBA::ORB_ptr orb) { - try + CORBA::Object_var compression_manager = + orb->resolve_initial_references("CompressionManager"); + + ::Compression::CompressionManager_var manager = + ::Compression::CompressionManager::_narrow (compression_manager.in ()); + + if (CORBA::is_nil(manager.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil compression manager\n"), + 1); + //register Zlib compressor + ::Compression::CompressorFactory_ptr compressor_factory; + ACE_NEW_RETURN (compressor_factory, TAO::Zlib_CompressorFactory (), 1); + ::Compression::CompressorFactory_var compr_fact = compressor_factory; + manager->register_factory(compr_fact.in ()); + + // register bzip2 compressor + ACE_NEW_RETURN (compressor_factory, TAO::Bzip2_CompressorFactory (), 1); + compr_fact = compressor_factory; + manager->register_factory(compr_fact.in ()); + + // register test compressor + ACE_NEW_RETURN (compressor_factory, TAO::Test_CompressorFactory (), 1); + compr_fact = compressor_factory; + manager->register_factory(compr_fact.in ()); + + return 0; +} + +CORBA::Policy_ptr +create_compressor_id_level_list_policy (CORBA::ORB_ptr orb) +{ + ::Compression::CompressorIdLevelList compressor_id_list; + + if (test == 2) { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv); + compressor_id_list.length(1); + compressor_id_list[0].compressor_id = COMPRESSORID_FOR_TESTING; + compressor_id_list[0].compression_level = 5; + } + else + { + compressor_id_list.length(3); + compressor_id_list[0].compressor_id = ::Compression::COMPRESSORID_BZIP2; + compressor_id_list[0].compression_level = 5; + compressor_id_list[1].compressor_id = ::Compression::COMPRESSORID_ZLIB; + compressor_id_list[1].compression_level = 5; + compressor_id_list[2].compressor_id = COMPRESSORID_FOR_TESTING; + compressor_id_list[2].compression_level = 5; + } - CORBA::Object_var compression_manager = - orb->resolve_initial_references("CompressionManager"); + CORBA::Any compressor_id_any; + compressor_id_any <<= compressor_id_list; - Compression::CompressionManager_var manager = - Compression::CompressionManager::_narrow (compression_manager.in ()); + return orb->create_policy (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID, compressor_id_any); +} - if (CORBA::is_nil(manager.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Panic: nil compression manager\n"), - 1); +CORBA::Policy_ptr +create_low_value_policy (CORBA::ORB_ptr orb) +{ + // Setting policy for minimum amount of bytes that needs to be + // compressed. If a message is smaller than this, it doesn't get + // compressed + CORBA::ULong compression_low_value = 100; + CORBA::Any low_value_any; + low_value_any <<= compression_low_value; + + return orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, low_value_any); +} - Compression::CompressorFactory_ptr compressor_factory; +CORBA::Policy_ptr +create_compression_enabled_policy (CORBA::ORB_ptr orb) +{ + // Setting policy whether compression is used. + CORBA::Boolean compression_enabling = true; + CORBA::Any compression_enabling_any; + compression_enabling_any <<= CORBA::Any::from_boolean(compression_enabling); - ACE_NEW_RETURN (compressor_factory, TAO::Zlib_CompressorFactory (), 1); + return orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); +} - Compression::CompressorFactory_var compr_fact = compressor_factory; - manager->register_factory(compr_fact.in ()); +CORBA::Policy_ptr +create_min_ratio_policy (CORBA::ORB_ptr orb) +{ + CORBA::Any min_compression_ratio_any; + CORBA::Long min_compression_ratio = 75; + min_compression_ratio_any <<= min_compression_ratio; - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); + return orb->create_policy (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID, min_compression_ratio_any); +} - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in ()); +Test::Hello_var +prepare_tests (CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) +{ + register_factories(orb); - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Panic: nil RootPOA\n"), - 1); + CORBA::Object_var objectman = + orb->resolve_initial_references ("ORBPolicyManager"); - if (parse_args (argc, argv) != 0) - return 1; + CORBA::PolicyManager_var policy_manager = + CORBA::PolicyManager::_narrow (objectman.in ()); - Compression::CompressorIdLevelList compressor_id_list(2); - compressor_id_list.length(2); - compressor_id_list[0].compressor_id = Compression::COMPRESSORID_ZLIB; - compressor_id_list[0].compression_level = 6; - compressor_id_list[1].compressor_id = Compression::COMPRESSORID_BZIP2; - compressor_id_list[1].compression_level = 6; - - //Setting policy whether compression is used. - CORBA::Boolean compression_enabling = true; - CORBA::Any compression_enabling_any; - compression_enabling_any <<= CORBA::Any::from_boolean(compression_enabling); - - //Setting policy for minimum amount of bytes that needs to be - //compressed. If a message is smaller than this, it doesn't get - //compressed - CORBA::ULong compression_low_value = 100; - CORBA::Any low_value_any; - low_value_any <<= compression_low_value; - - CORBA::Any min_compression_ratio_any; - CORBA::Long min_compression_ratio = 40; - min_compression_ratio_any <<= min_compression_ratio; - - CORBA::Any compressor_id_any; - compressor_id_any <<= compressor_id_list; - - PortableServer::POA_var my_compress_poa = 0; - CORBA::PolicyList policies(4); - policies.length(4); - - try { - policies[0] = orb->create_policy (ZIOP::COMPRESSION_ENABLING_POLICY_ID, compression_enabling_any); - policies[1] = orb->create_policy (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID, compressor_id_any); - policies[2] = orb->create_policy (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID, low_value_any); - policies[3] = orb->create_policy (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID, min_compression_ratio_any); - my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies); - } - catch(const CORBA::PolicyError&) { - policies.length(0); - my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies); - } + PortableServer::POA_var my_compress_poa = 0; + CORBA::PolicyList policies(4); + policies.length(4); - CORBA::Object_var objectman = - orb->resolve_initial_references ("ORBPolicyManager"); + try + { + policies[0] = create_compressor_id_level_list_policy (orb); + policies[1] = create_low_value_policy (orb); + policies[2] = create_compression_enabled_policy (orb); + policies[3] = create_min_ratio_policy (orb); - CORBA::PolicyManager_var policy_manager = - CORBA::PolicyManager::_narrow (objectman.in ()); + my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies); + } + catch(const CORBA::PolicyError&) + { + policies.length(0); + my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies); + } - policy_manager->set_policy_overrides (policies, CORBA::ADD_OVERRIDE); + policy_manager->set_policy_overrides (policies, CORBA::ADD_OVERRIDE); - CORBA::Object_var pcobject = - orb->resolve_initial_references ("PolicyCurrent"); + CORBA::Object_var pcobject = + orb->resolve_initial_references ("PolicyCurrent"); - CORBA::PolicyCurrent_var policy_current = - CORBA::PolicyCurrent::_narrow (pcobject.in ()); + CORBA::PolicyCurrent_var policy_current = + CORBA::PolicyCurrent::_narrow (pcobject.in ()); - policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE); + policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE); - PortableServer::POAManager_var poa_manager = my_compress_poa->the_POAManager (); + PortableServer::POAManager_var poa_manager = my_compress_poa->the_POAManager (); - Hello *hello_impl = 0; - ACE_NEW_RETURN (hello_impl, - Hello (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(hello_impl); + Hello *hello_impl = 0; + ACE_NEW_RETURN (hello_impl, + Hello (orb), + 0); + PortableServer::ServantBase_var owner_transfer(hello_impl); + + PortableServer::ObjectId_var id = + my_compress_poa->activate_object (hello_impl); - PortableServer::ObjectId_var id = - my_compress_poa->activate_object (hello_impl); + CORBA::Object_var object = my_compress_poa->id_to_reference (id.in ()); - CORBA::Object_var object = my_compress_poa->id_to_reference (id.in ()); + Test::Hello_var hello = Test::Hello::_narrow (object.in ()); - Test::Hello_var hello = Test::Hello::_narrow (object.in ()); + poa_manager->activate (); + + return hello._retn (); +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + if (parse_args (argc, argv) != 0) + return 1; + + Test::Hello_var hello = prepare_tests (orb.in (), root_poa.in ()); CORBA::String_var ior = orb->object_to_string (hello.in ()); @@ -170,8 +237,6 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); - poa_manager->activate (); - orb->run (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); diff --git a/TAO/tests/ZIOP/testcompressor.mpb b/TAO/tests/ZIOP/testcompressor.mpb new file mode 100644 index 00000000000..61329e7cdb6 --- /dev/null +++ b/TAO/tests/ZIOP/testcompressor.mpb @@ -0,0 +1,6 @@ +// -*- MPC -*- +// $Id$ + +project : taolib, compression { + libs += TAO_TestCompressor +} diff --git a/TAO/utils/NamingViewer/AddNameServerDlg.cpp b/TAO/utils/NamingViewer/AddNameServerDlg.cpp index 0f4be971cb7..556de52aaca 100644 --- a/TAO/utils/NamingViewer/AddNameServerDlg.cpp +++ b/TAO/utils/NamingViewer/AddNameServerDlg.cpp @@ -44,7 +44,11 @@ END_MESSAGE_MAP() void CAddNameServerDlg::OnOK() { - // TODO: Add extra validation here UpdateData(); + if (m_Name.Trim() == _T("")) // Is a particular field still empty? + { + AfxMessageBox(_T("Please enter a server name")); + return; + } CDialog::OnOK(); } diff --git a/TAO/utils/NamingViewer/BindDialog.cpp b/TAO/utils/NamingViewer/BindDialog.cpp index 701e718da7d..8c578e672c9 100644 --- a/TAO/utils/NamingViewer/BindDialog.cpp +++ b/TAO/utils/NamingViewer/BindDialog.cpp @@ -54,7 +54,7 @@ void CBindDialog::OnViewior() try { UpdateData(); - m_Object = m_pORB->string_to_object(ACE_TEXT_ALWAYS_CHAR (m_IOR)); + m_Object = m_pORB->string_to_object(m_IOR); } catch(CORBA::Exception& ex) { @@ -91,7 +91,7 @@ void CBindDialog::OnOK() m_Name[0].kind = CORBA::string_dup(ACE_TEXT_ALWAYS_CHAR (m_Kind)); try { - m_Object = m_pORB->string_to_object(ACE_TEXT_ALWAYS_CHAR (m_IOR)); + m_Object = m_pORB->string_to_object(m_IOR); } catch(CORBA::Exception& ex) { diff --git a/TAO/utils/NamingViewer/NamingTreeCtrl.cpp b/TAO/utils/NamingViewer/NamingTreeCtrl.cpp index 229c07741ea..f967a042b23 100644 --- a/TAO/utils/NamingViewer/NamingTreeCtrl.cpp +++ b/TAO/utils/NamingViewer/NamingTreeCtrl.cpp @@ -302,12 +302,12 @@ void CNamingTreeCtrl::OnContextPopupBindContext() { CNamingObject* pObject = GetTreeObject(); CosNaming::NamingContext_var Context = pObject->NamingContext(); - if(CORBA::is_nil(Context)) + if(CORBA::is_nil(Context.in ())) { return; } CosNaming::NamingContext_var NewContext = CosNaming::NamingContext::_narrow(Dialog.GetObject()); - if(CORBA::is_nil(NewContext)) + if(CORBA::is_nil(NewContext.in ())) { AfxMessageBox(ACE_TEXT ("Object is not a CosNaming::NamingContext")); return; @@ -334,7 +334,7 @@ void CNamingTreeCtrl::OnContextPopupBindobject() HTREEITEM hItem = GetSelectedItem(); CNamingObject* pObject = GetTreeObject(hItem); CosNaming::NamingContext_var Context = pObject->NamingContext(); - if(CORBA::is_nil(Context)) + if(CORBA::is_nil(Context.in ())) { return; } @@ -363,7 +363,7 @@ void CNamingTreeCtrl::OnContextpopupBindnewcontext() HTREEITEM hItem = GetSelectedItem(); CNamingObject* pObject = GetTreeObject(hItem); CosNaming::NamingContext_var Context = pObject->NamingContext(); - if(CORBA::is_nil(Context)) + if(CORBA::is_nil(Context.in ())) { return; } @@ -374,8 +374,7 @@ void CNamingTreeCtrl::OnContextpopupBindnewcontext() } try { - CosNaming::NamingContext_var NewContext; - NewContext = Context->new_context(); + CosNaming::NamingContext_var NewContext = Context->new_context(); Context->bind_context(Dialog.GetName(), NewContext); OnContextPopupRefresh(); } diff --git a/TAO/utils/NamingViewer/NamingViewer.cpp b/TAO/utils/NamingViewer/NamingViewer.cpp index fa7a746e494..b9e71b0c68f 100644 --- a/TAO/utils/NamingViewer/NamingViewer.cpp +++ b/TAO/utils/NamingViewer/NamingViewer.cpp @@ -65,14 +65,12 @@ BOOL CNamingViewerApp::InitInstance() ACE::init(); { - - int argc = Argv.argc(); - ACE_Argv_Type_Converter argcon (argc, Argv.argv ()); - CORBA::ORB_var ORB = CORBA::ORB_init(argcon.get_argc (), - argcon.get_ASCII_argv ()); + int argc = Argv.argc (); + CORBA::ORB_var ORB = CORBA::ORB_init(argc, Argv.argv()); + CNamingViewerDlg dlg(ORB); m_pMainWnd = &dlg; - int nResponse = dlg.DoModal(); + int const nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is diff --git a/TAO/utils/NamingViewer/SelectNSDialog.cpp b/TAO/utils/NamingViewer/SelectNSDialog.cpp index 9190d677d17..fe343ce44b2 100644 --- a/TAO/utils/NamingViewer/SelectNSDialog.cpp +++ b/TAO/utils/NamingViewer/SelectNSDialog.cpp @@ -85,7 +85,7 @@ void CSelectNSDialog::OnAdd() void CSelectNSDialog::OnRemove() { // TODO: Add your control notification handler code here - int index = m_Servers.GetCurSel(); + int const index = m_Servers.GetCurSel(); if(index == LB_ERR) { return; @@ -119,7 +119,7 @@ BOOL CSelectNSDialog::OnInitDialog() ACE_OS::strcpy(pIOR, value.c_str()); m_Servers.SetItemData(pos, (DWORD)pIOR); } - index++; + ++index; } return TRUE; // return TRUE unless you set the focus to a control @@ -131,7 +131,7 @@ void CSelectNSDialog::OnDestroy() CDialog::OnDestroy(); // TODO: Add your message handler code here - int count = m_Servers.GetCount(); + int const count = m_Servers.GetCount(); for(int i=0; i < count; i++) { delete (char*)m_Servers.GetItemData(i); diff --git a/TAO/utils/NamingViewer/ViewIORDialog.cpp b/TAO/utils/NamingViewer/ViewIORDialog.cpp index 7b84bb745c8..e1c645d0788 100644 --- a/TAO/utils/NamingViewer/ViewIORDialog.cpp +++ b/TAO/utils/NamingViewer/ViewIORDialog.cpp @@ -69,7 +69,7 @@ void ViewIORDialog::OnApply() UpdateData(); try { - m_Object = m_pORB->string_to_object(ACE_TEXT_ALWAYS_CHAR (m_IOR)); + m_Object = m_pORB->string_to_object(m_IOR); DecodeIOR(); } catch(CORBA::Exception& ex) @@ -99,7 +99,7 @@ void ViewIORDialog::DecodeIOR() // Iterate through each profile and add an entry to the tree control const TAO_MProfile& BaseProfiles= pStub->base_profiles(); - CORBA::ULong Count = BaseProfiles.profile_count(); + CORBA::ULong const Count = BaseProfiles.profile_count(); for(CORBA::ULong Slot = 0; Slot < Count; Slot++) { const TAO_Profile* pProfile = BaseProfiles.get_profile(Slot); diff --git a/TAO/utils/catior/catior.cpp b/TAO/utils/catior/catior.cpp index 9174ca73711..22c74119721 100644 --- a/TAO/utils/catior/catior.cpp +++ b/TAO/utils/catior/catior.cpp @@ -21,6 +21,7 @@ #include "tao/Messaging_PolicyValueC.h" #include "tao/Messaging/Messaging_TypesC.h" #include "tao/ZIOP/ZIOP.h" +#include "tao/Compression/Compression.h" #include "tao/RTCORBA/RTCORBA.h" #include "tao/AnyTypeCode/Marshal.h" #include "tao/IIOP_Profile.h" @@ -84,7 +85,7 @@ catiiop (char* string) CORBA::UShort port_number; char *cp = ACE_OS::strchr (string, ':'); - if (cp == 0) + if (!cp) { throw CORBA::DATA_CONVERSION (); } @@ -101,7 +102,7 @@ catiiop (char* string) cp = ACE_OS::strchr ((char *) string, '/'); - if (cp == 0) + if (!cp) { throw CORBA::DATA_CONVERSION (); } @@ -235,7 +236,7 @@ catior (char const * str) continue_decoding = stream.read_ulong (profiles); // Get the count of profiles that follow. - if (continue_decoding == 0) + if (!continue_decoding) { ACE_DEBUG ((LM_DEBUG, "cannot read the profile count\n")); @@ -264,7 +265,7 @@ catior (char const * str) continue_decoding = stream.read_ulong (tag); // Get the profile ID tag. - if (continue_decoding == 0) + if (!continue_decoding) { ACE_DEBUG ((LM_DEBUG, "cannot read profile tag\n")); @@ -356,7 +357,7 @@ catpoop (char* string) char *cp = ACE_OS::strchr (string, ':'); - if (cp == 0) + if (!cp) { throw CORBA::DATA_CONVERSION (); } @@ -744,7 +745,7 @@ ACE_TMAIN (int argcw, ACE_TCHAR *argvw[]) "\nhere is the IOR\n%C\n\n", aString.rep ())); - char* str; + char* str = 0; if (aString.find ("IOR:") == 0) { ACE_DEBUG ((LM_DEBUG, @@ -899,7 +900,7 @@ ACE_TMAIN (int argcw, ACE_TCHAR *argvw[]) "\nhere is the IOR\n%C\n\n", aString.rep ())); - char* str; + char* str = 0; if (aString.find ("IOR:") == 0) { ACE_DEBUG ((LM_DEBUG, @@ -986,7 +987,7 @@ ACE_TMAIN (int argcw, ACE_TCHAR *argvw[]) CORBA::Boolean cat_tag_orb_type (TAO_InputCDR& stream) { CORBA::ULong length = 0; - if (stream.read_ulong (length) == 0) + if (!(stream.read_ulong (length))) return true; TAO_InputCDR stream2 (stream, length); @@ -1065,14 +1066,15 @@ CORBA::Boolean cat_tao_tag_endpoints (TAO_InputCDR& stream) { CORBA::ULong length = 0; - if (stream.read_ulong (length) == 0) - return 1; + if (!(stream.read_ulong (length))) + return true; TAO_InputCDR stream2 (stream, length); stream.skip_bytes(length); TAO::IIOPEndpointSequence epseq; - stream2 >> epseq; + if (!(stream2 >> epseq)) + return true; for (unsigned int iter=0; iter < epseq.length() ; iter++) { ACE_DEBUG ((LM_DEBUG, @@ -1093,33 +1095,40 @@ cat_tao_tag_endpoints (TAO_InputCDR& stream) CORBA::Boolean cat_tag_alternate_endpoints (TAO_InputCDR& stream) { CORBA::ULong length = 0; - if (stream.read_ulong (length) == 0) - return 1; + if (!(stream.read_ulong (length))) + return true; TAO_InputCDR stream2 (stream, length); stream.skip_bytes(length); CORBA::String_var host; CORBA::UShort port; - if ((stream2 >> host.out()) == 0 || - (stream2 >> port) == 0) - ACE_ERROR_RETURN ((LM_ERROR,"cannot extract endpoint info\n"),0); - ACE_DEBUG ((LM_DEBUG, - "%I endpoint: %C:%d\n", host.in(), port)); - return 1; + if (!(stream2 >> host.out() || + !(stream2 >> port))) + { + ACE_ERROR_RETURN ((LM_ERROR,"cannot extract endpoint info\n"),false); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "%I endpoint: %C:%d\n", host.in(), port)); + } + + return true; } CORBA::Boolean cat_tag_policies (TAO_InputCDR& stream) { CORBA::ULong length = 0; - if (stream.read_ulong (length) == 0) - return 1; + if (!(stream.read_ulong (length))) + return true; TAO_InputCDR stream2 (stream, length); stream.skip_bytes(length); Messaging::PolicyValueSeq policies; - stream2 >> policies; + if (!(stream2 >> policies)) + return true; ACE_DEBUG ((LM_DEBUG, "%I Number of policies: %d\n", @@ -1135,7 +1144,7 @@ cat_tag_policies (TAO_InputCDR& stream) { CORBA::Boolean byte_order; if (!(stream3 >> ACE_InputCDR::to_boolean (byte_order))) - return 1; + return true; stream3.reset_byte_order (static_cast <int> (byte_order)); @@ -1148,8 +1157,10 @@ cat_tag_policies (TAO_InputCDR& stream) { RTCORBA::PriorityModel priority_model; RTCORBA::Priority server_priority; - stream3 >> priority_model; - stream3 >> server_priority; + if (!(stream3 >> priority_model)) + return true; + if (!(stream3 >> server_priority)) + return true; if (priority_model == RTCORBA::CLIENT_PROPAGATED) { ACE_DEBUG ((LM_DEBUG,"%I\t Priority Model: %d (CLIENT_PROPAGATED)\n", @@ -1244,12 +1255,13 @@ cat_tag_policies (TAO_InputCDR& stream) { policies[iter].ptype)); ::Compression::CompressorIdLevelList idlist; if (!(stream3 >> idlist)) - return 1; + return true; CORBA::ULong index = 0; for (; index < idlist.length(); index++) { - ACE_DEBUG ((LM_DEBUG,"%I\t CompressorId: %d Level: %d\n", - idlist[index].compressor_id, idlist[index].compression_level)); + ACE_DEBUG ((LM_DEBUG,"%I\t CompressorId: %C Level: %d\n", + TAO_ZIOP_Loader::ziop_compressorid_name(idlist[index].compressor_id), + idlist[index].compression_level)); } } else if (policies[iter].ptype == ZIOP::COMPRESSION_ENABLING_POLICY_ID) { ACE_DEBUG ((LM_DEBUG, @@ -1257,7 +1269,8 @@ cat_tag_policies (TAO_InputCDR& stream) { iter+1, policies[iter].ptype)); CORBA::Boolean status; - stream3 >> ACE_InputCDR::to_boolean (status); + if (!(stream3 >> ACE_InputCDR::to_boolean (status))) + return true; ACE_DEBUG ((LM_DEBUG,"%I\t Enabled: %d\n", status)); } else { @@ -1267,7 +1280,7 @@ cat_tag_policies (TAO_InputCDR& stream) { } } - return 1; + return true; } CORBA::Boolean @@ -1324,7 +1337,7 @@ cat_tag_ssl_sec_trans (TAO_InputCDR& cdr) { */ CORBA::ULong length = 0; - if (cdr.read_ulong (length) == 0) + if (!(cdr.read_ulong (length))) return false; TAO_InputCDR stream (cdr, length); @@ -1987,7 +2000,7 @@ cat_nsk_profile_helper (TAO_InputCDR& stream, // Get address char* fsaddress; - if ((str >> fsaddress) == 0) + if (!(str >> fsaddress)) { ACE_DEBUG ((LM_DEBUG, "%I problem decoding file system address\n")); |