diff options
author | fhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-05-15 15:16:02 +0000 |
---|---|---|
committer | fhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-05-15 15:16:02 +0000 |
commit | 7cbd8169257ca780bf12d35fe33de08b77f40fec (patch) | |
tree | 609710ab76d9071bbcef4c11755b8a41bc4f1e9b /TAO/examples | |
parent | cf4e904b4363785f8831fa64b1d7508350f37799 (diff) | |
download | ATCD-7cbd8169257ca780bf12d35fe33de08b77f40fec.tar.gz |
Tue Apr 15 10:10:10 2001 Frank Hunleth <fhunleth@cs.wustl.edu>
Diffstat (limited to 'TAO/examples')
17 files changed, 149 insertions, 54 deletions
diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP.cpp b/TAO/examples/PluggableUDP/DIOP/DIOP.cpp new file mode 100644 index 00000000000..2cc260e65cb --- /dev/null +++ b/TAO/examples/PluggableUDP/DIOP/DIOP.cpp @@ -0,0 +1,13 @@ +// $Id$ + +#include "DIOP.h" +#include "DIOP_Factory.h" + +ACE_RCSID(TAO_DIOP, DIOP_Factory, "$Id$") + +TAO_DIOP_Protocol_Factory_Adder::TAO_DIOP_Protocol_Factory_Adder (void) +{ + ACE_Service_Config::static_svcs ()-> + insert (&ace_svc_desc_TAO_DIOP_Protocol_Factory); +} + diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP.h b/TAO/examples/PluggableUDP/DIOP/DIOP.h new file mode 100644 index 00000000000..fff1804127a --- /dev/null +++ b/TAO/examples/PluggableUDP/DIOP/DIOP.h @@ -0,0 +1,39 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DIOP.h + * + * $Id$ + * + * This file is used to force DIOP to be linked in and initialized in + * static builds. The application has to include this file in at least + * one source file so that a static class instance can be initialized + * and force the rest of DIOP into the executable. + * + * @author Frank Hunleth <fhunleth@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef TAO_DIOP_H +#define TAO_DIOP_H +#include "ace/pre.h" +#include "diop_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_DIOP_Export TAO_DIOP_Protocol_Factory_Adder +{ +public: + TAO_DIOP_Protocol_Factory_Adder (void); +}; + +// Static instances that will force everything in DIOP to be pulled in. +static TAO_DIOP_Protocol_Factory_Adder TAO_DIOP_adder; + +#include "ace/post.h" +#endif /* TAO_DIOP_FACTORY_H */ + diff --git a/TAO/examples/PluggableUDP/DIOP/Makefile b/TAO/examples/PluggableUDP/DIOP/Makefile index 4a0f9955d31..9161912047b 100644 --- a/TAO/examples/PluggableUDP/DIOP/Makefile +++ b/TAO/examples/PluggableUDP/DIOP/Makefile @@ -30,6 +30,7 @@ CPP_SRCS += \ DIOP_Acceptor \ DIOP_Connection_Handler \ DIOP_Endpoint \ + DIOP IDL_SRC = \ $(addsuffix S.cpp, $(IDL_FILES)) \ diff --git a/TAO/examples/PluggableUDP/DIOP/TAO_DIOP.dsp b/TAO/examples/PluggableUDP/DIOP/TAO_DIOP.dsp index d141c19ff21..5bf8c6c2d21 100644 --- a/TAO/examples/PluggableUDP/DIOP/TAO_DIOP.dsp +++ b/TAO/examples/PluggableUDP/DIOP/TAO_DIOP.dsp @@ -94,6 +94,10 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE=.\DIOP.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\DIOP_Acceptor.cpp
# End Source File
# Begin Source File
@@ -126,6 +130,10 @@ SOURCE=.\DIOP_Transport.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
+SOURCE=.\DIOP.h
+# End Source File
+# Begin Source File
+
SOURCE=.\DIOP_Acceptor.h
# End Source File
# Begin Source File
diff --git a/TAO/examples/PluggableUDP/DIOP/TAO_DIOP_Static.dsp b/TAO/examples/PluggableUDP/DIOP/TAO_DIOP_Static.dsp index 1c04061945d..1ae24bf4812 100644 --- a/TAO/examples/PluggableUDP/DIOP/TAO_DIOP_Static.dsp +++ b/TAO/examples/PluggableUDP/DIOP/TAO_DIOP_Static.dsp @@ -91,6 +91,10 @@ LIB32=link.exe -lib # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE=.\DIOP.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\DIOP_Acceptor.cpp
# End Source File
# Begin Source File
@@ -123,6 +127,10 @@ SOURCE=.\DIOP_Transport.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
+SOURCE=.\DIOP.h
+# End Source File
+# Begin Source File
+
SOURCE=.\DIOP_Acceptor.h
# End Source File
# Begin Source File
diff --git a/TAO/examples/PluggableUDP/tests/Basic/Makefile b/TAO/examples/PluggableUDP/tests/Basic/Makefile index 411fa345872..325b581e1a6 100644 --- a/TAO/examples/PluggableUDP/tests/Basic/Makefile +++ b/TAO/examples/PluggableUDP/tests/Basic/Makefile @@ -12,6 +12,8 @@ ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO endif # ! TAO_ROOT +LDLIBS = -lTAO_DIOP -lTAO_PortableServer -lTAO + IDL_FILES = UDP IDL_SRC = UDPC.cpp UDPS.cpp BIN = client server @@ -44,10 +46,10 @@ include $(TAO_ROOT)/taoconfig.mk .PRECIOUS: $(foreach ext, $(IDL_EXT), UDP$(ext)) server: $(addprefix $(VDIR),$(SERVER_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) client: $(addprefix $(VDIR),$(CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) realclean: clean -$(RM) $(foreach ext, $(IDL_EXT), UDP$(ext)) diff --git a/TAO/examples/PluggableUDP/tests/Basic/client.cpp b/TAO/examples/PluggableUDP/tests/Basic/client.cpp index f8ee478bb5d..8347d3e28d7 100644 --- a/TAO/examples/PluggableUDP/tests/Basic/client.cpp +++ b/TAO/examples/PluggableUDP/tests/Basic/client.cpp @@ -26,6 +26,10 @@ #include "ace/Get_Opt.h" #include "ace/Task.h" +// The following include file forces DIOP to be linked into the +// executable and initialized for static builds. +#include "examples/PluggableUDP/DIOP/DIOP.h" + ACE_RCSID(AMI, client, "$Id$") const char *ior = "file://test.ior"; diff --git a/TAO/examples/PluggableUDP/tests/Basic/server.cpp b/TAO/examples/PluggableUDP/tests/Basic/server.cpp index ce33a36ac6d..17a367a34ac 100644 --- a/TAO/examples/PluggableUDP/tests/Basic/server.cpp +++ b/TAO/examples/PluggableUDP/tests/Basic/server.cpp @@ -24,6 +24,10 @@ #include "ace/Get_Opt.h" +// The following include file forces DIOP to be linked into the +// executable and initialized for static builds. +#include "examples/PluggableUDP/DIOP/DIOP.h" + ACE_RCSID(AMI, server, "$Id$") const char *ior_output_file = "test.ior"; diff --git a/TAO/examples/PluggableUDP/tests/Basic/svc.conf b/TAO/examples/PluggableUDP/tests/Basic/svc.conf index 4d6eaae769e..61a11297918 100644 --- a/TAO/examples/PluggableUDP/tests/Basic/svc.conf +++ b/TAO/examples/PluggableUDP/tests/Basic/svc.conf @@ -1,3 +1,3 @@ -dynamic DIOP_Factory Service_Object * TAO_DIOP:_make_TAO_DIOP_Protocol_Factory() "" +static DIOP_Factory "" static Resource_Factory "-ORBProtocolFactory DIOP_Factory -ORBReactor tp" diff --git a/TAO/examples/PluggableUDP/tests/Performance/Makefile b/TAO/examples/PluggableUDP/tests/Performance/Makefile index 86bdb19f3a1..ac9a80dbc8a 100644 --- a/TAO/examples/PluggableUDP/tests/Performance/Makefile +++ b/TAO/examples/PluggableUDP/tests/Performance/Makefile @@ -12,6 +12,8 @@ ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO endif +LDLIBS = -lTAO_DIOP -lTAO_PortableServer -lTAO + IDL_FILES = UDP IDL_SRC = UDPC.cpp UDPS.cpp BIN = client server @@ -45,10 +47,10 @@ include $(TAO_ROOT)/taoconfig.mk .PRECIOUS: $(foreach ext, $(IDL_EXT), UDP$(ext)) server: $(addprefix $(VDIR),$(SERVER_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) client: $(addprefix $(VDIR),$(CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) realclean: clean -$(RM) $(foreach ext, $(IDL_EXT), UDP$(ext)) diff --git a/TAO/examples/PluggableUDP/tests/Performance/client.cpp b/TAO/examples/PluggableUDP/tests/Performance/client.cpp index 30cefa30e65..53f78352ad0 100644 --- a/TAO/examples/PluggableUDP/tests/Performance/client.cpp +++ b/TAO/examples/PluggableUDP/tests/Performance/client.cpp @@ -25,6 +25,10 @@ #include "UDP_i.h" #include "UDP_PerformanceClient.h" +// The following include file forces DIOP to be linked into the +// executable and initialized for static builds. +#include "examples/PluggableUDP/DIOP/DIOP.h" + ACE_RCSID(Performance, client, "$Id$") const char *ior = "file://test.ior"; @@ -97,7 +101,7 @@ main (int argc, char *argv[]) } // Activate POA to handle the call back. - + CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -106,7 +110,7 @@ main (int argc, char *argv[]) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); - + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV); ACE_TRY_CHECK; @@ -137,7 +141,7 @@ main (int argc, char *argv[]) // let the client run in a separate thread client->activate (); - + // ORB loop, will be shut down by our client thread orb->run (ACE_TRY_ENV); // Fetch responses ACE_TRY_CHECK; @@ -146,16 +150,16 @@ main (int argc, char *argv[]) root_poa->destroy (1, // ethernalize objects 0, // wait for completion - ACE_TRY_ENV); + ACE_TRY_ENV); ACE_TRY_CHECK; - orb->destroy (ACE_TRY_ENV); + orb->destroy (ACE_TRY_ENV); ACE_TRY_CHECK; // it is save to delete the client, because the client was actually // the one calling orb->shutdown () triggering the end of the ORB // event loop. - delete client; + delete client; } ACE_CATCHANY diff --git a/TAO/examples/PluggableUDP/tests/Performance/server.cpp b/TAO/examples/PluggableUDP/tests/Performance/server.cpp index 2fa7c062852..fbca03c2475 100644 --- a/TAO/examples/PluggableUDP/tests/Performance/server.cpp +++ b/TAO/examples/PluggableUDP/tests/Performance/server.cpp @@ -23,6 +23,10 @@ #include "UDP_i.h" +// The following include file forces DIOP to be linked into the +// executable and initialized for static builds. +#include "examples/PluggableUDP/DIOP/DIOP.h" + ACE_RCSID(Performance, server, "$Id$") @@ -184,7 +188,7 @@ main (int argc, char *argv[]) ACE_Thread_Manager::instance ()->spawn_n (orb_threads-1, svc, orb.in ()); - + orb->run (ACE_TRY_ENV); ACE_TRY_CHECK; @@ -192,10 +196,10 @@ main (int argc, char *argv[]) root_poa->destroy (1, // ethernalize objects 0, // wait for completion - ACE_TRY_ENV); + ACE_TRY_ENV); ACE_TRY_CHECK; - orb->destroy (ACE_TRY_ENV); + orb->destroy (ACE_TRY_ENV); ACE_TRY_CHECK; ACE_Thread_Manager::instance ()->wait (); diff --git a/TAO/examples/PluggableUDP/tests/Performance/svc.conf b/TAO/examples/PluggableUDP/tests/Performance/svc.conf index 19b1a042420..61a11297918 100644 --- a/TAO/examples/PluggableUDP/tests/Performance/svc.conf +++ b/TAO/examples/PluggableUDP/tests/Performance/svc.conf @@ -1,5 +1,3 @@ - - -dynamic DIOP_Factory Service_Object * TAO_DIOP:_make_TAO_DIOP_Protocol_Factory() "" -static Resource_Factory "-ORBReactorType tp -ORBProtocolFactory DIOP_Factory" +static DIOP_Factory "" +static Resource_Factory "-ORBProtocolFactory DIOP_Factory -ORBReactor tp" diff --git a/TAO/examples/PluggableUDP/tests/SimplePerformance/Makefile b/TAO/examples/PluggableUDP/tests/SimplePerformance/Makefile index 711ebab91eb..cc63dddaba5 100644 --- a/TAO/examples/PluggableUDP/tests/SimplePerformance/Makefile +++ b/TAO/examples/PluggableUDP/tests/SimplePerformance/Makefile @@ -12,6 +12,8 @@ ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO endif # ! TAO_ROOT +LDLIBS = -lTAO_DIOP -lTAO_PortableServer -lTAO + IDL_FILES = test IDL_SRC = testC.cpp testS.cpp BIN = client server @@ -44,10 +46,10 @@ include $(TAO_ROOT)/taoconfig.mk .PRECIOUS: $(foreach ext, $(IDL_EXT), test$(ext)) server: $(addprefix $(VDIR),$(SERVER_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) client: $(addprefix $(VDIR),$(CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) realclean: clean -$(RM) $(foreach ext, $(IDL_EXT), test$(ext)) diff --git a/TAO/examples/PluggableUDP/tests/SimplePerformance/client.cpp b/TAO/examples/PluggableUDP/tests/SimplePerformance/client.cpp index 3105ac1eff2..e872b500ebe 100644 --- a/TAO/examples/PluggableUDP/tests/SimplePerformance/client.cpp +++ b/TAO/examples/PluggableUDP/tests/SimplePerformance/client.cpp @@ -21,10 +21,14 @@ #include "ace/High_Res_Timer.h" #include "testC.h" +// The following include file forces DIOP to be linked into the +// executable and initialized for static builds. +#include "examples/PluggableUDP/DIOP/DIOP.h" + #if defined (VXWORKS) # undef ACE_MAIN # define ACE_MAIN testClient -#endif +#endif const char *iorFile = "file://test.ior"; ACE_UINT32 niter = 10; @@ -33,7 +37,7 @@ ACE_UINT32 SIZE_BLOCK= 256; class Client { // = TITLE - // Run the client thread + // Run the client thread // // = DESCRIPTION // Use the ACE_Task_Base class to run the client threads. @@ -60,10 +64,10 @@ private: int main (int argc, char *argv[]) { ACE_TRY_NEW_ENV - { + { CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, + argv, "ORB_Test_Client", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -85,14 +89,14 @@ int main (int argc, char *argv[]) } CORBA::String_var string = - orb->object_to_string (server.in (), + orb->object_to_string (server.in (), ACE_TRY_ENV); ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Client: orb->object_to_string:\n%s\n", string.in ())); - + Client client (server.in (), niter); client.svc (); @@ -143,7 +147,7 @@ Client::svc (void) ACE_TRY_CHECK; timer.start (); - + ACE_UINT32 client_count = 0; for (ACE_UINT32 i = 0; i < this->niterations_; ++i) { @@ -164,15 +168,15 @@ Client::svc (void) //ACE_DEBUG ((LM_DEBUG, "...finished\n")); long dur = measured.sec () * 1000000 + measured.usec (); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Time for %u Msgs: %u usec \n", - this->niterations_, + this->niterations_, measured.sec () * 1000000 + measured.usec ())); - ACE_DEBUG ((LM_DEBUG, "Time for 1 Msg: %u usec, %u calls/sec\n", - dur / this->niterations_, + ACE_DEBUG ((LM_DEBUG, "Time for 1 Msg: %u usec, %u calls/sec\n", + dur / this->niterations_, 1000000 / (dur / this->niterations_))); - + server_->shutdown (ACE_TRY_ENV); ACE_TRY_CHECK; diff --git a/TAO/examples/PluggableUDP/tests/SimplePerformance/server.cpp b/TAO/examples/PluggableUDP/tests/SimplePerformance/server.cpp index 73817a544dc..14a16c0d000 100644 --- a/TAO/examples/PluggableUDP/tests/SimplePerformance/server.cpp +++ b/TAO/examples/PluggableUDP/tests/SimplePerformance/server.cpp @@ -21,23 +21,27 @@ #include "test_i.h" +// The following include file forces DIOP to be linked into the +// executable and initialized for static builds. +#include "examples/PluggableUDP/DIOP/DIOP.h" + #if defined (VXWORKS) # undef ACE_MAIN # define ACE_MAIN testServer -#endif +#endif const char *ior_output_file = "test.ior"; int main (int argc, char *argv[]) { ACE_TRY_NEW_ENV - { + { CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, + argv, "ORB_Test_Server", ACE_TRY_ENV); ACE_TRY_CHECK; - + CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -59,31 +63,31 @@ int main (int argc, char *argv[]) PortableServer::ObjectId_var oidServer = root_poa->activate_object (&server_impl, ACE_TRY_ENV); ACE_TRY_CHECK; - + CORBA::Object_var objOne = root_poa->id_to_reference (oidServer.in (), ACE_TRY_ENV); ACE_TRY_CHECK; Simple_Server_var server = Simple_Server::_narrow (objOne.in (), ACE_TRY_ENV); ACE_TRY_CHECK; - + CORBA::String_var ior = - orb->object_to_string (server.in (), ACE_TRY_ENV); + orb->object_to_string (server.in (), ACE_TRY_ENV); ACE_TRY_CHECK; ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) - { - 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); - } + { + 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); + } poa_manager->activate (ACE_TRY_ENV); ACE_TRY_CHECK; diff --git a/TAO/examples/PluggableUDP/tests/SimplePerformance/svc.conf b/TAO/examples/PluggableUDP/tests/SimplePerformance/svc.conf index 19b1a042420..61a11297918 100644 --- a/TAO/examples/PluggableUDP/tests/SimplePerformance/svc.conf +++ b/TAO/examples/PluggableUDP/tests/SimplePerformance/svc.conf @@ -1,5 +1,3 @@ - - -dynamic DIOP_Factory Service_Object * TAO_DIOP:_make_TAO_DIOP_Protocol_Factory() "" -static Resource_Factory "-ORBReactorType tp -ORBProtocolFactory DIOP_Factory" +static DIOP_Factory "" +static Resource_Factory "-ORBProtocolFactory DIOP_Factory -ORBReactor tp" |