diff options
Diffstat (limited to 'TAO/tests/Demux_Test')
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/Makefile | 316 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/README | 12 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/client.cpp | 39 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/gen.cpp | 173 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/impl.cpp | 72 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/objcreate.cpp | 51 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/perf.cpp | 21 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/skel.cpp | 217 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/stub.cpp | 155 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/tao.cpp | 96 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/CodeGen/tao.h | 21 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/Makefile | 65 | ||||
-rw-r--r-- | TAO/tests/Demux_Test/README | 20 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/client.cpp | 309 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/gen_bin | 6 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/make_all | 19 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/run_all_client | 37 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/run_all_server | 20 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/run_client | 17 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/run_server | 10 | ||||
-rwxr-xr-x | TAO/tests/Demux_Test/server.cpp | 313 |
21 files changed, 0 insertions, 1989 deletions
diff --git a/TAO/tests/Demux_Test/CodeGen/Makefile b/TAO/tests/Demux_Test/CodeGen/Makefile deleted file mode 100644 index 32ea3aaf73b..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/Makefile +++ /dev/null @@ -1,316 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile to compile the Demux application -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = tao -LIB = libtao.a -SHLIB = libtao.$(SOEXT) - -FILES = tao \ - gen \ - client \ - stub \ - skel \ - impl \ - perf \ - objcreate - -LSRC = $(addsuffix .cpp,$(FILES)) -LOBJ = $(addsuffix .o,$(FILES)) -SHOBJ = $(addsuffix .so,$(FILES)) - -LDLIBS = -ltao -LIBS = -lACE - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -#BUILD = $(VLIB) $(VSHLIB) $(SHLIBA) $(VBIN) -BUILD = $(VSHLIB) $(SHLIBA) $(VBIN) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Include macros and targets -# Local modifications to variables imported by includes above. -#---------------------------------------------------------------------------- - -CPPFLAGS += -DDEBUG - -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/tao.o .shobj/tao.so: tao.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/gen.o .shobj/gen.so: gen.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/client.o .shobj/client.so: client.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/stub.o .shobj/stub.so: stub.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/skel.o .shobj/skel.so: skel.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/impl.o .shobj/impl.so: impl.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/perf.o .shobj/perf.so: perf.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i -.obj/objcreate.o .shobj/objcreate.so: objcreate.cpp tao.h \ - $(WRAPPER_ROOT)/ace/SString.h \ - $(WRAPPER_ROOT)/ace/ACE.h \ - $(WRAPPER_ROOT)/ace/OS.h \ - $(WRAPPER_ROOT)/ace/config.h \ - $(WRAPPER_ROOT)/ace/stdcpp.h \ - $(WRAPPER_ROOT)/ace/OS.i \ - $(WRAPPER_ROOT)/ace/Trace.h \ - $(WRAPPER_ROOT)/ace/Log_Msg.h \ - $(WRAPPER_ROOT)/ace/Log_Record.h \ - $(WRAPPER_ROOT)/ace/Log_Priority.h \ - $(WRAPPER_ROOT)/ace/Log_Record.i \ - $(WRAPPER_ROOT)/ace/ACE.i \ - $(WRAPPER_ROOT)/ace/SString.i \ - $(WRAPPER_ROOT)/ace/Containers.h \ - $(WRAPPER_ROOT)/ace/Containers.i \ - $(WRAPPER_ROOT)/ace/Singleton.h \ - $(WRAPPER_ROOT)/ace/Synch.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ - $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ - $(WRAPPER_ROOT)/ace/Synch.i \ - $(WRAPPER_ROOT)/ace/Synch_T.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.h \ - $(WRAPPER_ROOT)/ace/Event_Handler.i \ - $(WRAPPER_ROOT)/ace/Synch_T.i \ - $(WRAPPER_ROOT)/ace/Thread.h \ - $(WRAPPER_ROOT)/ace/Thread.i \ - $(WRAPPER_ROOT)/ace/Singleton.i \ - $(WRAPPER_ROOT)/ace/Get_Opt.h \ - $(WRAPPER_ROOT)/ace/Get_Opt.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/Demux_Test/CodeGen/README b/TAO/tests/Demux_Test/CodeGen/README deleted file mode 100644 index 13fcae3c48f..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/README +++ /dev/null @@ -1,12 +0,0 @@ -This directory contains a code generator that will generate stubs and -skeletons for an interface called "tao_demux". The number of -operations in this interface is controlled by the -m option to the -executable "tao". - -Usage: - -tao -o <num of objs> -m < num of operations> - -The stubs and skeletons are for 2-way calls. The operation names and -object keys are automatically generated and have arbitrary string -names.
\ No newline at end of file diff --git a/TAO/tests/Demux_Test/CodeGen/client.cpp b/TAO/tests/Demux_Test/CodeGen/client.cpp deleted file mode 100644 index 9260285ce37..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/client.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "tao.h" - - -// Generate the client side include file "client.i". This file has a table of -// function pointers to the the different operations of the -// interface. Depending on the strategy chosen, we make appropriate calls - -long GenClientCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - fstream client_incl; - int i; - ACE_CString *str; - - client_incl.open("client.i", ios::out); - - for(i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - client_incl << "void " << str->rep() << "(tao_demux_ptr obj)" << endl; - client_incl << "{" << endl; - client_incl << "\tCORBA_Environment env;" << endl << endl; - client_incl << "\tobj->" << str->rep() << "(env);" << endl; - client_incl << "}" << endl; - } - client_incl << endl; - client_incl << "static const method_db mtbl[] = {" << endl; - for (i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - client_incl << "\t" << str->rep() << "," << endl; - } - client_incl << "};" << endl << endl; - client_incl.close(); -} - diff --git a/TAO/tests/Demux_Test/CodeGen/gen.cpp b/TAO/tests/Demux_Test/CodeGen/gen.cpp deleted file mode 100644 index ecc4fd5ce5a..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/gen.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include "tao.h" - -static long GenDistinctString(ACE_Unbounded_Queue<ACE_CString> &, int); -static long GenRand(int, int); -static long IsPresent(ACE_Unbounded_Queue<ACE_CString> &, int, ACE_CString &); -static ACE_CString CreateString(long); -static char GetVarChar(int); - -// object table generator -long GenObjectTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - int i,j,k; // indices - long rnd; // random number - int opt; - fstream arrfp; - ACE_CString *str; - - - // Generate "limit" distinct strings - for (i=0; i < limit; i++) - { - if (GenDistinctString(arr, i) == -1) // side effect: inserts a new string - return -1; // at locn i in array "arr" - } - - // write the strings into a file whose format will be understood by GPERF - arrfp.open("gperf_objects.dat",ios::out); - - arrfp << "struct object_db {" << endl; - arrfp << "\tchar *name; // name of method" << endl; - arrfp << "\tCORBA_Object_ptr obj; //fn pointer to obj impl" << endl; - arrfp << "};" << endl; - arrfp << "%%" << endl; - - for(i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - { - // error - return -1; - } - arrfp << str->rep() << ", " << "0" << endl; - // we do not know the addresses of the objects. We shall insert them - // later. - } - arrfp.close(); - return 0; -} - -// method table generator -long GenMethodTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - int i,j,k; // indices - long rnd; // random number - int opt; - fstream arrfp; - ACE_CString *str; - - - // Generate "limit" distinct strings - for (i=0; i < limit; i++){ - if (GenDistinctString(arr, i) == -1) // side effect: inserts a new string at locn i - return -1; // in array "arr" - } - - // write the strings into a file whose format will be understood by GPERF - arrfp.open("gperf_methods.dat",ios::out); - - arrfp << "struct method_db {" << endl; - arrfp << "\tchar *name; // name of method" << endl; - arrfp << "\tTAO_Skeleton skel_ptr; //fn pointer to skeleton" << endl; - arrfp << "};" << endl; - arrfp << "%%" << endl; - - for(i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - { - // error - return -1; - } - arrfp << (str->rep()) << ", " << "_skel_tao_demux::" << str->rep() << - "_skel" << endl; - } - arrfp.close(); - return 0; -} - - -// generate a distinct string and insert it at location "limit" -long GenDistinctString(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - int i, j; // indices - long rnd; - ACE_CString s; - long status; - - rnd = GenRand(3,32); // get a random number between 3 and 32 which will be - // used as a string length of the distinct string to be - // generated. We use 3-32 because certain function - // names such as _N, _C cause name conflicts. - // Continue generating strings until a distinct one not generated before - // is formed - do { - s = CreateString(rnd); - status = IsPresent (arr, limit, s); - if (status == -1) - return -1; - } while (status > 0); - - // save it at this location - if (arr.enqueue_tail(s) == -1) - { - return -1; - } - return 0; -} - -// generate a random number in the given limits -long GenRand(int low, int up) -{ - return (lrand48() % (up-low+1)) + low; // rnd will be the size of the -} - -// check if the given string is present in the array -long IsPresent(ACE_Unbounded_Queue<ACE_CString> &arr, int limit, ACE_CString &s) -{ - ACE_CString *str; - - if (!strcasecmp(s.rep(), "_is_a")) - return 1; - - for (int i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - if (!strcasecmp(str->rep(), s.rep())) - return 1; // they are same - } - return 0; // not present -} - -// create a string of length = len -ACE_CString CreateString(long len) -{ - int i; - ACE_CString s; - char ch; - - for (i=0; i < len; i++){ - ch = GetVarChar(i); - s += ACE_CString(&ch); - } - return s; -} - -// Generate a valid character for a C++ variable -char GetVarChar(int i) -{ - // for i == 0, we cannot return a digit as the first character - char ch; - while(1) { - ch = GenRand(48, 122); - if (isdigit(ch) || isupper(ch) || islower(ch) || (ch == '_')){ - if ((i == 0) && (isdigit(ch) || (ch == '_'))) - continue; - break; //otherwise - } - } - return ch; -} - diff --git a/TAO/tests/Demux_Test/CodeGen/impl.cpp b/TAO/tests/Demux_Test/CodeGen/impl.cpp deleted file mode 100644 index 6b3c7551558..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/impl.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "tao.h" - -// generate the implementation header -long GenServantHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - // generate the implementation class - fstream hdr; - int i; - ACE_CString *str; - - hdr.open("tao_demux_i.h", ios::out); - - hdr << "#if !defined(TAO_DEMUX_I_H)" << endl; - hdr << "#define TAO_DEMUX_I_H" << endl << endl; - - hdr << "#include \"tao_demuxS.h\"" << endl << endl; - - hdr << "class tao_demux_i: public virtual _skel_tao_demux" << endl; - hdr << "{" << endl; - hdr << "public:" << endl; - hdr << "\ttao_demux_i(char *obj_name);" << endl; - hdr << "\t~tao_demux_i();" << endl; - hdr << "\t//now all the methods" << endl; - - for(i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - return -1; - - hdr << "\tvoid " << str->rep() << - "(CORBA_Environment &env);" << endl; - } - hdr << "};" << endl; - - hdr << "#endif" << endl; -} - - -// generate the implementation -long GenServantImpl(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - // generate the implementation class - fstream impl; - int i; - ACE_CString *str; - - impl.open("tao_demux_i.cpp", ios::out); - - impl << "#include <iostream.h>" << endl; - impl << "#include \"tao_demux_i.h\"" << endl << endl; - - impl << "tao_demux_i::tao_demux_i(char *obj_name)" << endl; - impl << " :_skel_tao_demux(obj_name){}" << endl; - impl << "tao_demux_i::~tao_demux_i(){}" << endl; - impl << "\t//now all the methods" << endl; - - for(i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - return -1; - - impl << "void tao_demux_i::" << str->rep() << - "(CORBA_Environment &env)" << endl; - impl << "{" << endl; - impl << "#ifdef DEBUG" << endl; - impl << " cout << \"Object name = \" << this->_get_name(env) << " << - "\", Operation name = " << str->rep() << "\" << endl;" << endl; - impl << "#endif" << endl; - impl << "}" << endl << endl; - } -} - diff --git a/TAO/tests/Demux_Test/CodeGen/objcreate.cpp b/TAO/tests/Demux_Test/CodeGen/objcreate.cpp deleted file mode 100644 index e25dbd947d3..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/objcreate.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "tao.h" - -long GenObjectCreateCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - // code for creating objects. The strategy will be based on active demux or - // other strategies - fstream file; - int i; - ACE_CString *str; - - file.open("obj_create.i", ios::out); - - file << "\t if (params->demux_strategy() == " << - "TAO_OA_Parameters::TAO_ACTIVE_DEMUX){" << endl; - - for (i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - return -1; - - file << "\t\tmymux[" << i << "] = new tao_demux_i(\"" << i << "\");" << - endl; - file << "\t\tstr = orb_ptr->object_to_string(mymux[" << i << "], env);" - << endl; - file << "#ifdef DEBUG" << endl; - file << "\t\tcout << \"IOR = \" << (char *)str << endl;" << endl; - file << "#endif" << endl; - file << "\t\tiorfile << (char *)str << endl; " << endl; - file << "\t\tCORBA_string_free(str);" << endl; - } - file << "\t } else {" << endl; - for (i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - return -1; - - file << "\t\tmymux[" << i << "] = new tao_demux_i(CORBA_string_dup (\"" - << str->rep() << "\"));" << endl; - file << "\t\tstr = orb_ptr->object_to_string(mymux[" << i << "], env);" - << endl; - file << "#ifdef DEBUG" << endl; - file << "\t\tcout << \"IOR = \" << (char *)str << endl;" << endl; - file << "#endif" << endl; - file << "\t\tiorfile << (char *)str << endl; " << endl; - file << "\t\tCORBA_string_free(str);" << endl; - } - file << "\t }" << endl; - - file.close(); - return 0; -} diff --git a/TAO/tests/Demux_Test/CodeGen/perf.cpp b/TAO/tests/Demux_Test/CodeGen/perf.cpp deleted file mode 100644 index ccd2da961ff..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/perf.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "tao.h" - -void GenGPERFCode() -{ - char command[500]; - - // first generate code for object hash - sprintf(command, - "gperf -c -C -D -E -T -f 0 -a -o -t -p -L C++ -Z Method_Hash %s >\ -gperf_method.i", "gperf_methods.dat"); - system(command); - - // omit the -C switch for gperf because we will not know the address of the - // objects until they are instantiated. But we do know the keys in advance. - sprintf(command, - "gperf -c -D -E -T -f 0 -a -o -t -p -L C++ -Z Object_Hash %s >\ -gperf_object.i", "gperf_objects.dat"); - system(command); - -} - diff --git a/TAO/tests/Demux_Test/CodeGen/skel.cpp b/TAO/tests/Demux_Test/CodeGen/skel.cpp deleted file mode 100644 index db48cfeb908..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/skel.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include "tao.h" - -long GenServerHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - fstream hdr; - int i; - ACE_CString *str; - - hdr.open("tao_demuxS.h", ios::out); - - hdr << "#if !defined(TAO_DEMUX_S_H)" << endl; - hdr << "#define TAO_DEMUX_S_H" << endl << endl; - - hdr << "#include \"tao_demuxC.h\"" << endl; - hdr << "class _skel_tao_demux: public tao_demux" << endl; - hdr << "{" << endl; - hdr << "protected:" << endl; - hdr << "\t_skel_tao_demux(const char *objname=0);" << endl; - hdr << "\tvirtual ~_skel_tao_demux() {}" << endl; - hdr << "public:" << endl; - hdr << "\t//All methods defined on this interface" << endl; - for(i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - //generate skeletons - hdr << "\tvirtual void " << str->rep() << - "(CORBA_Environment &env) = 0;" << endl; - } - hdr << endl; - hdr << "\t// All skeletons used for dispatching" << endl; - for(i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - //generate skeletons - hdr << "\tstatic void " << str->rep() << - "_skel(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << - "CORBA_Environment &env);" << endl; - } - hdr << "\tstatic void " << - "_is_a_skel(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << - "CORBA_Environment &env);" << endl; - hdr << "};" << endl; - - hdr << "#endif" << endl; - hdr.close(); -} - -// generate server side skeletons -long GenServerSkels(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - fstream skel; - int i; - ACE_CString *str; - - skel.open("tao_demuxS.cpp", ios::out); - - skel << "#include \"tao_demuxS.h\"" << endl; - // skel << "#include \"iiopobj.h\"" << endl; - // skel << "#include \"params.h\"" << endl; - // skel << "#include \"corba/optable.h\"" << endl; - // skel << "#include \"corba/corbacom.h\"" << endl << endl; - - // table of methods - skel << "static const TAO_operation_db_entry tao_demux_operations [] = {" << endl; - for (i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - { - return -1; - } - skel << "\t{\"" << str->rep() << "\", &_skel_tao_demux::" << str->rep() << - "_skel}," << endl; - - } - skel << "\t{\"_is_a\", &_skel_tao_demux::_is_a_skel}" << endl; - skel << "};" << endl; - - // table of methods - skel << "static const TAO_operation_db_entry tao_active_demux_operations [] = {" << endl; - for (i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - { - return -1; - } - skel << "\t{\"" << i << "\", &_skel_tao_demux::" << str->rep() << - "_skel}," << endl; - - } - skel << "\t{\"" << limit << "\", &_skel_tao_demux::_is_a_skel}" << endl; - skel << "};" << endl; - - // instantiate operation lookup tables - skel << "// instantiate a dynamic hash operation table" << endl; - skel << "TAO_Dynamic_Hash_OpTable dyn_hash_tao_demux_op_tbl(" << - "tao_demux_operations, " << (limit+1) << ", " << (limit+1)*2 << ");" << endl; - - skel << "// instantiate a linear search based operation table" << endl; - skel << "TAO_Linear_OpTable linear_tao_demux_op_tbl(" << - "tao_demux_operations, " << limit+1 << ");" << endl; - - skel << "// instantiate a active demux operation table" << endl; - skel << "TAO_Active_Demux_OpTable active_tao_demux_op_tbl(" << - "tao_active_demux_operations, " << limit+1 << ");" << endl; - - skel << "// constructor for skel_tao_demux" << endl; - skel << "_skel_tao_demux::_skel_tao_demux(const char *obj_name)" << endl; - // skel << "\t:optable_(&tao_demux_op_tbl)" << endl; - skel << "{" << endl; - skel << "\tconst char* repoID = \"IDL:tao_demux:1.0\";" << endl; - skel << "\tCORBA_String_var _tao_typeid = repoID;" << endl; - skel << "\tIIOP_Object *data; // IIOP object reference" << endl; - skel << "\tCORBA_POA_ptr oa = TAO_OA_PARAMS::instance()->oa(); // our OA" << endl; - skel << "\tTAO_Operation_Table_Parameters *op_params = " << endl; - skel << "\t\tTAO_OP_TABLE_PARAMETERS::instance();" << endl << endl; - skel << "\tCORBA_Long i;" << endl; - - // set the operation table based on user's choice - skel << "\tswitch(op_params->lookup_strategy()){" << endl; - skel << "\tcase TAO_Operation_Table_Parameters::TAO_ACTIVE_DEMUX:" << endl; - skel << "\t\tthis->optable_ = &active_tao_demux_op_tbl;" << endl; - skel << "\t\tbreak;" << endl; - skel << "\tcase TAO_Operation_Table_Parameters::TAO_LINEAR:" << endl; - skel << "\t\tthis->optable_ = &linear_tao_demux_op_tbl;" << endl; - skel << "\t\tbreak;" << endl; - skel << "\tcase TAO_Operation_Table_Parameters::TAO_DYNAMIC_HASH:" << endl; - skel << "\t\tthis->optable_ = &dyn_hash_tao_demux_op_tbl;" << endl; - skel << "\t\tbreak;" << endl; - skel << "\tcase TAO_Operation_Table_Parameters::TAO_PERFECT_HASH:" << endl; - skel << "\t\tthis->optable_ = op_params->concrete_strategy ();" << endl; - skel << "\t\tbreak;" << endl; - skel << "\tcase TAO_Operation_Table_Parameters::TAO_USER_DEFINED:" << endl; - skel << "\t\tthis->optable_ = op_params->concrete_strategy ();" << endl; - skel << "\t\tbreak;" << endl; - skel << "\t}" << endl << endl; - - // code to create IIOP object - skel << "\tdata = new IIOP_Object(CORBA_string_dup(_tao_typeid));" << endl; - skel << "\tdata->profile.iiop_version.major = IIOP::MY_MAJOR;" << endl; - skel << "\tdata->profile.iiop_version.minor = IIOP::MY_MINOR;" << endl; - skel << "\tdata->profile.host = ACE_OS::strdup(oa->get_addr().get_host_name());" << endl; - skel << "\tdata->profile.port = oa->get_addr().get_port_number();" << endl; - skel << "\tdata->profile.object_key.length = ACE_OS::strlen(obj_name);" << endl; - skel << "\tdata->profile.object_key.maximum = " << - "data->profile.object_key.length;" << endl; - skel << "\tdata->profile.object_key.buffer = " << - "new CORBA_Octet [(size_t)data->profile.object_key.length+1];" << endl; - skel << "\tACE_OS::memcpy(data->profile.object_key.buffer, obj_name, " << - "data->profile.object_key.length);" << endl; - skel << "\tthis->set_parent(data);" << endl; - skel << "\tthis->sub_ = this;" << endl; - skel << "\tif (oa) oa->bind(data->profile.object_key, this);" << - "// register ourselves" << endl; - skel << "}" << endl << endl; - - // now the code for each skeleton - for(i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - skel << "void _skel_tao_demux::" << str->rep() << - "_skel(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << - "CORBA_Environment&env)" << endl; - skel << "{" << endl; - skel << "\tCORBA_NVList_ptr nvlist;" << endl; - skel << "\ttao_demux_ptr impl;" << endl << endl; - - // create a NVlist and populate it - skel << "\treq.orb()->create_list(0, nvlist);" << endl; - skel << "\treq.params(nvlist,env); //useless operation, but required " - << endl; - skel << "\t impl = (tao_demux_ptr) (obj->get_subclass());" << endl; - skel << "\t// now the magic of dynamic binding" << endl; - skel << "\timpl->" << str->rep() << "(env);" << endl; - skel << "}" << endl; - } - - // finally the code for _is_a - skel << "void _skel_tao_demux::_is_a_skel" << - "(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << - "CORBA_Environment&env)" << endl; - skel << "{" << endl; - skel << "\tCORBA_NVList_ptr nvlist;" << endl; - skel << "\tCORBA_NamedValue_ptr nv;" << endl; - skel << "\tCORBA_Any temp_value(_tc_CORBA_String);" << endl; - skel << "\tchar *_tao_typeid = \"IDL:tao_demux:1.0\";" << endl << endl; - - // create a NVlist and populate it - skel << "\treq.orb()->create_list(0, nvlist);" << endl; - skel << "\tnv = nvlist->add_value(0, temp_value, CORBA_ARG_IN, env);" << endl; - skel << "\treq.params(nvlist,env);" << endl; - skel << "\tif (env.exception() != 0)" << endl; - skel << "\t {" << endl; - skel << "\t\tdexc(env, \"is_a_skel, params\");" << endl; - skel << "\t\treturn;" << endl; - skel << "\t }" << endl << endl; - skel << "\tCORBA_Boolean *retval;" << endl; - skel << "\tCORBA_String value = *(CORBA_String *)nv->value()->value();" << endl; - skel << "\tif (strcmp((char *)value,(char *)_tao_typeid) == 0" << endl; - skel << "\t || strcmp((char *)value, _tc_CORBA_Object->id(env)) == 0)" << endl; - skel << "\t\tretval = new CORBA_Boolean(CORBA_B_TRUE);" << endl; - skel << "\telse" << endl; - skel << "\t\tretval = new CORBA_Boolean(CORBA_B_FALSE);" << endl; - skel << "\tCORBA_Any *any = new CORBA_Any(_tc_CORBA_Boolean, retval," << - "CORBA_B_TRUE);" << endl; - skel << "\treq.result(any, env);" << endl; - skel << "\tdexc(env, \"_is_a, result\");" << endl; - skel << "}" << endl; - - skel.close(); -} - diff --git a/TAO/tests/Demux_Test/CodeGen/stub.cpp b/TAO/tests/Demux_Test/CodeGen/stub.cpp deleted file mode 100644 index 136fbf1116a..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/stub.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "tao.h" - -long GenClientHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - fstream hdr; - int i; - ACE_CString *str; - - hdr.open("tao_demuxC.h", ios::out); - - hdr << "//******** Generated by the tool: taoidl ********" << endl << endl; - - hdr << "#if !defined (TAO_DEMUXC_H)" << endl; - hdr << "#define TAO_DEMUXC_H" << endl << endl; - - hdr << "#include <stdlib.h>" << endl; - hdr << "#include \"tao/corba.h\"" << endl; - // hdr << "#include \"tao/orb.h\"" << endl; - // hdr << "#include \"tao/stub.h\"" << endl; - // hdr << "#include \"tao/optable.h\"" << endl; - - hdr << "class tao_demux;" << endl; - hdr << "typedef tao_demux *\ttao_demux_ptr;" << endl; - hdr << "class tao_demux: public virtual CORBA_Object" << endl; - hdr << "{" << endl; - hdr << "public:" << endl; - // define the CORBA compliant mapping - hdr << "\tstatic tao_demux_ptr _duplicate(tao_demux_ptr obj);" << endl; - hdr << "\tstatic tao_demux_ptr _narrow(CORBA_Object_ptr obj);" << endl; - hdr << "\tstatic tao_demux_ptr _nil();" << endl << endl; - - // now generate all the methods - for(i=0; i < limit; i++) - { - if (arr.get(str, i) == -1) - { - return -1; - } - hdr << "\tvirtual void " << str->rep() << "(CORBA_Environment &env);" << endl; - } - hdr << "protected:" << endl; - hdr << "\ttao_demux() {}" << endl; - hdr << "\ttao_demux(STUB_Object *objref): CORBA_Object(objref) {}" << endl; - hdr << "\tvirtual ~tao_demux() {}" << endl; - hdr << "private:" << endl; - hdr << "\t//copy constructor and assignment operator" << endl; - hdr << "\ttao_demux(const tao_demux&) { }" << endl; - hdr << "\tvoid operator=(const tao_demux&) { }" << endl; - hdr << "};" << endl; - - hdr << "#endif" << endl; - hdr.close(); -} - -long GenClientStubs(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) -{ - fstream stub; - int i; - ACE_CString *str; - - stub.open("tao_demuxC.cpp", ios::out); - - stub << "#include \"tao_demuxC.h\"" << endl << endl; - - // generate the static functions - - // the _duplicate method - stub << "tao_demux_ptr tao_demux::_duplicate(tao_demux_ptr obj)" << endl; - stub << "{" << endl; - stub << "\tif (obj) obj->AddRef();" << endl; - stub << "\treturn obj;" << endl; - stub << "}" << endl << endl; - - // the _narrow method - stub << "tao_demux_ptr tao_demux::_narrow(CORBA_Object_ptr obj)" << endl; - stub << "{" << endl; - // check if object "is_a" IDL:tao_demux:1.0 and if so, addref and return a - // pointer to it - stub << "\tCORBA_Environment env;" << endl; - stub << "\tif (obj->_is_a(\"IDL:tao_demux:1.0\", env)){" << endl; - stub << "\t STUB_Object *istub;" << endl; - stub << "\t if (obj->QueryInterface(IID_STUB_Object, (void **)&istub)" << - " != NOERROR){" << endl; - stub << "\t\treturn tao_demux::_nil();" << endl; - stub << "\t }" << endl; - stub << "\t tao_demux_ptr new_obj = new tao_demux(istub);" << endl; - stub << "\t return tao_demux::_duplicate(new_obj);" << endl; - stub << "\t}" << endl; - stub << "\treturn tao_demux::_nil();" << endl; - stub << "}" << endl << endl; - - // the _nil method - stub << "tao_demux_ptr tao_demux::_nil()" << endl; - stub << "{" << endl; - stub << "\treturn (tao_demux_ptr)NULL;" << endl; - stub << "}" << endl << endl; - - // All the TAO_Param_Data and TAO_Call_Data structures - stub << - "// All the TAO_Param_Data and TAO_Call_Data structures required for invoking do_call" - << endl; - for(i=0; i < limit; i++){ - if (arr.get(str, i) == -1) - { - return -1; - } - - // generate TAO_Param_Data structure - stub << "static const TAO_Param_Data tao_demux_" << str->rep() << - "_params[] = {" << endl; - stub << "\t{_tc_CORBA_Void, PARAM_RETURN, 0}" << endl; - stub << "};" << endl; - - // generate TAO_Call_Data structure - stub << "static const TAO_Call_Data tao_demux_" << str->rep() << - "_calldata = {" << endl; - stub << "\t\"" << str->rep() << "\"," << endl; - stub << "\tCORBA_B_TRUE, //twoway" << endl; - stub << "\t1, &tao_demux_" << str->rep() << "_params[0]," << endl; - stub << "\t0, 0" << endl; - stub << "};" << endl; - - // generate TAO_Call_Data structure that uses active demultiplexing - stub << "static const TAO_Call_Data tao_demux_" << str->rep() << - "_active_calldata = {" << endl; - stub << "\t\"" << i << "\"," << endl; - stub << "\tCORBA_B_TRUE, //twoway" << endl; - stub << "\t1, &tao_demux_" << str->rep() << "_params[0]," << endl; - stub << "\t0, 0" << endl; - stub << "};" << endl; - - // now the actual stub - stub << "void tao_demux::" << str->rep() << "(CORBA_Environment &env)" - << endl; - stub << "{" << endl; - stub << "\tSTUB_Object *istub;" << endl; - stub << "\tif (this->QueryInterface (IID_STUB_Object, (void **) &istub) " - << "!= NOERROR){" << endl; - stub << "\t env.exception (new CORBA_DATA_CONVERSION (COMPLETED_NO));" << endl; - stub << "\t return;" << endl; - stub << "\t}" << endl; - stub << "\tTAO_Operation_Table_Parameters *paramTbl = " << endl; - stub << "\t\tTAO_OP_TABLE_PARAMETERS::instance();" << endl; - stub << "\tif (paramTbl->lookup_strategy() == "; - stub << "TAO_Operation_Table_Parameters::TAO_ACTIVE_DEMUX)" << endl; - stub << "\t\tistub->do_call(env, &tao_demux_" << str->rep() << - "_active_calldata);" << endl; - stub << "\telse" << endl; - stub << "\t\tistub->do_call(env, &tao_demux_" << str->rep() << - "_calldata);" << endl; - stub << "}" << endl << endl; - } - stub.close(); -} - diff --git a/TAO/tests/Demux_Test/CodeGen/tao.cpp b/TAO/tests/Demux_Test/CodeGen/tao.cpp deleted file mode 100644 index b01df4002fe..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/tao.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "tao.h" - -int main (int argc, char *argv[]) -{ - // define the two arrays that will hold generated object keys and method - // names of the hypothetical "tao_demux" interface - ACE_Unbounded_Queue<ACE_CString> *objectArr, *methodArr; - - // provide default values to the limit on the number of object keys and - // method names - long objectLimit = 5, - methodLimit = 4; - - // for parsing the arguments - ACE_Get_Opt get_opt (argc, argv, "hm:o:"); - - for (int c; (c = get_opt ()) != EOF;) - { - switch (c) - { - case 'm': // number of methods - methodLimit = ACE_OS::atoi (get_opt.optarg); - break; - case 'o': // number of object keys - objectLimit = ACE_OS::atoi (get_opt.optarg); - break; - case 'h': // usage - default: - Usage (); - return 1; - } - } - - cout << "Generating code for " << objectLimit << " objects and " << - methodLimit << " methods" << endl; - objectArr = new ACE_Unbounded_Queue<ACE_CString> [objectLimit]; - methodArr = new ACE_Unbounded_Queue<ACE_CString> [methodLimit]; - - // generate the object keys - if (GenObjectTable (*objectArr, objectLimit) == -1) - { - } - - // generate method names - if (GenMethodTable (*methodArr, methodLimit) == -1) - { - } - - // generate client side stub headers - if (GenClientHeader (*methodArr, methodLimit) == -1) - { - } - - // generate client stubs - if (GenClientStubs (*methodArr, methodLimit) == -1) - { - } - - // generate include code for client-side main program - if (GenClientCode (*methodArr, methodLimit) == -1) - { - } - - // generate server skeleton header - if (GenServerHeader (*methodArr, methodLimit) == -1) - { - } - - // generate server skeletons - if (GenServerSkels (*methodArr, methodLimit) == -1) - { - } - - // generate th eimpl header - if (GenServantHeader (*methodArr, methodLimit) == -1) - { - } - - // generate impl - if (GenServantImpl (*methodArr, methodLimit) == -1) - { - } - - // generate code that creates instances of objects - if (GenObjectCreateCode (*objectArr, objectLimit) == -1) - { - } - - GenGPERFCode (); -} - -void Usage (void) -{ - cerr << "Usage: tao [-m <#methods>] [-o <#objects>] [-h]" << endl; - return; -} diff --git a/TAO/tests/Demux_Test/CodeGen/tao.h b/TAO/tests/Demux_Test/CodeGen/tao.h deleted file mode 100644 index cdabc2a3446..00000000000 --- a/TAO/tests/Demux_Test/CodeGen/tao.h +++ /dev/null @@ -1,21 +0,0 @@ -#include <iostream.h> -#include <fstream.h> - -#include "ace/SString.h" -#include "ace/Containers.h" -#include "ace/Singleton.h" -#include "ace/Get_Opt.h" - -long GenObjectTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenMethodTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenClientHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenClientStubs(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenClientCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenObjectCreateCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenServerHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenServerSkels(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenServantHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -long GenServantImpl(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); -void GenGPERFCode(); -void Usage(); - diff --git a/TAO/tests/Demux_Test/Makefile b/TAO/tests/Demux_Test/Makefile deleted file mode 100755 index c82f055b5c8..00000000000 --- a/TAO/tests/Demux_Test/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Top-level Makefile for the CORBA request demultiplexing benchmark -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -LDLIBS = -lTAO - -PROG_SRCS = client.cpp tao_demuxC.cpp tao_demuxS.cpp tao_demux_i.cpp server.cpp - -LSRC = $(PROG_SRCS) - -TAO_DEMUX_CLIENT_OBJS = client.o tao_demuxC.o - -TAO_DEMUX_SERVER_OBJS = server.o tao_demuxC.o tao_demuxS.o tao_demux_i.o - -BIN = client server - -BUILD = $(BIN) - -VLDLIBS = $(LDLIBS:%=%$(VAR)) -VBIN = $(BIN:%=%$(VAR)) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local modifications to variables imported by includes above. -#---------------------------------------------------------------------------- - -LDFLAGS += -lTAO -LDFLAGS += -L$(TAO_ROOT)/tao -CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat - -ifdef quantify -LDFLAGS += -L/pkg/purify/quantify-2.1-solaris2/ -lquantify_stubs -endif - -ifdef debug -CPPFLAGS += -DDEBUG -endif - -server: $(addprefix $(VDIR),$(TAO_DEMUX_SERVER_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) - -client: $(addprefix $(VDIR),$(TAO_DEMUX_CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) - -clean: - $(MAKE) realclean - rm -fr tao_demux* gperf* *.i client server - diff --git a/TAO/tests/Demux_Test/README b/TAO/tests/Demux_Test/README deleted file mode 100644 index 133758e62e6..00000000000 --- a/TAO/tests/Demux_Test/README +++ /dev/null @@ -1,20 +0,0 @@ - -***** NOTE: This is still under development and will not work ***** - - -This test directory tests various demultiplexing strategies used in -TAO. - -Description of various files: - -make_all script that generates executables for different number - of objects and methods -gen_bin generates the binary for the desired number of objects - and methods -run_client runs a client -run_server runs a server -run_all_client runs all clients generated by the make_all -run_all_server runs all servers generated by the make_all -CodeGen Directory containing the code generator -server.cpp server main program -client.cpp client main program diff --git a/TAO/tests/Demux_Test/client.cpp b/TAO/tests/Demux_Test/client.cpp deleted file mode 100755 index b45b6819b0f..00000000000 --- a/TAO/tests/Demux_Test/client.cpp +++ /dev/null @@ -1,309 +0,0 @@ -#include <sys/types.h> -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include "tao_demuxC.h" -#include "tao/debug.h" - -#include <iostream.h> -#include <fstream.h> - -void print_exception (const CORBA_Exception *x, - const char *info, - FILE *stream - ); - -char Usage[] = "\ -Usage: client options\n\ -options:\n\ --l strategy: operation lookup strategy - a(active), l(linear), d (dyn hash), p (perf)\n\ --i iter: number of iterations \n\ --m num: number of methods \n\ --o num: number of objects \n\ --t type: type can be l(linear), r(random), b (best), w (worst)\n\ -"; - -#if !defined (__cplusplus) -typedef void (*SIG_TYP)(); -#endif - -#ifdef SVR4 -void -sigpipe (int foo) -#else - void -sigpipe () -#endif -{ -} - -static const char ior_prefix [] = "IOR:"; -static const char iiop_prefix [] = "iiop:"; - -enum SendType{ - LINEAR, - BEST, - WORST, - RANDOM -}; - -void do_test(tao_demux_ptr *demux, int olimit, int mlimit, SendType, int iter); - -int -main (int argc, char *argv[]) -{ - - unsigned long addr_tmp; - unsigned short done = 0; - int c; - - CORBA_ORB_ptr orb_ptr; - CORBA_Environment env; - CORBA_Object_ptr objref; - tao_demux_ptr *demux; - unsigned loop_count = 0; - int exit_later = 0; - int i; - int ObjectLimit = 5, - MethodLimit = 4; - int iter= 1; // number of iterations - SendType st = RANDOM; - TAO_Operation_Table_Parameters *op_params = TAO_OP_TABLE_PARAMETERS::instance(); - - CORBA_String str; - fstream iorfile; - - while (!done && ((c = getopt (argc, argv, "i:l:t:m:o:")) != - -1)){ - switch(c){ - case 'i': - iter = atoi (optarg); - break; - case 'l': // op table lookup strategy - break; - case 'm': - MethodLimit = atoi(optarg); - break; - case 'o': - ObjectLimit = atoi(optarg); - break; - case 't': - switch(*optarg){ - case 'b': - st = BEST; - break; - case 'w': - st = WORST; - break; - case 'l': - st = LINEAR; - break; - case 'r': - default: - st = RANDOM; - break; - } - break; - default: - goto usage; - } - } - - TAO_debug_level = 0; - // - // Transmitter - // - orb_ptr = CORBA_ORB_init (argc, argv, "ior", env); - if (env.exception () != 0) { - print_exception (env.exception (), "ORB initialization", stdout); - return 1; - } - - str = CORBA_string_alloc (500); - - // read the IOR from the file ior.txt - iorfile.open("./ior.txt", ios::in); - - for (;!iorfile.eof ();){ - memset(str, '\0', 500); - iorfile >> ((char *)str); - if (iorfile.good ()) - loop_count++; - } - iorfile.close(); - - ACE_DEBUG ((LM_DEBUG, "Total of %d object references read\n", loop_count)); - demux = new tao_demux_ptr [loop_count]; - for (i=0; i < loop_count; i++){ - demux[i] = 0; - } - - // read the IOR from the file ior.txt - iorfile.open("./ior.txt", ios::in); - - for (i=0; i < loop_count; i++){ - ACE_OS::memset (str, '\0', 500); - iorfile >> ((char *)str); - objref = orb_ptr->string_to_object(str, env); - if (env.exception() != 0){ - print_exception(env.exception(), "string2object", stdout); - return 1; - } - - cout << "objref " << i << " has key = " << objref->_get_name(env) << endl; - if (!CORBA_is_nil(objref)){ - // narrow to the desired interface type - demux[i] = tao_demux::_narrow (objref); - } - } - iorfile.close(); - CORBA_string_free(str); - - - // send operations - do_test(demux, ObjectLimit, MethodLimit, st, iter); - - for (i=0; i < loop_count; i++){ - CORBA_release(demux[i]); - } - delete [] demux; - return(0); -usage: - fprintf (stderr, Usage); - return 1; -} - -typedef void (*method_ptr)(tao_demux_ptr); -struct method_db { - method_ptr method; -}; - -#include "client.i" - -void do_test(tao_demux_ptr *demux, int olimit, int mlimit, SendType st, int iter) -{ - int i, j, k; - int loop = 0; - hrtime_t start, end, sum, diff; - fstream result; - CORBA_Environment env; - - result.open("result.dat",ios::out|ios::app); -#ifdef __TAO_ACTIVE__ - result << "# ACTIVE "; -#endif -#ifdef __TAO_GPERF__ - result << "# GPERF "; -#endif -#ifdef __TAO_LINEAR__ - result << "# LINEAR "; -#endif - - // result << "@type xy" << endl; - sum = 0; - - if (st == LINEAR){ - result << " LINEAR" << endl; -#ifdef __DEBUG__ - cout << "Linear strategy for sending" << endl; -#endif - for (k=0; k < iter; k++) { - // invoke the jth method on the ith object - for (i=0; i < olimit; i++){ - for (j=0; j < mlimit; j++){ - loop++; - start = gethrtime(); - mtbl[j].method(demux[i]); - end = gethrtime(); - diff = (end - start); -#ifdef __DEBUG__ - cout << "Latency for this request = " << diff/1.0e+06 << endl; -#endif - sum += diff; - // result << loop << "\t" << diff/1.e+06 << endl; - } - } - } - } else if (st == BEST){ - result << " BEST" << endl; -#ifdef __DEBUG__ - cout << "best strategy for sending" << endl; -#endif - for (k=0; k < iter; k++) { - // invoke the jth method on the ith object - for (i=0; i < olimit; i++){ - for (j=0; j < mlimit; j++){ - loop++; - start = gethrtime(); - mtbl[0].method(demux[0]); - end = gethrtime(); - diff = (end - start); -#ifdef __DEBUG__ - cout << "Latency for this request = " << diff/1.0e+06 << endl; -#endif - sum += diff; - // result << loop << "\t" << diff/1.e+06 << endl; - } - } - } - } else if (st == RANDOM) { - result << " RANDOM" << endl; -#ifdef __DEBUG__ - cout << "Random strategy for sending" << endl; -#endif - // choose the object and method name randomly - srand48(time(NULL)); - long p, q; - for (k=0; k < iter; k++) { - for (i=0; i < olimit; i++){ - for (j=0; j < mlimit; j++){ - loop++; - p = lrand48() % olimit; - q = lrand48() % mlimit; - start = gethrtime(); -#ifdef DEBUG - ACE_DEBUG ((LM_DEBUG, "Invoking op %s on object with key %s\n", - mtbl[q], demux[p]->_get_name(env))); -#endif - mtbl[q].method(demux[p]); - end = gethrtime(); - diff = (end - start); -#ifdef __DEBUG__ - cout << "Latency for this request = " << diff/1.0e+06 << endl; -#endif - sum += diff; - // result << loop << "\t" << diff/1.e+06 << endl; - } - } - } - } else if (st == WORST){ - result << " WORST" << endl; -#ifdef __DEBUG__ - cout << "worst strategy for sending" << endl; -#endif - // invoke the jth method on the ith object - for (k=0; k < iter; k++) { - for (i=0; i < olimit; i++){ - for (j=0; j < mlimit; j++){ - loop++; - start = gethrtime(); - mtbl[mlimit-1].method(demux[olimit-1]); - end = gethrtime(); - diff = (end - start); -#ifdef __DEBUG__ - cout << "Latency for this request = " << diff/1.0e+06 << endl; -#endif - sum += diff; - // result << loop << "\t" << diff/1.e+06 << endl; - } - } - } - } - result << olimit << "\t" << mlimit << "\t" << sum/(loop*1000000.0) << endl; - cout << olimit << "\t" << mlimit << "\t" << sum/(loop*1000000.0) << endl; - result.close(); -} - diff --git a/TAO/tests/Demux_Test/gen_bin b/TAO/tests/Demux_Test/gen_bin deleted file mode 100755 index b0650ff4249..00000000000 --- a/TAO/tests/Demux_Test/gen_bin +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -make clean -./CodeGen/tao -o $1 -m $2 -make -mv client client_${1}_${2} -mv server server_${1}_${2} diff --git a/TAO/tests/Demux_Test/make_all b/TAO/tests/Demux_Test/make_all deleted file mode 100755 index 4ac9b18cc3f..00000000000 --- a/TAO/tests/Demux_Test/make_all +++ /dev/null @@ -1,19 +0,0 @@ -rm -fr server_*_* client_*_* -gen_bin 1 1 -gen_bin 1 10 -gen_bin 1 100 -gen_bin 100 1 -gen_bin 100 10 -gen_bin 100 100 -gen_bin 200 1 -gen_bin 200 10 -gen_bin 200 100 -gen_bin 300 1 -gen_bin 300 10 -gen_bin 300 100 -gen_bin 400 1 -gen_bin 400 10 -gen_bin 400 100 -gen_bin 500 1 -gen_bin 500 10 -gen_bin 500 100 diff --git a/TAO/tests/Demux_Test/run_all_client b/TAO/tests/Demux_Test/run_all_client deleted file mode 100755 index a5a3b61c48f..00000000000 --- a/TAO/tests/Demux_Test/run_all_client +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# usage: run_client <num objs> <num methods> <num iters> -run_client 500 100 1 -sleep 5 -run_client 500 10 1 -sleep 5 -run_client 500 1 1 -sleep 5 -run_client 400 100 1 -sleep 5 -run_client 400 10 1 -sleep 5 -run_client 400 1 1 -sleep 5 -run_client 300 100 1 -sleep 5 -run_client 300 10 1 -sleep 5 -run_client 300 1 1 -sleep 5 -run_client 200 100 1 -sleep 5 -run_client 200 10 1 -sleep 5 -run_client 200 1 1 -sleep 5 -run_client 100 100 1 -sleep 5 -run_client 100 10 1 -sleep 5 -run_client 100 1 1 -sleep 5 -run_client 1 100 1 -sleep 5 -run_client 1 10 10 -sleep 5 -run_client 1 1 100 diff --git a/TAO/tests/Demux_Test/run_all_server b/TAO/tests/Demux_Test/run_all_server deleted file mode 100755 index 15b4762efcb..00000000000 --- a/TAO/tests/Demux_Test/run_all_server +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# usage: run_server <num objs> <num methods> <num iters> -run_server 500 100 1 -run_server 500 10 1 -run_server 500 1 1 -run_server 400 100 1 -run_server 400 10 1 -run_server 400 1 1 -run_server 300 100 1 -run_server 300 10 1 -run_server 300 1 1 -run_server 200 100 1 -run_server 200 10 1 -run_server 200 1 1 -run_server 100 100 1 -run_server 100 10 1 -run_server 100 1 1 -run_server 1 100 1 -run_server 1 10 10 -run_server 1 1 100 diff --git a/TAO/tests/Demux_Test/run_client b/TAO/tests/Demux_Test/run_client deleted file mode 100755 index 19dab08670d..00000000000 --- a/TAO/tests/Demux_Test/run_client +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -client_${1}_${2} -o ${1} -m ${2} -t r -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t w -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t r -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t w -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t r -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t w -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t r -i $3 -sleep 5 -client_${1}_${2} -o ${1} -m ${2} -t w -i $3 -sleep 5 diff --git a/TAO/tests/Demux_Test/run_server b/TAO/tests/Demux_Test/run_server deleted file mode 100755 index 7f2ac61445a..00000000000 --- a/TAO/tests/Demux_Test/run_server +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -server_${1}_${2} -OAhost merengue -OAobjdemux linear -OAtablesize ${1} -o ${1} -m ${2} -t l -i $3 -server_${1}_${2} -OAhost merengue -OAobjdemux linear -OAtablesize ${1} -o ${1} -m ${2} -t l -i $3 -server_${1}_${2} -OAhost merengue -OAobjdemux active_demux -OAtablesize ${1} -o ${1} -m ${2} -t a -i $3 -server_${1}_${2} -OAhost merengue -OAobjdemux active_demux -OAtablesize ${1} -o ${1} -m ${2} -t a -i $3 -server_${1}_${2} -OAhost merengue -OAobjdemux user_def -o ${1} -m ${2} -t g -i $3 -server_${1}_${2} -OAhost merengue -OAobjdemux user_def -o ${1} -m ${2} -t g -i $3 -server_${1}_${2} -OAhost merengue -o ${1} -m ${2} -i $3 -server_${1}_${2} -OAhost merengue -o ${1} -m ${2} -i $3 - diff --git a/TAO/tests/Demux_Test/server.cpp b/TAO/tests/Demux_Test/server.cpp deleted file mode 100755 index 1e3931b01c2..00000000000 --- a/TAO/tests/Demux_Test/server.cpp +++ /dev/null @@ -1,313 +0,0 @@ -#include "tao_demux_i.h" - -#ifdef USE_QUANTIFY -#include <quantify.h> -#endif - -#include <iostream.h> -#include <fstream.h> - -#include "ace/SString.h" - -void print_exception (const CORBA_Exception *x, - const char *info, - FILE *stream - ); - -#if !defined (__cplusplus) -typedef void (*SIG_TYP)(); -#endif - -#ifdef SVR4 -void -sigpipe (int foo) -#else - void -sigpipe () -#endif -{ -} - -//****************** perf hash for obj lookup ************* -// for perfect hash -struct object_db -{ - char *name; // name of method - CORBA_Object_ptr obj; //fn pointer to obj impl -}; - -// include the perfect hash code for objects -#include "gperf_object.i" - -// Perfect hash table class -class TAO_Perfect_Hash_ObjTable: public TAO_Object_Table -{ -public: - TAO_Perfect_Hash_ObjTable (Object_Hash *oh); - - ~TAO_Perfect_Hash_ObjTable (void); - - virtual int bind (const CORBA_OctetSeq &key, - CORBA_Object_ptr obj); - // Registers a CORBA_Object into the object table and associates the - // key with it. Returns -1 on failure, 0 on success, 1 on - // duplicate. - - virtual int find (const CORBA_OctetSeq &key, - CORBA_Object_ptr &obj); - // Looks up an object in the object table using <{key}>. Returns - // non-negative integer on success, or -1 on failure. - -private: - Object_Hash *hash_; -}; - -TAO_Perfect_Hash_ObjTable::TAO_Perfect_Hash_ObjTable (Object_Hash *oh) - : hash_ (oh) -{ -} - -TAO_Perfect_Hash_ObjTable::~TAO_Perfect_Hash_ObjTable (void) -{ -} - -int -TAO_Perfect_Hash_ObjTable::bind (const CORBA_OctetSeq &key, CORBA_Object_ptr obj) -{ - struct object_db *entry; - - ACE_CString objkey ((char *)key.buffer, key.length); - entry = this->hash_->in_word_set (objkey.rep (), key.length); - if (entry != 0) - { - // now fill up the entry - entry->obj = obj; - } - else - { - return -1; // error - } -} - -int -TAO_Perfect_Hash_ObjTable::find (const CORBA_OctetSeq &key, CORBA_Object_ptr &obj) -{ - struct object_db *entry; - - ACE_CString objkey ((char *)key.buffer, key.length); - entry = this->hash_->in_word_set (objkey.rep (), key.length); - - if (entry != 0) - { - obj = entry->obj; - return 0; - } - else - { - return -1; - } -} - -//****************** perf hash for opname lookup ************* -struct method_db -{ - char *name; // name of method - TAO_Skeleton skel_ptr_; //fn pointer to obj impl -}; - -#include "gperf_method.i" - -// Perfect hash table class -class TAO_Perfect_Hash_Op_Table: public TAO_Operation_Table -{ -public: - TAO_Perfect_Hash_Op_Table (Method_Hash *mh); - - ~TAO_Perfect_Hash_Op_Table (void); - - virtual int find (const CORBA_String &opname, - TAO_Skeleton &skel_ptr); - // Uses <{opname}> to look up the skeleton function and pass it back - // in <{skelfunc}>. Returns non-negative integer on success, or -1 - // on failure. - - virtual int bind (const CORBA_String &opname, - const TAO_Skeleton skelptr); - // Associate the skeleton <{skel_ptr}> with an operation named - // <{opname}>. Returns -1 on failure, 0 on success, 1 on duplicate. -private: - Method_Hash *hash_; -}; - -TAO_Perfect_Hash_Op_Table::TAO_Perfect_Hash_Op_Table (Method_Hash *mh) - : hash_ (mh) -{ -} - -TAO_Perfect_Hash_Op_Table::~TAO_Perfect_Hash_Op_Table (void) -{ -} - -int -TAO_Perfect_Hash_Op_Table::bind (const CORBA_String &opname, - const TAO_Skeleton skelptr) -{ - return 0; // nothing to do -} - -int -TAO_Perfect_Hash_Op_Table::find (const CORBA_String &opname, - TAO_Skeleton &skelptr) -{ - method_db *entry; - - entry = (method_db*) this->hash_->in_word_set (opname, ACE_OS::strlen (opname)); - if (entry != 0) - { - skelptr = entry->skel_ptr_; - return 0; - } - else - { - return -1; - } -} - -//*********************************************************** -char Usage[] = "\ -Usage: server [options] \n\ -Common options:\n\ --t demux_strategy: l(linear), g(GPERF), a (delayered active demux), d (dynamic hash)\n\ --i iter: number of iterations to expect from client \n\ -"; - -extern CORBA_Double TAO_Avg; -extern CORBA_Long TAO_HowMany; -extern CORBA_Long TAO_Loop; -int -main (int argc, char *const *argv) -{ - unsigned long addr_tmp; - int c; - unsigned short done = 0; - CORBA_Environment env; - CORBA_ORB_ptr orb_ptr; - CORBA_POA_ptr oa_ptr; - int iter = 1; - TAO_OA_Parameters *params = TAO_OA_PARAMS::instance(); - char *orb_name = "ior"; - int idle = -1; - int use_ior = 0; - int terminationStatus = 0; - tao_demux_i **mymux; // array of objects implementing the "demux" interface - int numObjs = 5, numMethods = 4; - Object_Hash oh; - TAO_Object_Table *objt = new TAO_Perfect_Hash_ObjTable (&oh); - Method_Hash mh; - TAO_Operation_Table *optbl = new TAO_Perfect_Hash_Op_Table (&mh); - - TAO_Operation_Table_Parameters *op_params = - TAO_OP_TABLE_PARAMETERS::instance(); - - fstream iorfile; // stores the object references of all the objects - fstream outfile; - CORBA_String str; // scratch area - - params->userdef_lookup_strategy (objt); - - orb_ptr = CORBA_ORB_init (argc, argv, orb_name, env); - if (env.exception () != 0) { - print_exception (env.exception (), "ORB init", stdout); - return 1; - } - - oa_ptr = orb_ptr->BOA_init (argc, argv, "ROA"); - if (env.exception () != 0) { - print_exception (env.exception (), "OA init", stdout); - return 1; - } - - TAO_debug_level = 0; - // Now process the options other than Orbix specific options - while ((c = getopt (argc, argv, "ui:t:o:m:")) != -1) - { - switch (c) - { - case 't': - switch (*optarg) - { - case 'l': - op_params->lookup_strategy - (TAO_Operation_Table_Parameters::TAO_LINEAR); - break; - case 'a': - op_params->lookup_strategy - (TAO_Operation_Table_Parameters::TAO_ACTIVE_DEMUX); - break; - case 'g': - op_params->lookup_strategy - (TAO_Operation_Table_Parameters::TAO_PERFECT_HASH); - op_params->concrete_strategy (optbl); - break; - case 'd': - default: - op_params->lookup_strategy - (TAO_Operation_Table_Parameters::TAO_DYNAMIC_HASH); - break; - } - break; - case 'u': - use_ior = 1; - orb_name = ""; - break; - case 'i': - iter = atoi (optarg); - break; - case 'o': - numObjs = atoi(optarg); - break; - case 'm': - numMethods = atoi(optarg); - break; - default: - goto usage; - } - } - - TAO_Avg = 0; - TAO_Loop = 0; - TAO_HowMany = iter*numObjs*numMethods; - - // - // Receiver - // - - iorfile.open ("ior.txt", ios::out); - mymux = new tao_demux_i* [numObjs]; - - // instantiate objects -#include "obj_create.i" - iorfile.close(); - cout << "Server ready to handle events" << endl; - -#if defined (USE_QUANTIFY) - quantify_clear_data(); - quantify_start_recording_data(); -#endif - - ACE_Service_Config::run_reactor_event_loop(); - - outfile.open ("muxcost.dat", ios::out|ios::app); - outfile << numObjs << "\t" << numMethods << "\t" << TAO_Avg << endl; - outfile.close (); - // - // Shut down the OA -- recycles all underlying resources (e.g. file - // descriptors, etc). - // - oa_ptr->clean_shutdown (env); - return terminationStatus; -usage: - fprintf (stderr, Usage); - return(1); -} - |