From: Mika Laitio Date: Sat, 2 Oct 2010 10:49:53 +0000 (+0300) Subject: initial version X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a4cadd50e661871c819f9f253f3595cfba647aed;p=libplpbus.git initial version --- a4cadd50e661871c819f9f253f3595cfba647aed diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..516feb4 --- /dev/null +++ b/.cproject @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..f3fc707 --- /dev/null +++ b/.project @@ -0,0 +1,78 @@ + + + libplpbus + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..0af34e6 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Mika Laitio diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..b2f02dd --- /dev/null +++ b/COPYING @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..7d1c323 --- /dev/null +++ b/INSTALL @@ -0,0 +1,365 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008, 2009 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..e180e8f --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,5 @@ +libplpbus is library for communication between processes in one or many different devices +Copyright (C) 2010 Mika Laitio +You can redistribute it and/or modify it under either the terms of the LGPL version 3 +(see COPYING.txt file), or by obtaining the license from the author. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b8e09b9 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,27 @@ +SUBDIRS = src \ + src_test +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libplpbus.pc +EXTRA_DIST = libplpbus.pc.in +DISTCLEANFILES = \ + aclocal.m4 \ + config.h \ + config.h.in \ + config.log \ + config.status \ + config.cache \ + config.guess \ + config.sub \ + configure \ + depcomp \ + install-sh \ + libtool \ + ltmain.sh \ + Makefile.in \ + Makefile \ + missing \ + stamp-h \ + stamp-h1 \ + compile \ + autom4te.cache \ + $(pkgconfig_DATA) \ No newline at end of file diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..8a1931b --- /dev/null +++ b/README @@ -0,0 +1,30 @@ +License +------- +GNU LESSER GENERAL PUBLIC LICENSE (lgpl) version 3, for details see the COPYING file + +Requirements +------------ +- install omniORB and omniORB development libraries (version 4.1.4 used while developing the initial version) +- start omniNames name server (if problems try to edit /etc/omniorb/omniORB.cfg + +Build, install and clean +------------------------ +- build with command: ./autobuild.sh (generates required autoconf files) +- install with command: make install +- clean source code from generated build files: make distclean + +howto run test application +-------------------------- +1) start omniOrb name service + #omniNames & +2) run server + src_test/test_server +2) run client + src_test/test_client + +howto build new version from idl +-------------------------------- +#cd src/idl +#omniidl -bcxx -Wba -Wbtp RequestResponseBus.idl +#copy generated files to src/plpbus directory + diff --git a/autobuild.sh b/autobuild.sh new file mode 100755 index 0000000..c318591 --- /dev/null +++ b/autobuild.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if ! [ -e Makefile ] ; +then + echo "No Makefile available, generating it." + libtoolize --automake --force --copy + autoreconf --force --install + PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --prefix=/usr/local +else + echo "Makefile found, no need to generate it." +fi +make diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..e3655ff --- /dev/null +++ b/configure.ac @@ -0,0 +1,33 @@ +AC_INIT(src/plpbus/BusServer.cc) +AM_CONFIG_HEADER(config.h) +AC_CONFIG_MACRO_DIR([m4]) + +PACKAGE=libplpbus +VERSION=1.0.0 + +CFLAGS="$CFLAGS -g -Wall -Werror" +LDFLAGS="$LDFLAGS" +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) +AC_MSG_NOTICE([objective c Makefile]) + +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +AC_PROG_CXX +AC_STDC_HEADERS +AC_PROG_LIBTOOL +AC_PROG_INSTALL +AM_PROG_CC_C_O + +PKG_PROG_PKG_CONFIG() + +PKG_CHECK_MODULES(SRC, omniDynamic4) +AC_SUBST(SRC_CFLAGS) +AC_SUBST(SRC_LIBS) + +AC_OUTPUT([ +libplpbus.pc +Makefile +src/Makefile +src_test/Makefile +]) diff --git a/libplpbus.pc.in b/libplpbus.pc.in new file mode 100644 index 0000000..967a8af --- /dev/null +++ b/libplpbus.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libplpbus +Description: pilppa communication bus library +Version: @VERSION@ +Requires: +Cflags: -I${includedir} -I${includedir}/libplpbus +Libs: -L${libdir} diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..2bb16d4 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,15 @@ +lib_LTLIBRARIES = libplpbus.la +libplpbus_la_SOURCES = \ + idl/RequestResponseBusSK.cc idl/RequestResponseBus.hh \ + plpbus/BusMessage.cc plpbus/BusMessage.hh \ + plpbus/BusMessageInternal.cc plpbus/BusMessageInternal.hh \ + plpbus/ServerEventThread.cc plpbus/ServerEventThread.hh \ + plpbus/OrbServerImpl.cc plpbus/OrbServerImpl.hh \ + plpbus/BusServer.cc plpbus/BusServer.hh \ + plpbus/BusClient.cc plpbus/BusClient.hh \ + plpbus/IClientListener.hh \ + plpbus/IServerListener.hh +libplpbus_la_LDFLAGS = $(SRC_LIBS) $(all_libraries) -version-info 1:0:0 -no-undefined +AM_CPPFLAGS = $(SRC_CFLAGS) + +DISTCLEANFILES = Makefile.in diff --git a/src/idl/RequestResponseBus.hh b/src/idl/RequestResponseBus.hh new file mode 100644 index 0000000..ddebb17 --- /dev/null +++ b/src/idl/RequestResponseBus.hh @@ -0,0 +1,625 @@ +// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit. +#ifndef __RequestResponseBus_hh__ +#define __RequestResponseBus_hh__ + +#ifndef __CORBA_H_EXTERNAL_GUARD__ +#include +#endif + +#ifndef USE_stub_in_nt_dll +# define USE_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifndef USE_core_stub_in_nt_dll +# define USE_core_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifndef USE_dyn_stub_in_nt_dll +# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif + + + + + + +#ifdef USE_stub_in_nt_dll +# ifndef USE_core_stub_in_nt_dll +# define USE_core_stub_in_nt_dll +# endif +# ifndef USE_dyn_stub_in_nt_dll +# define USE_dyn_stub_in_nt_dll +# endif +#endif + +#ifdef _core_attr +# error "A local CPP macro _core_attr has already been defined." +#else +# ifdef USE_core_stub_in_nt_dll +# define _core_attr _OMNIORB_NTDLL_IMPORT +# else +# define _core_attr +# endif +#endif + +#ifdef _dyn_attr +# error "A local CPP macro _dyn_attr has already been defined." +#else +# ifdef USE_dyn_stub_in_nt_dll +# define _dyn_attr _OMNIORB_NTDLL_IMPORT +# else +# define _dyn_attr +# endif +#endif + + + + + +_CORBA_MODULE plpbus_orb + +_CORBA_MODULE_BEG + + struct DataItem { + typedef _CORBA_ConstrType_Variable_Var _var_type; + + + ::CORBA::String_member name; + + ::CORBA::Any value; + + + + void operator>>= (cdrStream &) const; + void operator<<= (cdrStream &); + }; + + typedef DataItem::_var_type DataItem_var; + + typedef _CORBA_ConstrType_Variable_OUT_arg< DataItem,DataItem_var > DataItem_out; + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DataItem; + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DataItemSequence; + + class DataItemSequence_var; + + class DataItemSequence : public _CORBA_Unbounded_Sequence< DataItem > { + public: + typedef DataItemSequence_var _var_type; + inline DataItemSequence() {} + inline DataItemSequence(const DataItemSequence& _s) + : _CORBA_Unbounded_Sequence< DataItem > (_s) {} + + inline DataItemSequence(_CORBA_ULong _max) + : _CORBA_Unbounded_Sequence< DataItem > (_max) {} + inline DataItemSequence(_CORBA_ULong _max, _CORBA_ULong _len, DataItem* _val, _CORBA_Boolean _rel=0) + : _CORBA_Unbounded_Sequence< DataItem > (_max, _len, _val, _rel) {} + + + + inline DataItemSequence& operator = (const DataItemSequence& _s) { + _CORBA_Unbounded_Sequence< DataItem > ::operator=(_s); + return *this; + } + }; + + class DataItemSequence_out; + + class DataItemSequence_var { + public: + inline DataItemSequence_var() : _pd_seq(0) {} + inline DataItemSequence_var(DataItemSequence* _s) : _pd_seq(_s) {} + inline DataItemSequence_var(const DataItemSequence_var& _s) { + if( _s._pd_seq ) _pd_seq = new DataItemSequence(*_s._pd_seq); + else _pd_seq = 0; + } + inline ~DataItemSequence_var() { if( _pd_seq ) delete _pd_seq; } + + inline DataItemSequence_var& operator = (DataItemSequence* _s) { + if( _pd_seq ) delete _pd_seq; + _pd_seq = _s; + return *this; + } + inline DataItemSequence_var& operator = (const DataItemSequence_var& _s) { + if( _s._pd_seq ) { + if( !_pd_seq ) _pd_seq = new DataItemSequence; + *_pd_seq = *_s._pd_seq; + } else if( _pd_seq ) { + delete _pd_seq; + _pd_seq = 0; + } + return *this; + } + inline DataItem& operator [] (_CORBA_ULong _s) { + return (*_pd_seq)[_s]; + } + + + + inline DataItemSequence* operator -> () { return _pd_seq; } + inline const DataItemSequence* operator -> () const { return _pd_seq; } +#if defined(__GNUG__) + inline operator DataItemSequence& () const { return *_pd_seq; } +#else + inline operator const DataItemSequence& () const { return *_pd_seq; } + inline operator DataItemSequence& () { return *_pd_seq; } +#endif + + inline const DataItemSequence& in() const { return *_pd_seq; } + inline DataItemSequence& inout() { return *_pd_seq; } + inline DataItemSequence*& out() { + if( _pd_seq ) { delete _pd_seq; _pd_seq = 0; } + return _pd_seq; + } + inline DataItemSequence* _retn() { DataItemSequence* tmp = _pd_seq; _pd_seq = 0; return tmp; } + + friend class DataItemSequence_out; + + private: + DataItemSequence* _pd_seq; + }; + + class DataItemSequence_out { + public: + inline DataItemSequence_out(DataItemSequence*& _s) : _data(_s) { _data = 0; } + inline DataItemSequence_out(DataItemSequence_var& _s) + : _data(_s._pd_seq) { _s = (DataItemSequence*) 0; } + inline DataItemSequence_out(const DataItemSequence_out& _s) : _data(_s._data) {} + inline DataItemSequence_out& operator = (const DataItemSequence_out& _s) { + _data = _s._data; + return *this; + } + inline DataItemSequence_out& operator = (DataItemSequence* _s) { + _data = _s; + return *this; + } + inline operator DataItemSequence*&() { return _data; } + inline DataItemSequence*& ptr() { return _data; } + inline DataItemSequence* operator->() { return _data; } + + inline DataItem& operator [] (_CORBA_ULong _i) { + return (*_data)[_i]; + } + + + + DataItemSequence*& _data; + + private: + DataItemSequence_out(); + DataItemSequence_out& operator=(const DataItemSequence_var&); + }; + +#ifndef __plpbus__orb_mOrbClient__ +#define __plpbus__orb_mOrbClient__ + + class OrbClient; + class _objref_OrbClient; + class _impl_OrbClient; + + typedef _objref_OrbClient* OrbClient_ptr; + typedef OrbClient_ptr OrbClientRef; + + class OrbClient_Helper { + public: + typedef OrbClient_ptr _ptr_type; + + static _ptr_type _nil(); + static _CORBA_Boolean is_nil(_ptr_type); + static void release(_ptr_type); + static void duplicate(_ptr_type); + static void marshalObjRef(_ptr_type, cdrStream&); + static _ptr_type unmarshalObjRef(cdrStream&); + }; + + typedef _CORBA_ObjRef_Var<_objref_OrbClient, OrbClient_Helper> OrbClient_var; + typedef _CORBA_ObjRef_OUT_arg<_objref_OrbClient,OrbClient_Helper > OrbClient_out; + +#endif + + // interface OrbClient + class OrbClient { + public: + // Declarations for this interface type. + typedef OrbClient_ptr _ptr_type; + typedef OrbClient_var _var_type; + + static _ptr_type _duplicate(_ptr_type); + static _ptr_type _narrow(::CORBA::Object_ptr); + static _ptr_type _unchecked_narrow(::CORBA::Object_ptr); + + static _ptr_type _nil(); + + static inline void _marshalObjRef(_ptr_type, cdrStream&); + + static inline _ptr_type _unmarshalObjRef(cdrStream& s) { + omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s); + if (o) + return (_ptr_type) o->_ptrToObjRef(_PD_repoId); + else + return _nil(); + } + + static _core_attr const char* _PD_repoId; + + // Other IDL defined within this scope. + + }; + + class _objref_OrbClient : + public virtual ::CORBA::Object, + public virtual omniObjRef + { + public: + void receive_event_message(const char* event_param); + void receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param); + void receive_response_message(const char* msg_rsp_param); + void receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param); + + inline _objref_OrbClient() { _PR_setobj(0); } // nil + _objref_OrbClient(omniIOR*, omniIdentity*); + + protected: + virtual ~_objref_OrbClient(); + + + private: + virtual void* _ptrToObjRef(const char*); + + _objref_OrbClient(const _objref_OrbClient&); + _objref_OrbClient& operator = (const _objref_OrbClient&); + // not implemented + + friend class OrbClient; + }; + + class _pof_OrbClient : public _OMNI_NS(proxyObjectFactory) { + public: + inline _pof_OrbClient() : _OMNI_NS(proxyObjectFactory)(OrbClient::_PD_repoId) {} + virtual ~_pof_OrbClient(); + + virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*); + virtual _CORBA_Boolean is_a(const char*) const; + }; + + class _impl_OrbClient : + public virtual omniServant + { + public: + virtual ~_impl_OrbClient(); + + virtual void receive_event_message(const char* event_param) = 0; + virtual void receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param) = 0; + virtual void receive_response_message(const char* msg_rsp_param) = 0; + virtual void receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param) = 0; + + public: // Really protected, workaround for xlC + virtual _CORBA_Boolean _dispatch(omniCallHandle&); + + private: + virtual void* _ptrToInterface(const char*); + virtual const char* _mostDerivedRepoId(); + + }; + + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_OrbClient; + +#ifndef __plpbus__orb_mOrbServer__ +#define __plpbus__orb_mOrbServer__ + + class OrbServer; + class _objref_OrbServer; + class _impl_OrbServer; + + typedef _objref_OrbServer* OrbServer_ptr; + typedef OrbServer_ptr OrbServerRef; + + class OrbServer_Helper { + public: + typedef OrbServer_ptr _ptr_type; + + static _ptr_type _nil(); + static _CORBA_Boolean is_nil(_ptr_type); + static void release(_ptr_type); + static void duplicate(_ptr_type); + static void marshalObjRef(_ptr_type, cdrStream&); + static _ptr_type unmarshalObjRef(cdrStream&); + }; + + typedef _CORBA_ObjRef_Var<_objref_OrbServer, OrbServer_Helper> OrbServer_var; + typedef _CORBA_ObjRef_OUT_arg<_objref_OrbServer,OrbServer_Helper > OrbServer_out; + +#endif + + // interface OrbServer + class OrbServer { + public: + // Declarations for this interface type. + typedef OrbServer_ptr _ptr_type; + typedef OrbServer_var _var_type; + + static _ptr_type _duplicate(_ptr_type); + static _ptr_type _narrow(::CORBA::Object_ptr); + static _ptr_type _unchecked_narrow(::CORBA::Object_ptr); + + static _ptr_type _nil(); + + static inline void _marshalObjRef(_ptr_type, cdrStream&); + + static inline _ptr_type _unmarshalObjRef(cdrStream& s) { + omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s); + if (o) + return (_ptr_type) o->_ptrToObjRef(_PD_repoId); + else + return _nil(); + } + + static _core_attr const char* _PD_repoId; + + // Other IDL defined within this scope. + + }; + + class _objref_OrbServer : + public virtual ::CORBA::Object, + public virtual omniObjRef + { + public: + void send_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param); + void send_dataitem_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param); + char* send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg); + ::CORBA::Long send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param); + void add_event_listener(::plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs); + void shutdown(); + + inline _objref_OrbServer() { _PR_setobj(0); } // nil + _objref_OrbServer(omniIOR*, omniIdentity*); + + protected: + virtual ~_objref_OrbServer(); + + + private: + virtual void* _ptrToObjRef(const char*); + + _objref_OrbServer(const _objref_OrbServer&); + _objref_OrbServer& operator = (const _objref_OrbServer&); + // not implemented + + friend class OrbServer; + }; + + class _pof_OrbServer : public _OMNI_NS(proxyObjectFactory) { + public: + inline _pof_OrbServer() : _OMNI_NS(proxyObjectFactory)(OrbServer::_PD_repoId) {} + virtual ~_pof_OrbServer(); + + virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*); + virtual _CORBA_Boolean is_a(const char*) const; + }; + + class _impl_OrbServer : + public virtual omniServant + { + public: + virtual ~_impl_OrbServer(); + + virtual void send_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param) = 0; + virtual void send_dataitem_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param) = 0; + virtual char* send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) = 0; + virtual ::CORBA::Long send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param) = 0; + virtual void add_event_listener(::plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs) = 0; + virtual void shutdown() = 0; + + public: // Really protected, workaround for xlC + virtual _CORBA_Boolean _dispatch(omniCallHandle&); + + private: + virtual void* _ptrToInterface(const char*); + virtual const char* _mostDerivedRepoId(); + + }; + + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_OrbServer; + +_CORBA_MODULE_END + + + +_CORBA_MODULE POA_plpbus_orb +_CORBA_MODULE_BEG + + class OrbClient : + public virtual plpbus_orb::_impl_OrbClient, + public virtual ::PortableServer::ServantBase + { + public: + virtual ~OrbClient(); + + inline ::plpbus_orb::OrbClient_ptr _this() { + return (::plpbus_orb::OrbClient_ptr) _do_this(::plpbus_orb::OrbClient::_PD_repoId); + } + }; + + template + class OrbClient_tie : public virtual OrbClient + { + public: + OrbClient_tie(_omniT& t) + : pd_obj(&t), pd_poa(0), pd_rel(0) {} + OrbClient_tie(_omniT& t, ::PortableServer::POA_ptr p) + : pd_obj(&t), pd_poa(p), pd_rel(0) {} + OrbClient_tie(_omniT* t, _CORBA_Boolean r=1) + : pd_obj(t), pd_poa(0), pd_rel(r) {} + OrbClient_tie(_omniT* t, ::PortableServer::POA_ptr p,_CORBA_Boolean r=1) + : pd_obj(t), pd_poa(p), pd_rel(r) {} + ~OrbClient_tie() { + if( pd_poa ) ::CORBA::release(pd_poa); + if( pd_rel ) delete pd_obj; + } + + _omniT* _tied_object() { return pd_obj; } + + void _tied_object(_omniT& t) { + if( pd_rel ) delete pd_obj; + pd_obj = &t; + pd_rel = 0; + } + + void _tied_object(_omniT* t, _CORBA_Boolean r=1) { + if( pd_rel ) delete pd_obj; + pd_obj = t; + pd_rel = r; + } + + _CORBA_Boolean _is_owner() { return pd_rel; } + void _is_owner(_CORBA_Boolean io) { pd_rel = io; } + + ::PortableServer::POA_ptr _default_POA() { + if( !pd_poa ) return ::PortableServer::POA::_the_root_poa(); + else return ::PortableServer::POA::_duplicate(pd_poa); + } + + void receive_event_message(const char* event_param) { pd_obj->receive_event_message(event_param); } + void receive_event_dataitem_sequence(const plpbus_orb::DataItemSequence& event_param) { pd_obj->receive_event_dataitem_sequence(event_param); } + void receive_response_message(const char* msg_rsp_param) { pd_obj->receive_response_message(msg_rsp_param); } + void receive_response_dataitem_sequence(const plpbus_orb::DataItemSequence& msg_rsp_param) { pd_obj->receive_response_dataitem_sequence(msg_rsp_param); } + + + private: + _omniT* pd_obj; + ::PortableServer::POA_ptr pd_poa; + _CORBA_Boolean pd_rel; + }; + + class OrbServer : + public virtual plpbus_orb::_impl_OrbServer, + public virtual ::PortableServer::ServantBase + { + public: + virtual ~OrbServer(); + + inline ::plpbus_orb::OrbServer_ptr _this() { + return (::plpbus_orb::OrbServer_ptr) _do_this(::plpbus_orb::OrbServer::_PD_repoId); + } + }; + + template + class OrbServer_tie : public virtual OrbServer + { + public: + OrbServer_tie(_omniT& t) + : pd_obj(&t), pd_poa(0), pd_rel(0) {} + OrbServer_tie(_omniT& t, ::PortableServer::POA_ptr p) + : pd_obj(&t), pd_poa(p), pd_rel(0) {} + OrbServer_tie(_omniT* t, _CORBA_Boolean r=1) + : pd_obj(t), pd_poa(0), pd_rel(r) {} + OrbServer_tie(_omniT* t, ::PortableServer::POA_ptr p,_CORBA_Boolean r=1) + : pd_obj(t), pd_poa(p), pd_rel(r) {} + ~OrbServer_tie() { + if( pd_poa ) ::CORBA::release(pd_poa); + if( pd_rel ) delete pd_obj; + } + + _omniT* _tied_object() { return pd_obj; } + + void _tied_object(_omniT& t) { + if( pd_rel ) delete pd_obj; + pd_obj = &t; + pd_rel = 0; + } + + void _tied_object(_omniT* t, _CORBA_Boolean r=1) { + if( pd_rel ) delete pd_obj; + pd_obj = t; + pd_rel = r; + } + + _CORBA_Boolean _is_owner() { return pd_rel; } + void _is_owner(_CORBA_Boolean io) { pd_rel = io; } + + ::PortableServer::POA_ptr _default_POA() { + if( !pd_poa ) return ::PortableServer::POA::_the_root_poa(); + else return ::PortableServer::POA::_duplicate(pd_poa); + } + + void send_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param) { pd_obj->send_message_and_request_response(response_listener_param, msg_param); } + void send_dataitem_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const plpbus_orb::DataItemSequence& req_seq_param) { pd_obj->send_dataitem_message_and_request_response(response_listener_param, req_seq_param); } + char* send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) { return pd_obj->send_message_and_wait_response(msg_req_param, err_flg); } + ::CORBA::Long send_dataitem_message_and_wait_response(const plpbus_orb::DataItemSequence& req_seq_param, plpbus_orb::DataItemSequence_out rsp_seq_param) { return pd_obj->send_dataitem_message_and_wait_response(req_seq_param, rsp_seq_param); } + void add_event_listener(plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs) { pd_obj->add_event_listener(callback_client_param, msg_param, period_secs); } + void shutdown() { pd_obj->shutdown(); } + + + private: + _omniT* pd_obj; + ::PortableServer::POA_ptr pd_poa; + _CORBA_Boolean pd_rel; + }; + +_CORBA_MODULE_END + + + +_CORBA_MODULE OBV_plpbus_orb +_CORBA_MODULE_BEG + +_CORBA_MODULE_END + + + + + +#undef _core_attr +#undef _dyn_attr + +extern void operator<<=(::CORBA::Any& _a, const plpbus_orb::DataItem& _s); +extern void operator<<=(::CORBA::Any& _a, plpbus_orb::DataItem* _sp); +extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::DataItem*& _sp); +extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const plpbus_orb::DataItem*& _sp); + +void operator<<=(::CORBA::Any& _a, const plpbus_orb::DataItemSequence& _s); +void operator<<=(::CORBA::Any& _a, plpbus_orb::DataItemSequence* _sp); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::DataItemSequence*& _sp); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const plpbus_orb::DataItemSequence*& _sp); + +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbClient_ptr _s); +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbClient_ptr* _s); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::OrbClient_ptr& _s); + +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbServer_ptr _s); +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbServer_ptr* _s); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::OrbServer_ptr& _s); + + + +inline void +plpbus_orb::OrbClient::_marshalObjRef(::plpbus_orb::OrbClient_ptr obj, cdrStream& s) { + omniObjRef::_marshal(obj->_PR_getobj(),s); +} + + +inline void +plpbus_orb::OrbServer::_marshalObjRef(::plpbus_orb::OrbServer_ptr obj, cdrStream& s) { + omniObjRef::_marshal(obj->_PR_getobj(),s); +} + + + + +#ifdef USE_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +# undef USE_stub_in_nt_dll +# undef USE_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifdef USE_core_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +# undef USE_core_stub_in_nt_dll +# undef USE_core_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifdef USE_dyn_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +# undef USE_dyn_stub_in_nt_dll +# undef USE_dyn_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif + +#endif // __RequestResponseBus_hh__ + diff --git a/src/idl/RequestResponseBus.idl b/src/idl/RequestResponseBus.idl new file mode 100644 index 0000000..cf5f9fe --- /dev/null +++ b/src/idl/RequestResponseBus.idl @@ -0,0 +1,40 @@ +#ifndef __ECHO_CALLBACK_IDL__ +#define __ECHO_CALLBACK_IDL__ + +module plpbus_orb { + struct DataItem { + string name; + any value; + }; + + typedef sequence DataItemSequence; + + + interface OrbClient { + // send event to orb client + void receive_event_message(in string event_param); + void receive_event_dataitem_sequence(in DataItemSequence event_param); + // send message to orb client + void receive_response_message(in string msg_rsp_param); + void receive_response_dataitem_sequence(in DataItemSequence msg_rsp_param); + }; + + interface OrbServer { + // send message to server and then call back to client + void send_message_and_request_response(in OrbClient response_listener_param, in string msg_param); + void send_dataitem_message_and_request_response(in OrbClient response_listener_param, in DataItemSequence req_seq_param); + + // send message to server and wait response + string send_message_and_wait_response(in string msg_req_param, out long err_flg); + long send_dataitem_message_and_wait_response(in DataItemSequence req_seq_param, out DataItemSequence rsp_seq_param); + + // register listening events periodically + void add_event_listener(in OrbClient callback_client_param, + in string msg_param, + in unsigned short period_secs); + // send shutdown request to server + void shutdown(); + }; +}; + +#endif diff --git a/src/idl/RequestResponseBusDynSK.cc b/src/idl/RequestResponseBusDynSK.cc new file mode 100644 index 0000000..bfd2be9 --- /dev/null +++ b/src/idl/RequestResponseBusDynSK.cc @@ -0,0 +1,270 @@ +// This file is generated by omniidl (C++ backend) - omniORB_4_1. Do not edit. + +#include "RequestResponseBus.hh" + +OMNI_USING_NAMESPACE(omni) + +static const char* _0RL_dyn_library_version = omniORB_4_1_dyn; + +static ::CORBA::TypeCode::_Tracker _0RL_tcTrack(__FILE__); + +static CORBA::PR_structMember _0RL_structmember_plpbus__orb_mDataItem[] = { + {"name", CORBA::TypeCode::PR_string_tc(0, &_0RL_tcTrack)}, + {"value", CORBA::TypeCode::PR_any_tc()} +}; + +#ifdef _0RL_tc_plpbus__orb_mDataItem +# undef _0RL_tc_plpbus__orb_mDataItem +#endif +static CORBA::TypeCode_ptr _0RL_tc_plpbus__orb_mDataItem = CORBA::TypeCode::PR_struct_tc("IDL:plpbus_orb/DataItem:1.0", "DataItem", _0RL_structmember_plpbus__orb_mDataItem, 2, &_0RL_tcTrack); + +#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER) +// MSVC++ does not give the constant external linkage otherwise. +namespace plpbus_orb { + const ::CORBA::TypeCode_ptr _tc_DataItem = _0RL_tc_plpbus__orb_mDataItem; +} +#else +const ::CORBA::TypeCode_ptr plpbus_orb::_tc_DataItem = _0RL_tc_plpbus__orb_mDataItem; +#endif + + + + + + +static CORBA::TypeCode_ptr _0RL_tc_plpbus__orb_mDataItemSequence = CORBA::TypeCode::PR_alias_tc("IDL:plpbus_orb/DataItemSequence:1.0", "DataItemSequence", CORBA::TypeCode::PR_sequence_tc(0, _0RL_tc_plpbus__orb_mDataItem, &_0RL_tcTrack), &_0RL_tcTrack); + + +#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER) +// MSVC++ does not give the constant external linkage otherwise. +namespace plpbus_orb { + const ::CORBA::TypeCode_ptr _tc_DataItemSequence = _0RL_tc_plpbus__orb_mDataItemSequence; +} +#else +const ::CORBA::TypeCode_ptr plpbus_orb::_tc_DataItemSequence = _0RL_tc_plpbus__orb_mDataItemSequence; +#endif + +#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER) +// MSVC++ does not give the constant external linkage otherwise. +namespace plpbus_orb { + const ::CORBA::TypeCode_ptr _tc_OrbClient = CORBA::TypeCode::PR_interface_tc("IDL:plpbus_orb/OrbClient:1.0", "OrbClient", &_0RL_tcTrack); +} +#else +const ::CORBA::TypeCode_ptr plpbus_orb::_tc_OrbClient = CORBA::TypeCode::PR_interface_tc("IDL:plpbus_orb/OrbClient:1.0", "OrbClient", &_0RL_tcTrack); +#endif + +#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER) +// MSVC++ does not give the constant external linkage otherwise. +namespace plpbus_orb { + const ::CORBA::TypeCode_ptr _tc_OrbServer = CORBA::TypeCode::PR_interface_tc("IDL:plpbus_orb/OrbServer:1.0", "OrbServer", &_0RL_tcTrack); +} +#else +const ::CORBA::TypeCode_ptr plpbus_orb::_tc_OrbServer = CORBA::TypeCode::PR_interface_tc("IDL:plpbus_orb/OrbServer:1.0", "OrbServer", &_0RL_tcTrack); +#endif + +static void _0RL_plpbus__orb_mDataItem_marshal_fn(cdrStream& _s, void* _v) +{ + plpbus_orb::DataItem* _p = (plpbus_orb::DataItem*)_v; + *_p >>= _s; +} +static void _0RL_plpbus__orb_mDataItem_unmarshal_fn(cdrStream& _s, void*& _v) +{ + plpbus_orb::DataItem* _p = new plpbus_orb::DataItem; + *_p <<= _s; + _v = _p; +} +static void _0RL_plpbus__orb_mDataItem_destructor_fn(void* _v) +{ + plpbus_orb::DataItem* _p = (plpbus_orb::DataItem*)_v; + delete _p; +} + +void operator<<=(::CORBA::Any& _a, const plpbus_orb::DataItem& _s) +{ + plpbus_orb::DataItem* _p = new plpbus_orb::DataItem(_s); + _a.PR_insert(_0RL_tc_plpbus__orb_mDataItem, + _0RL_plpbus__orb_mDataItem_marshal_fn, + _0RL_plpbus__orb_mDataItem_destructor_fn, + _p); +} +void operator<<=(::CORBA::Any& _a, plpbus_orb::DataItem* _sp) +{ + _a.PR_insert(_0RL_tc_plpbus__orb_mDataItem, + _0RL_plpbus__orb_mDataItem_marshal_fn, + _0RL_plpbus__orb_mDataItem_destructor_fn, + _sp); +} + +::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::DataItem*& _sp) +{ + return _a >>= (const plpbus_orb::DataItem*&) _sp; +} +::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, const plpbus_orb::DataItem*& _sp) +{ + void* _v; + if (_a.PR_extract(_0RL_tc_plpbus__orb_mDataItem, + _0RL_plpbus__orb_mDataItem_unmarshal_fn, + _0RL_plpbus__orb_mDataItem_marshal_fn, + _0RL_plpbus__orb_mDataItem_destructor_fn, + _v)) { + _sp = (const plpbus_orb::DataItem*)_v; + return 1; + } + return 0; +} + +static void _0RL_plpbus__orb_mDataItemSequence_marshal_fn(cdrStream& _s, void* _v) +{ + plpbus_orb::DataItemSequence* _p = (plpbus_orb::DataItemSequence*)_v; + *_p >>= _s; +} +static void _0RL_plpbus__orb_mDataItemSequence_unmarshal_fn(cdrStream& _s, void*& _v) +{ + plpbus_orb::DataItemSequence* _p = new plpbus_orb::DataItemSequence; + *_p <<= _s; + _v = _p; +} +static void _0RL_plpbus__orb_mDataItemSequence_destructor_fn(void* _v) +{ + plpbus_orb::DataItemSequence* _p = (plpbus_orb::DataItemSequence*)_v; + delete _p; +} + +void operator<<=(::CORBA::Any& _a, const plpbus_orb::DataItemSequence& _s) +{ + plpbus_orb::DataItemSequence* _p = new plpbus_orb::DataItemSequence(_s); + _a.PR_insert(_0RL_tc_plpbus__orb_mDataItemSequence, + _0RL_plpbus__orb_mDataItemSequence_marshal_fn, + _0RL_plpbus__orb_mDataItemSequence_destructor_fn, + _p); +} +void operator<<=(::CORBA::Any& _a, plpbus_orb::DataItemSequence* _sp) +{ + _a.PR_insert(_0RL_tc_plpbus__orb_mDataItemSequence, + _0RL_plpbus__orb_mDataItemSequence_marshal_fn, + _0RL_plpbus__orb_mDataItemSequence_destructor_fn, + _sp); +} + +::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::DataItemSequence*& _sp) +{ + return _a >>= (const plpbus_orb::DataItemSequence*&) _sp; +} +::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, const plpbus_orb::DataItemSequence*& _sp) +{ + void* _v; + if (_a.PR_extract(_0RL_tc_plpbus__orb_mDataItemSequence, + _0RL_plpbus__orb_mDataItemSequence_unmarshal_fn, + _0RL_plpbus__orb_mDataItemSequence_marshal_fn, + _0RL_plpbus__orb_mDataItemSequence_destructor_fn, + _v)) { + _sp = (const plpbus_orb::DataItemSequence*)_v; + return 1; + } + return 0; +} + +static void _0RL_plpbus__orb_mOrbClient_marshal_fn(cdrStream& _s, void* _v) +{ + omniObjRef* _o = (omniObjRef*)_v; + omniObjRef::_marshal(_o, _s); +} +static void _0RL_plpbus__orb_mOrbClient_unmarshal_fn(cdrStream& _s, void*& _v) +{ + omniObjRef* _o = omniObjRef::_unMarshal(plpbus_orb::OrbClient::_PD_repoId, _s); + _v = _o; +} +static void _0RL_plpbus__orb_mOrbClient_destructor_fn(void* _v) +{ + omniObjRef* _o = (omniObjRef*)_v; + if (_o) + omni::releaseObjRef(_o); +} + +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbClient_ptr _o) +{ + plpbus_orb::OrbClient_ptr _no = plpbus_orb::OrbClient::_duplicate(_o); + _a.PR_insert(plpbus_orb::_tc_OrbClient, + _0RL_plpbus__orb_mOrbClient_marshal_fn, + _0RL_plpbus__orb_mOrbClient_destructor_fn, + _no->_PR_getobj()); +} +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbClient_ptr* _op) +{ + _a.PR_insert(plpbus_orb::_tc_OrbClient, + _0RL_plpbus__orb_mOrbClient_marshal_fn, + _0RL_plpbus__orb_mOrbClient_destructor_fn, + (*_op)->_PR_getobj()); + *_op = plpbus_orb::OrbClient::_nil(); +} + +::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::OrbClient_ptr& _o) +{ + void* _v; + if (_a.PR_extract(plpbus_orb::_tc_OrbClient, + _0RL_plpbus__orb_mOrbClient_unmarshal_fn, + _0RL_plpbus__orb_mOrbClient_marshal_fn, + _0RL_plpbus__orb_mOrbClient_destructor_fn, + _v)) { + omniObjRef* _r = (omniObjRef*)_v; + if (_r) + _o = (plpbus_orb::OrbClient_ptr)_r->_ptrToObjRef(plpbus_orb::OrbClient::_PD_repoId); + else + _o = plpbus_orb::OrbClient::_nil(); + return 1; + } + return 0; +} + +static void _0RL_plpbus__orb_mOrbServer_marshal_fn(cdrStream& _s, void* _v) +{ + omniObjRef* _o = (omniObjRef*)_v; + omniObjRef::_marshal(_o, _s); +} +static void _0RL_plpbus__orb_mOrbServer_unmarshal_fn(cdrStream& _s, void*& _v) +{ + omniObjRef* _o = omniObjRef::_unMarshal(plpbus_orb::OrbServer::_PD_repoId, _s); + _v = _o; +} +static void _0RL_plpbus__orb_mOrbServer_destructor_fn(void* _v) +{ + omniObjRef* _o = (omniObjRef*)_v; + if (_o) + omni::releaseObjRef(_o); +} + +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbServer_ptr _o) +{ + plpbus_orb::OrbServer_ptr _no = plpbus_orb::OrbServer::_duplicate(_o); + _a.PR_insert(plpbus_orb::_tc_OrbServer, + _0RL_plpbus__orb_mOrbServer_marshal_fn, + _0RL_plpbus__orb_mOrbServer_destructor_fn, + _no->_PR_getobj()); +} +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbServer_ptr* _op) +{ + _a.PR_insert(plpbus_orb::_tc_OrbServer, + _0RL_plpbus__orb_mOrbServer_marshal_fn, + _0RL_plpbus__orb_mOrbServer_destructor_fn, + (*_op)->_PR_getobj()); + *_op = plpbus_orb::OrbServer::_nil(); +} + +::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::OrbServer_ptr& _o) +{ + void* _v; + if (_a.PR_extract(plpbus_orb::_tc_OrbServer, + _0RL_plpbus__orb_mOrbServer_unmarshal_fn, + _0RL_plpbus__orb_mOrbServer_marshal_fn, + _0RL_plpbus__orb_mOrbServer_destructor_fn, + _v)) { + omniObjRef* _r = (omniObjRef*)_v; + if (_r) + _o = (plpbus_orb::OrbServer_ptr)_r->_ptrToObjRef(plpbus_orb::OrbServer::_PD_repoId); + else + _o = plpbus_orb::OrbServer::_nil(); + return 1; + } + return 0; +} + diff --git a/src/idl/RequestResponseBusSK.cc b/src/idl/RequestResponseBusSK.cc new file mode 100644 index 0000000..9877936 --- /dev/null +++ b/src/idl/RequestResponseBusSK.cc @@ -0,0 +1,1012 @@ +// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit. + +#include "RequestResponseBus.hh" +#include +#include +#include +#include +#include + + +OMNI_USING_NAMESPACE(omni) + +static const char* _0RL_library_version = omniORB_4_1; + + + +void +plpbus_orb::DataItem::operator>>= (cdrStream &_n) const +{ + _n.marshalString(name,0); + (const ::CORBA::Any&) value >>= _n; + +} + +void +plpbus_orb::DataItem::operator<<= (cdrStream &_n) +{ + name = _n.unmarshalString(0); + (::CORBA::Any&)value <<= _n; + +} + +plpbus_orb::OrbClient_ptr plpbus_orb::OrbClient_Helper::_nil() { + return ::plpbus_orb::OrbClient::_nil(); +} + +::CORBA::Boolean plpbus_orb::OrbClient_Helper::is_nil(::plpbus_orb::OrbClient_ptr p) { + return ::CORBA::is_nil(p); + +} + +void plpbus_orb::OrbClient_Helper::release(::plpbus_orb::OrbClient_ptr p) { + ::CORBA::release(p); +} + +void plpbus_orb::OrbClient_Helper::marshalObjRef(::plpbus_orb::OrbClient_ptr obj, cdrStream& s) { + ::plpbus_orb::OrbClient::_marshalObjRef(obj, s); +} + +plpbus_orb::OrbClient_ptr plpbus_orb::OrbClient_Helper::unmarshalObjRef(cdrStream& s) { + return ::plpbus_orb::OrbClient::_unmarshalObjRef(s); +} + +void plpbus_orb::OrbClient_Helper::duplicate(::plpbus_orb::OrbClient_ptr obj) { + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); +} + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_duplicate(::plpbus_orb::OrbClient_ptr obj) +{ + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); + return obj; +} + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId); + return e ? e : _nil(); +} + + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_unchecked_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); + return e ? e : _nil(); +} + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_nil() +{ +#ifdef OMNI_UNLOADABLE_STUBS + static _objref_OrbClient _the_nil_obj; + return &_the_nil_obj; +#else + static _objref_OrbClient* _the_nil_ptr = 0; + if( !_the_nil_ptr ) { + omni::nilRefLock().lock(); + if( !_the_nil_ptr ) { + _the_nil_ptr = new _objref_OrbClient; + registerNilCorbaObject(_the_nil_ptr); + } + omni::nilRefLock().unlock(); + } + return _the_nil_ptr; +#endif +} + +const char* plpbus_orb::OrbClient::_PD_repoId = "IDL:plpbus_orb/OrbClient:1.0"; + + +plpbus_orb::_objref_OrbClient::~_objref_OrbClient() { + +} + + +plpbus_orb::_objref_OrbClient::_objref_OrbClient(omniIOR* ior, omniIdentity* id) : + omniObjRef(::plpbus_orb::OrbClient::_PD_repoId, ior, id, 1) + + +{ + _PR_setobj(this); +} + +void* +plpbus_orb::_objref_OrbClient::_ptrToObjRef(const char* id) +{ + if( id == ::plpbus_orb::OrbClient::_PD_repoId ) + return (::plpbus_orb::OrbClient_ptr) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (::CORBA::Object_ptr) this; + + if( omni::strMatch(id, ::plpbus_orb::OrbClient::_PD_repoId) ) + return (::plpbus_orb::OrbClient_ptr) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (::CORBA::Object_ptr) this; + + return 0; +} + +// Proxy call descriptor class. Mangled signature: +// void_i_cstring +class _0RL_cd_00d6793dc2c2a80c_00000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_00000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + ::CORBA::String_var arg_0_; + const char* arg_0; +}; + +void _0RL_cd_00d6793dc2c2a80c_00000000::marshalArguments(cdrStream& _n) +{ + _n.marshalString(arg_0,0); + +} + +void _0RL_cd_00d6793dc2c2a80c_00000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = _n.unmarshalString(0); + arg_0 = arg_0_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_00000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_10000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_00000000* tcd = (_0RL_cd_00d6793dc2c2a80c_00000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_event_message(tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_event_message(const char* event_param) +{ + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_10000000, "receive_event_message", 22); + _call_desc.arg_0 = event_param; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mDataItemSequence +class _0RL_cd_00d6793dc2c2a80c_20000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_20000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::DataItemSequence_var arg_0_; + const plpbus_orb::DataItemSequence* arg_0; +}; + +void _0RL_cd_00d6793dc2c2a80c_20000000::marshalArguments(cdrStream& _n) +{ + (const plpbus_orb::DataItemSequence&) *arg_0 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_20000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_0_ <<= _n; + arg_0 = &arg_0_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_20000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_30000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_20000000* tcd = (_0RL_cd_00d6793dc2c2a80c_20000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_event_dataitem_sequence(*tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param) +{ + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_30000000, "receive_event_dataitem_sequence", 32); + _call_desc.arg_0 = &(::plpbus_orb::DataItemSequence&) event_param; + + _invoke(_call_desc); + + + +} +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_40000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_00000000* tcd = (_0RL_cd_00d6793dc2c2a80c_00000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_response_message(tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_response_message(const char* msg_rsp_param) +{ + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_40000000, "receive_response_message", 25); + _call_desc.arg_0 = msg_rsp_param; + + _invoke(_call_desc); + + + +} +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_50000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_20000000* tcd = (_0RL_cd_00d6793dc2c2a80c_20000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_response_dataitem_sequence(*tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param) +{ + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_50000000, "receive_response_dataitem_sequence", 35); + _call_desc.arg_0 = &(::plpbus_orb::DataItemSequence&) msg_rsp_param; + + _invoke(_call_desc); + + + +} +plpbus_orb::_pof_OrbClient::~_pof_OrbClient() {} + + +omniObjRef* +plpbus_orb::_pof_OrbClient::newObjRef(omniIOR* ior, omniIdentity* id) +{ + return new ::plpbus_orb::_objref_OrbClient(ior, id); +} + + +::CORBA::Boolean +plpbus_orb::_pof_OrbClient::is_a(const char* id) const +{ + if( omni::ptrStrMatch(id, ::plpbus_orb::OrbClient::_PD_repoId) ) + return 1; + + return 0; +} + +const plpbus_orb::_pof_OrbClient _the_pof_plpbus__orb_mOrbClient; + +plpbus_orb::_impl_OrbClient::~_impl_OrbClient() {} + + +::CORBA::Boolean +plpbus_orb::_impl_OrbClient::_dispatch(omniCallHandle& _handle) +{ + const char* op = _handle.operation_name(); + + if( omni::strMatch(op, "receive_event_message") ) { + + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_10000000, "receive_event_message", 22, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "receive_event_dataitem_sequence") ) { + + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_30000000, "receive_event_dataitem_sequence", 32, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "receive_response_message") ) { + + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_40000000, "receive_response_message", 25, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "receive_response_dataitem_sequence") ) { + + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_50000000, "receive_response_dataitem_sequence", 35, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + + return 0; +} + +void* +plpbus_orb::_impl_OrbClient::_ptrToInterface(const char* id) +{ + if( id == ::plpbus_orb::OrbClient::_PD_repoId ) + return (::plpbus_orb::_impl_OrbClient*) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (void*) 1; + + if( omni::strMatch(id, ::plpbus_orb::OrbClient::_PD_repoId) ) + return (::plpbus_orb::_impl_OrbClient*) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (void*) 1; + return 0; +} + +const char* +plpbus_orb::_impl_OrbClient::_mostDerivedRepoId() +{ + return ::plpbus_orb::OrbClient::_PD_repoId; +} + +plpbus_orb::OrbServer_ptr plpbus_orb::OrbServer_Helper::_nil() { + return ::plpbus_orb::OrbServer::_nil(); +} + +::CORBA::Boolean plpbus_orb::OrbServer_Helper::is_nil(::plpbus_orb::OrbServer_ptr p) { + return ::CORBA::is_nil(p); + +} + +void plpbus_orb::OrbServer_Helper::release(::plpbus_orb::OrbServer_ptr p) { + ::CORBA::release(p); +} + +void plpbus_orb::OrbServer_Helper::marshalObjRef(::plpbus_orb::OrbServer_ptr obj, cdrStream& s) { + ::plpbus_orb::OrbServer::_marshalObjRef(obj, s); +} + +plpbus_orb::OrbServer_ptr plpbus_orb::OrbServer_Helper::unmarshalObjRef(cdrStream& s) { + return ::plpbus_orb::OrbServer::_unmarshalObjRef(s); +} + +void plpbus_orb::OrbServer_Helper::duplicate(::plpbus_orb::OrbServer_ptr obj) { + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); +} + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_duplicate(::plpbus_orb::OrbServer_ptr obj) +{ + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); + return obj; +} + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId); + return e ? e : _nil(); +} + + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_unchecked_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); + return e ? e : _nil(); +} + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_nil() +{ +#ifdef OMNI_UNLOADABLE_STUBS + static _objref_OrbServer _the_nil_obj; + return &_the_nil_obj; +#else + static _objref_OrbServer* _the_nil_ptr = 0; + if( !_the_nil_ptr ) { + omni::nilRefLock().lock(); + if( !_the_nil_ptr ) { + _the_nil_ptr = new _objref_OrbServer; + registerNilCorbaObject(_the_nil_ptr); + } + omni::nilRefLock().unlock(); + } + return _the_nil_ptr; +#endif +} + +const char* plpbus_orb::OrbServer::_PD_repoId = "IDL:plpbus_orb/OrbServer:1.0"; + + +plpbus_orb::_objref_OrbServer::~_objref_OrbServer() { + +} + + +plpbus_orb::_objref_OrbServer::_objref_OrbServer(omniIOR* ior, omniIdentity* id) : + omniObjRef(::plpbus_orb::OrbServer::_PD_repoId, ior, id, 1) + + +{ + _PR_setobj(this); +} + +void* +plpbus_orb::_objref_OrbServer::_ptrToObjRef(const char* id) +{ + if( id == ::plpbus_orb::OrbServer::_PD_repoId ) + return (::plpbus_orb::OrbServer_ptr) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (::CORBA::Object_ptr) this; + + if( omni::strMatch(id, ::plpbus_orb::OrbServer::_PD_repoId) ) + return (::plpbus_orb::OrbServer_ptr) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (::CORBA::Object_ptr) this; + + return 0; +} + +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mOrbClient_i_cstring +class _0RL_cd_00d6793dc2c2a80c_60000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_60000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::OrbClient_var arg_0_; + plpbus_orb::OrbClient_ptr arg_0; + ::CORBA::String_var arg_1_; + const char* arg_1; +}; + +void _0RL_cd_00d6793dc2c2a80c_60000000::marshalArguments(cdrStream& _n) +{ + plpbus_orb::OrbClient::_marshalObjRef(arg_0,_n); + _n.marshalString(arg_1,0); + +} + +void _0RL_cd_00d6793dc2c2a80c_60000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = plpbus_orb::OrbClient::_unmarshalObjRef(_n); + arg_0 = arg_0_.in(); + arg_1_ = _n.unmarshalString(0); + arg_1 = arg_1_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_60000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_70000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_60000000* tcd = (_0RL_cd_00d6793dc2c2a80c_60000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->send_message_and_request_response(tcd->arg_0, tcd->arg_1); + + +} + +void plpbus_orb::_objref_OrbServer::send_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param) +{ + _0RL_cd_00d6793dc2c2a80c_60000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_70000000, "send_message_and_request_response", 34); + _call_desc.arg_0 = response_listener_param; + _call_desc.arg_1 = msg_param; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mOrbClient_i_cplpbus__orb_mDataItemSequence +class _0RL_cd_00d6793dc2c2a80c_80000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_80000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::OrbClient_var arg_0_; + plpbus_orb::OrbClient_ptr arg_0; + plpbus_orb::DataItemSequence_var arg_1_; + const plpbus_orb::DataItemSequence* arg_1; +}; + +void _0RL_cd_00d6793dc2c2a80c_80000000::marshalArguments(cdrStream& _n) +{ + plpbus_orb::OrbClient::_marshalObjRef(arg_0,_n); + (const plpbus_orb::DataItemSequence&) *arg_1 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_80000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = plpbus_orb::OrbClient::_unmarshalObjRef(_n); + arg_0 = arg_0_.in(); + arg_1_ = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_1_ <<= _n; + arg_1 = &arg_1_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_80000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_90000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_80000000* tcd = (_0RL_cd_00d6793dc2c2a80c_80000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->send_dataitem_message_and_request_response(tcd->arg_0, *tcd->arg_1); + + +} + +void plpbus_orb::_objref_OrbServer::send_dataitem_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param) +{ + _0RL_cd_00d6793dc2c2a80c_80000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_90000000, "send_dataitem_message_and_request_response", 43); + _call_desc.arg_0 = response_listener_param; + _call_desc.arg_1 = &(::plpbus_orb::DataItemSequence&) req_seq_param; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// _cstring_i_cstring_o_clong +class _0RL_cd_00d6793dc2c2a80c_a0000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_a0000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + void unmarshalReturnedValues(cdrStream&); + void marshalReturnedValues(cdrStream&); + + + static const char* const _user_exns[]; + + ::CORBA::String_var arg_0_; + const char* arg_0; + ::CORBA::Long arg_1; + ::CORBA::String_var result; +}; + +void _0RL_cd_00d6793dc2c2a80c_a0000000::marshalArguments(cdrStream& _n) +{ + _n.marshalString(arg_0,0); + +} + +void _0RL_cd_00d6793dc2c2a80c_a0000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = _n.unmarshalString(0); + arg_0 = arg_0_.in(); + +} + +void _0RL_cd_00d6793dc2c2a80c_a0000000::marshalReturnedValues(cdrStream& _n) +{ + _n.marshalString(result,0); + arg_1 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_a0000000::unmarshalReturnedValues(cdrStream& _n) +{ + result = _n.unmarshalString(0); + (::CORBA::Long&)arg_1 <<= _n; + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_a0000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_b0000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_a0000000* tcd = (_0RL_cd_00d6793dc2c2a80c_a0000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + tcd->result = impl->send_message_and_wait_response(tcd->arg_0, tcd->arg_1); + + +} + +char* plpbus_orb::_objref_OrbServer::send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) +{ + _0RL_cd_00d6793dc2c2a80c_a0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_b0000000, "send_message_and_wait_response", 31); + _call_desc.arg_0 = msg_req_param; + + _invoke(_call_desc); + err_flg = _call_desc.arg_1; + return _call_desc.result._retn(); + + +} +// Proxy call descriptor class. Mangled signature: +// _clong_i_cplpbus__orb_mDataItemSequence_o_cplpbus__orb_mDataItemSequence +class _0RL_cd_00d6793dc2c2a80c_c0000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_c0000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + void unmarshalReturnedValues(cdrStream&); + void marshalReturnedValues(cdrStream&); + + + static const char* const _user_exns[]; + + plpbus_orb::DataItemSequence_var arg_0_; + const plpbus_orb::DataItemSequence* arg_0; + plpbus_orb::DataItemSequence_var arg_1; + ::CORBA::Long result; +}; + +void _0RL_cd_00d6793dc2c2a80c_c0000000::marshalArguments(cdrStream& _n) +{ + (const plpbus_orb::DataItemSequence&) *arg_0 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_c0000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_0_ <<= _n; + arg_0 = &arg_0_.in(); + +} + +void _0RL_cd_00d6793dc2c2a80c_c0000000::marshalReturnedValues(cdrStream& _n) +{ + result >>= _n; + (const plpbus_orb::DataItemSequence&) arg_1 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_c0000000::unmarshalReturnedValues(cdrStream& _n) +{ + (::CORBA::Long&)result <<= _n; + arg_1 = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_1 <<= _n; + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_c0000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_d0000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_c0000000* tcd = (_0RL_cd_00d6793dc2c2a80c_c0000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + tcd->result = impl->send_dataitem_message_and_wait_response(*tcd->arg_0, tcd->arg_1.out()); + + +} + +::CORBA::Long plpbus_orb::_objref_OrbServer::send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param) +{ + _0RL_cd_00d6793dc2c2a80c_c0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_d0000000, "send_dataitem_message_and_wait_response", 40); + _call_desc.arg_0 = &(::plpbus_orb::DataItemSequence&) req_seq_param; + + _invoke(_call_desc); + rsp_seq_param = _call_desc.arg_1._retn(); + return _call_desc.result; + + +} +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mOrbClient_i_cstring_i_cunsigned_pshort +class _0RL_cd_00d6793dc2c2a80c_e0000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_e0000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::OrbClient_var arg_0_; + plpbus_orb::OrbClient_ptr arg_0; + ::CORBA::String_var arg_1_; + const char* arg_1; + ::CORBA::UShort arg_2; +}; + +void _0RL_cd_00d6793dc2c2a80c_e0000000::marshalArguments(cdrStream& _n) +{ + plpbus_orb::OrbClient::_marshalObjRef(arg_0,_n); + _n.marshalString(arg_1,0); + arg_2 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_e0000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = plpbus_orb::OrbClient::_unmarshalObjRef(_n); + arg_0 = arg_0_.in(); + arg_1_ = _n.unmarshalString(0); + arg_1 = arg_1_.in(); + (::CORBA::UShort&)arg_2 <<= _n; + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_e0000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_f0000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_e0000000* tcd = (_0RL_cd_00d6793dc2c2a80c_e0000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->add_event_listener(tcd->arg_0, tcd->arg_1, tcd->arg_2); + + +} + +void plpbus_orb::_objref_OrbServer::add_event_listener(::plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs) +{ + _0RL_cd_00d6793dc2c2a80c_e0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_f0000000, "add_event_listener", 19); + _call_desc.arg_0 = callback_client_param; + _call_desc.arg_1 = msg_param; + _call_desc.arg_2 = period_secs; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// void +class _0RL_cd_00d6793dc2c2a80c_01000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_01000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + + + + static const char* const _user_exns[]; + + +}; + +const char* const _0RL_cd_00d6793dc2c2a80c_01000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_11000000(omniCallDescriptor*, omniServant* svnt) +{ + + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->shutdown(); + + +} + +void plpbus_orb::_objref_OrbServer::shutdown() +{ + _0RL_cd_00d6793dc2c2a80c_01000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_11000000, "shutdown", 9); + + + _invoke(_call_desc); + + + +} +plpbus_orb::_pof_OrbServer::~_pof_OrbServer() {} + + +omniObjRef* +plpbus_orb::_pof_OrbServer::newObjRef(omniIOR* ior, omniIdentity* id) +{ + return new ::plpbus_orb::_objref_OrbServer(ior, id); +} + + +::CORBA::Boolean +plpbus_orb::_pof_OrbServer::is_a(const char* id) const +{ + if( omni::ptrStrMatch(id, ::plpbus_orb::OrbServer::_PD_repoId) ) + return 1; + + return 0; +} + +const plpbus_orb::_pof_OrbServer _the_pof_plpbus__orb_mOrbServer; + +plpbus_orb::_impl_OrbServer::~_impl_OrbServer() {} + + +::CORBA::Boolean +plpbus_orb::_impl_OrbServer::_dispatch(omniCallHandle& _handle) +{ + const char* op = _handle.operation_name(); + + if( omni::strMatch(op, "send_message_and_request_response") ) { + + _0RL_cd_00d6793dc2c2a80c_60000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_70000000, "send_message_and_request_response", 34, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "send_dataitem_message_and_request_response") ) { + + _0RL_cd_00d6793dc2c2a80c_80000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_90000000, "send_dataitem_message_and_request_response", 43, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "send_message_and_wait_response") ) { + + _0RL_cd_00d6793dc2c2a80c_a0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_b0000000, "send_message_and_wait_response", 31, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "send_dataitem_message_and_wait_response") ) { + + _0RL_cd_00d6793dc2c2a80c_c0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_d0000000, "send_dataitem_message_and_wait_response", 40, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "add_event_listener") ) { + + _0RL_cd_00d6793dc2c2a80c_e0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_f0000000, "add_event_listener", 19, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "shutdown") ) { + + _0RL_cd_00d6793dc2c2a80c_01000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_11000000, "shutdown", 9, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + + return 0; +} + +void* +plpbus_orb::_impl_OrbServer::_ptrToInterface(const char* id) +{ + if( id == ::plpbus_orb::OrbServer::_PD_repoId ) + return (::plpbus_orb::_impl_OrbServer*) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (void*) 1; + + if( omni::strMatch(id, ::plpbus_orb::OrbServer::_PD_repoId) ) + return (::plpbus_orb::_impl_OrbServer*) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (void*) 1; + return 0; +} + +const char* +plpbus_orb::_impl_OrbServer::_mostDerivedRepoId() +{ + return ::plpbus_orb::OrbServer::_PD_repoId; +} + +POA_plpbus_orb::OrbClient::~OrbClient() {} + +POA_plpbus_orb::OrbServer::~OrbServer() {} + diff --git a/src/plpbus/BusClient.cc b/src/plpbus/BusClient.cc new file mode 100644 index 0000000..8c93e1d --- /dev/null +++ b/src/plpbus/BusClient.cc @@ -0,0 +1,242 @@ +/* + * BusClient.cc + * + * Created on: Jun 7, 2010 + * Author: lamikr + */ + +#include "BusClient.hh" +#include "BusMessageInternal.hh" + +using namespace std; +using namespace plpbus; + +class OrbClientImpl : public virtual POA_plpbus_orb::OrbClient +{ + private: + IClientListener *listener; + public: + OrbClientImpl(IClientListener *listener_param) { + listener = listener_param; + } + virtual ~OrbClientImpl() {} + + virtual void receive_event_message(const char *event_param) { + if (listener != NULL) { + listener->event_received(event_param); + } + } + + virtual void receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param) { + BusMessageInternal *bus_msg; + + if (listener != NULL) { + bus_msg = new BusMessageInternal(event_param); + listener->event_received(bus_msg); + } + } + + virtual void receive_response_message(const char *msg_rsp_param) { + if (listener != NULL) { + listener->response_received(msg_rsp_param); + } + } + + virtual void receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param) { + BusMessageInternal *bus_msg; + + if (listener != NULL) { + bus_msg = new BusMessageInternal(msg_rsp_param); + listener->response_received(bus_msg); + } + } +}; + +BusClient::BusClient() +{ + cout << "created" << endl; + _orb = NULL; + _poa = NULL; +} + +BusClient::~BusClient() +{ + if (_orb != NULL) { + _orb->destroy(); + _orb = NULL; + } + cout << "destroyed" << endl; +} + +int BusClient::init(const char *server_name) { + int argc; + char **argv; + CORBA::Object_var server_obj; + + argc = 0; + argv = NULL; + cout << "init() started" << endl; + _orb = CORBA::ORB_init(argc, argv); + if (_orb != NULL) { + cout << "ORB_init() done, finding server: " << server_name << endl; + server_obj = find_server_object_by_name(_orb, + CONST_CONTEXT_NAME__PLPBUS, + CONST_CONTEXT_KIND__PLPBUS, + server_name, + CONST_CONTEXT_NAME__PLPBUS); + if (CORBA::is_nil(server_obj) == false) { + _server = plpbus_orb::OrbServer::_narrow(server_obj); + cout << "Server object found: " << server_name << endl; + } + else { + cerr << "Could not find server object: " << server_name << endl; + } + } + return 0; +} + +int BusClient::add_client_listener(IClientListener *listener_param) { + cout << "add_client_listener() started" << endl; + if (_poa == NULL) { + OrbClientImpl *client_cb; + PortableServer::ObjectId_var oid; + + cout << "register_callback() 1" << endl; + _poa = create_poa(_orb); + client_cb = new OrbClientImpl(listener_param); + oid = _poa->activate_object(client_cb); + _client = client_cb->_this(); + client_cb->_remove_ref(); + _server->add_event_listener(_client, "event_message", CONST_DEFAULT_EVENT_INTERVAL); + } + cout << "add_client_listener() done" << endl; + return 0; +} + +int BusClient::send_message_and_request_response(const char *msg_req_param) { + _server->send_message_and_request_response(_client, msg_req_param); + return 0; +} + +int BusClient::send_message_and_wait_response(const char *msg_req_param, char **msg_rsp_param) { + CORBA::Long ret_val; + + *msg_rsp_param = _server->send_message_and_wait_response(msg_req_param, ret_val); + return ret_val; +} + +int BusClient::send_message_and_request_response(BusMessage *msg_req_param) { + _server->send_dataitem_message_and_request_response(_client, msg_req_param->_dataItemSeq); + return 0; +} + +int BusClient::send_message_and_wait_response(BusMessage *msg_req_param, BusMessage **msg_rsp_param) { + plpbus_orb::DataItemSequence *seq_rsp; + + seq_rsp = NULL; + _server->send_dataitem_message_and_wait_response(msg_req_param->_dataItemSeq, seq_rsp); +} + +void BusClient::request_shutdown() { + if (CORBA::is_nil(_server) == false) { + _server->shutdown(); + } +} + +PortableServer::POA_var BusClient::create_poa(CORBA::ORB_var orb) { + PortableServer::POA_var ret_val; + CORBA::Object_var poa_obj; + CORBA::PolicyList policy_list; + CORBA::Any policyVal; + PortableServer::POAManager_var poa_man; + PortableServer::POA_var rootpoa; + + ret_val = NULL; + poa_obj = orb->resolve_initial_references(CONST_ROOT_POA_NAME); + if (poa_obj != NULL) { + rootpoa = PortableServer::POA::_narrow(poa_obj); + if (rootpoa != NULL) { + poa_man = rootpoa->the_POAManager(); + if (poa_man != NULL) { + poa_man->activate(); + // bidirectional policy + policy_list.length(1); + policyVal <<= BiDirPolicy::BOTH; + policy_list[0] = orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, policyVal); + ret_val = rootpoa->create_POA(CONST_ROOT_POA_BIDIR_POLICY_NAME, + poa_man, + policy_list); + } + } + } + else { + cerr << "Failed to create RootPOA." << endl; + } + return ret_val; +} + +CosNaming::NamingContext_var BusClient::get_name_service_context(CORBA::ORB_var orb_param) { + CORBA::Object_var ns_obj; + CosNaming::NamingContext_var ret_val; + + ret_val = NULL; + try { + ns_obj = orb_param->resolve_initial_references(CONST_NAME_SERVICE_NAME); + if (CORBA::is_nil(ns_obj) == false) { + // narrow the object reference + ret_val = CosNaming::NamingContext::_narrow(ns_obj); + } + } + catch (CORBA::ORB::InvalidName&) { + // This should not happen! + cerr << "Could not find name service." << endl; + } + catch(CORBA::TRANSIENT& ex) { + cerr << "Could not find name service, verify that name service is running. " << endl; + } + catch (CORBA::NO_RESOURCES&) { + cerr << "Could not find name service, verify that name service is running. " << endl; + } + catch(CORBA::SystemException& ex) { + cerr << "Could not find name service, unknown reason. " << endl; + } + return ret_val; +} + +CORBA::Object_var BusClient::find_server_object_by_name(CORBA::ORB_var orb_param, + const char *leaf_name_param, + const char *leaf_kind_param, + const char *service_name_param, + const char *service_kind_param) +{ + CORBA::Object_var ret_val; + CosNaming::NamingContext_var ns_root_context; + CosNaming::Name service_data; + + ret_val = CORBA::Object::_nil(); + ns_root_context = get_name_service_context(orb_param); + if (CORBA::is_nil(ns_root_context) == false) { + // define search criteria + service_data.length(2); + service_data[0].id = leaf_name_param; + service_data[0].kind = leaf_kind_param; + service_data[1].id = service_name_param; + service_data[1].kind = service_kind_param; + try { + ret_val = ns_root_context->resolve(service_data); + } + catch(CosNaming::NamingContext::NotFound& ex) { + cerr << "Could not find service from the name server. " << endl; + } + catch(CORBA::TRANSIENT& ex) { + cerr << "Could not find service from the name server. " << endl; + } + catch(CORBA::SystemException& ex) { + cerr << "Could not find service from the name server, unknown error." << endl; + } + } + else { + cerr << "Could not find naming service. " << endl; + } + return ret_val; +} diff --git a/src/plpbus/BusClient.hh b/src/plpbus/BusClient.hh new file mode 100644 index 0000000..a1fe5dc --- /dev/null +++ b/src/plpbus/BusClient.hh @@ -0,0 +1,54 @@ +/* + * BusClient.hh + * + * Created on: Jun 7, 2010 + * Author: lamikr + */ + +#ifndef PLPBUS_CLIENT_HH_ +#define PLPBUS_CLIENT_HH_ + +#include +#include + +#include "RequestResponseBus.hh" +#include "IClientListener.hh" +#include "ClientServerCommon.hh" +#include "BusMessage.hh" + +namespace plpbus { + class BusClient { + public: + BusClient(); + virtual ~BusClient(); + virtual int init(const char *server_name); + virtual int add_client_listener(IClientListener *listener_param); + virtual int send_message_and_request_response(const char *msg_req_param); + virtual int send_message_and_wait_response(const char *msg_req_param, char **msg_rsp_param); + virtual int send_message_and_request_response(BusMessage *msg_req_param); + virtual int send_message_and_wait_response(BusMessage *msg_req_param, BusMessage **msg_rsp_param); + virtual void request_shutdown(); + private: + PortableServer::POA_var _poa; + CORBA::ORB_var _orb; + plpbus_orb::OrbServer_var _server; + plpbus_orb::OrbClient_var _client; + + PortableServer::POA_var create_poa(CORBA::ORB_var orb); + CosNaming::NamingContext_var get_name_service_context(CORBA::ORB_var orb_param); + /** + * Finds server object by it's name by using following keywords: + * name[0].id = (const char *)CONST_LEAF_CONTEXT_NAME__PLPBUS; + * name[0].kind = (const char *)CONST_CONTEXT_KIND__PLPBUS; + * name[1].id = server_name; + * name[1].kind = (const char *)CONST_CONTEXT_KIND__PLPBUS; + */ + CORBA::Object_var find_server_object_by_name(CORBA::ORB_var orb, + const char *leaf_name_param, + const char *leaf_kind_param, + const char *service_name_param, + const char *service_kind_param); + }; +} + +#endif /* PLPBUS_CLIENT_HH_ */ diff --git a/src/plpbus/BusMessage.cc b/src/plpbus/BusMessage.cc new file mode 100644 index 0000000..2e52f1f --- /dev/null +++ b/src/plpbus/BusMessage.cc @@ -0,0 +1,223 @@ +/* + * BusMessage.cpp + * + * Created on: Aug 17, 2010 + * Author: lamikr + */ + +#include "BusMessage.hh" + +using namespace std; +using namespace plpbus_orb; +using namespace plpbus; +using namespace CORBA; + +BusMessage::BusMessage() +{ + _dataItemSeq.length(0); + +} + +BusMessage::BusMessage(const char *name_param, const char *value_param) +{ + DataItem *item; + + if (name_param != NULL) { + item = new DataItem(); + item->name = strdup(name_param); + item->value <<= strdup(value_param); + + _dataItemSeq.length(1); + _dataItemSeq[0] = *item; + } + else { + _dataItemSeq.length(0); + } + +} + +BusMessage::~BusMessage() +{ + // TODO Auto-generated destructor stub +} + +int BusMessage::add_string_parameter(const char *name_param, const char *value_param) +{ + long length; + int ret_val; + DataItem *item; + + ret_val = 0; + if (name_param != NULL) { + length = _dataItemSeq.length(); + item = new DataItem(); + item->name = strdup(name_param); + if (value_param != NULL) { + item->value <<= strdup(value_param); + _dataItemSeq.length(length + 1); + _dataItemSeq[length] = *item; + } + } + else { + _dataItemSeq.length(0); + ret_val = -1; + } + return ret_val; +} + +int BusMessage::add_long_parameter(const char *name_param, long value_param) +{ + long length; + int ret_val; + DataItem *item; + + ret_val = 0; + if (name_param != NULL) { + length = _dataItemSeq.length(); + item = new DataItem(); + item->name = strdup(name_param); + item->value <<= value_param; + + _dataItemSeq.length(length + 1); + _dataItemSeq[length] = *item; + } + else { + _dataItemSeq.length(0); + ret_val = -1; + } + return ret_val; +} + +int BusMessage::add_int_parameter(const char *name_param, int value_param) +{ + long length; + int ret_val; + DataItem *item; + + ret_val = 0; + if (name_param != NULL) { + length = _dataItemSeq.length(); + item = new DataItem(); + item->name = strdup(name_param); + item->value <<= (long)value_param; + + _dataItemSeq.length(length + 1); + _dataItemSeq[length] = *item; + } + else { + _dataItemSeq.length(0); + ret_val = -1; + } + return ret_val; +} + +int BusMessage::add_double_parameter(const char *name_param, double value_param) +{ + long length; + int ret_val; + DataItem *item; + + ret_val = 0; + if (name_param != NULL) { + length = _dataItemSeq.length(); + item = new DataItem(); + item->name = strdup(name_param); + item->value <<= (long)value_param; + + _dataItemSeq.length(length + 1); + _dataItemSeq[length] = *item; + } + else { + _dataItemSeq.length(0); + ret_val = -1; + } + return ret_val; +} + +int BusMessage::add_float_parameter(const char *name_param, float value_param) +{ + long length; + int ret_val; + DataItem *item; + + ret_val = 0; + if (name_param != NULL) { + length = _dataItemSeq.length(); + item = new DataItem(); + item->name = strdup(name_param); + item->value <<= (long)value_param; + + _dataItemSeq.length(length + 1); + _dataItemSeq[length] = *item; + } + else { + _dataItemSeq.length(0); + ret_val = -1; + } + return ret_val; +} + +void BusMessage::printout_dataitem(long index, plpbus_orb::DataItem *item) { + CORBA::TCKind kind; + + if (item != NULL) { + if (item->name != NULL) { + kind = item->value.type()->kind(); + switch(kind) { + case tk_string: + { + const char *val; + + item->value >>= val; + cout << " [" << index << "] name: " << item->name << ", value: " << val << endl; + } + break; + case tk_long: + { + long val; + item->value >>= val; + cout << " [" << index << "] name: " << item->name << ", value: " << val << endl; + //val_str = strdup("long"); + } + break; + case tk_double: + { + double val; + item->value >>= val; + cout << " [" << index << "] name: " << item->name << ", value: " << val << endl; + //val_str = strdup("double"); + } + break; + case tk_float: + { + float val; + item->value >>= val; + cout << " [" << index << "] name: " << item->name << ", value: " << val << endl; + //val_str = strdup("float"); + } + break; + default: + cout << " [" << index << "] name: " << item->name << ", value unknown. " << endl; + } + } + else { + cout << " [" << index << "] Invalid dataItem, name or value NULL." << endl; + } + } + else { + cout << " [" << index << "] dataItem NULL." << endl; + } +} + +void BusMessage::printout() { + long int count; + DataItem item; + + count = _dataItemSeq.length(); + cout << "BusMessage.printout(): parameter count: " << count << endl; + for (long ii = 0; ii < count; ii++) { + item = _dataItemSeq[ii]; + printout_dataitem(ii, &item); + } + cout << "BusMessage.printout() done" << endl; +} diff --git a/src/plpbus/BusMessage.hh b/src/plpbus/BusMessage.hh new file mode 100644 index 0000000..2436d8b --- /dev/null +++ b/src/plpbus/BusMessage.hh @@ -0,0 +1,36 @@ +/* + * BusMessage.h + * + * Created on: Aug 17, 2010 + * Author: lamikr + */ + +#ifndef BUSMESSAGE_H_ +#define BUSMESSAGE_H_ + +#include +#include + +#include "RequestResponseBus.hh" + +namespace plpbus { + class BusMessage + { + public: + plpbus_orb::DataItemSequence _dataItemSeq; + + BusMessage(); + BusMessage(const char *name_param, const char *string_value_param); + virtual ~BusMessage(); + int add_string_parameter(const char *name_param, const char *string_value_param); + int add_long_parameter(const char *name_param, long value_param); + int add_int_parameter(const char *name_param, int value_param); + int add_double_parameter(const char *name_param, double value_param); + int add_float_parameter(const char *name_param, float value_param); + void printout(); + private: + void printout_dataitem(long index, plpbus_orb::DataItem *item); + }; +} + +#endif /* BUSMESSAGE_H_ */ diff --git a/src/plpbus/BusMessageInternal.cc b/src/plpbus/BusMessageInternal.cc new file mode 100644 index 0000000..6839f79 --- /dev/null +++ b/src/plpbus/BusMessageInternal.cc @@ -0,0 +1,19 @@ +/* + * BusMessageInternal.cc + * + * Created on: Aug 18, 2010 + * Author: lamikr + */ + +#include "BusMessageInternal.hh" + +namespace plpbus { + BusMessageInternal::BusMessageInternal(plpbus_orb::DataItemSequence seq_param) { + _dataItemSeq = seq_param; + } + + BusMessageInternal::~BusMessageInternal() + { + // TODO Auto-generated destructor stub + } +} diff --git a/src/plpbus/BusMessageInternal.hh b/src/plpbus/BusMessageInternal.hh new file mode 100644 index 0000000..e3fa771 --- /dev/null +++ b/src/plpbus/BusMessageInternal.hh @@ -0,0 +1,22 @@ +/* + * BusMessageInternal.hh + * + * Created on: Aug 18, 2010 + * Author: lamikr + */ + +#ifndef BUSMESSAGEINTERNAL_HH_ +#define BUSMESSAGEINTERNAL_HH_ + +#include "BusMessage.hh" + +namespace plpbus { + class BusMessageInternal: public plpbus::BusMessage + { + public: + BusMessageInternal(plpbus_orb::DataItemSequence seq_param); + virtual ~BusMessageInternal(); + }; +} + +#endif /* BUSMESSAGEINTERNAL_HH_ */ diff --git a/src/plpbus/BusServer.cc b/src/plpbus/BusServer.cc new file mode 100644 index 0000000..44281ed --- /dev/null +++ b/src/plpbus/BusServer.cc @@ -0,0 +1,43 @@ +#include "BusServer.hh" + +using namespace std; +using namespace plpbus; + +BusServer::BusServer() +{ + orbServer = new OrbServerImpl(); +} + +BusServer::~BusServer() +{ + cout << "BusServer() destroyed." << endl; +} + +int BusServer::init() { + int retVal; + + retVal = 0; + orbServer->init(); + return retVal; +} + +int BusServer::launch(const char *server_name) +{ + int retVal; + + retVal = orbServer->launch(server_name); + return retVal; +} + +int BusServer::add_server_listener(IServerListener *listener_param) +{ + int retVal; + + retVal = orbServer->add_server_listener(listener_param); + return retVal; +} + +void BusServer::shutdown() +{ + orbServer->shutdown(); +} diff --git a/src/plpbus/BusServer.hh b/src/plpbus/BusServer.hh new file mode 100644 index 0000000..734ba65 --- /dev/null +++ b/src/plpbus/BusServer.hh @@ -0,0 +1,25 @@ +#ifndef BUSSERVER_HH_ +#define BUSSERVER_HH_ + +#include +#include + +#include "RequestResponseBus.hh" +#include "IServerListener.hh" +#include "OrbServerImpl.hh" + +namespace plpbus { + class BusServer { + public: + BusServer(); + virtual ~BusServer(); + virtual int init(); + virtual int launch(const char *server_name); + virtual int add_server_listener(IServerListener *listener_param); + virtual void shutdown(); + private: + OrbServerImpl *orbServer; + }; +} + +#endif // BUSSERVER_HH_ diff --git a/src/plpbus/ClientServerCommon.cc b/src/plpbus/ClientServerCommon.cc new file mode 100644 index 0000000..355980f --- /dev/null +++ b/src/plpbus/ClientServerCommon.cc @@ -0,0 +1,21 @@ +/* + * ClientServerCommon.cpp + * + * Created on: Sep 7, 2010 + * Author: lamikr + */ + +#include "ClientServerCommon.hh" + +using namespace plpbus; + +ClientServerCommon::ClientServerCommon() +{ + // TODO Auto-generated constructor stub + +} + +ClientServerCommon::~ClientServerCommon() +{ + // TODO Auto-generated destructor stub +} diff --git a/src/plpbus/ClientServerCommon.hh b/src/plpbus/ClientServerCommon.hh new file mode 100644 index 0000000..a8113a1 --- /dev/null +++ b/src/plpbus/ClientServerCommon.hh @@ -0,0 +1,30 @@ +/* + * ClientServerCommon.h + * + * Created on: Sep 7, 2010 + * Author: lamikr + */ + +#ifndef CLIENTSERVERCOMMON_H_ +#define CLIENTSERVERCOMMON_H_ + +#include +#include + +#define CONST_NAME_SERVICE_NAME "NameService" +#define CONST_CONTEXT_NAME__PLPBUS "plpbus" +#define CONST_CONTEXT_KIND__PLPBUS "plpbus" +#define CONST_ROOT_POA_NAME "RootPOA" +#define CONST_ROOT_POA_BIDIR_POLICY_NAME "bidir" +#define CONST_DEFAULT_EVENT_INTERVAL 5 + +namespace plpbus { + class ClientServerCommon + { + public: + ClientServerCommon(); + virtual ~ClientServerCommon(); + }; +} + +#endif /* CLIENTSERVERCOMMON_H_ */ diff --git a/src/plpbus/IClientListener.hh b/src/plpbus/IClientListener.hh new file mode 100644 index 0000000..7989e27 --- /dev/null +++ b/src/plpbus/IClientListener.hh @@ -0,0 +1,26 @@ +/* + * plpbus_server_callback.hh + * + * Created on: Jun 10, 2010 + * Author: lamikr + */ + +#ifndef CLIENTLISTENER_HH_ +#define CLIENTLISTENER_HH_ + +#include "BusMessage.hh" + +namespace plpbus { + class IClientListener { + public: + virtual int response_received(const char *msg_rsp_param) = 0; + virtual int response_received(const BusMessage *msg_rsp_param) = 0; + virtual int event_received(const char *event_param) = 0; + virtual int event_received(const BusMessage *event_param) = 0; + protected: + IClientListener() {}; + virtual ~IClientListener() {}; + }; +} + +#endif /* CLIENTLISTENER_HH_ */ diff --git a/src/plpbus/IServerListener.hh b/src/plpbus/IServerListener.hh new file mode 100644 index 0000000..4ea186d --- /dev/null +++ b/src/plpbus/IServerListener.hh @@ -0,0 +1,24 @@ +/* + * ServerCallbackInterface.hh + * + * Created on: Jun 16, 2010 + * Author: lamikr + */ + +#ifndef ISERVERLISTENER_HH_ +#define ISERVERLISTENER_HH_ + +#include "BusMessage.hh" + +namespace plpbus { + class IServerListener { + public: + virtual int request_received(const char *msg_in, char **msg_out) = 0; + virtual int request_received(const BusMessage *msg_req, BusMessage **msg_rsp) = 0; + protected: + IServerListener() {}; + virtual ~IServerListener() {}; + }; +} + +#endif /* ISERVERLISTENER_HH_ */ diff --git a/src/plpbus/OrbServerImpl.cc b/src/plpbus/OrbServerImpl.cc new file mode 100644 index 0000000..d12846e --- /dev/null +++ b/src/plpbus/OrbServerImpl.cc @@ -0,0 +1,351 @@ +/* + * OrbServerImpl.cc + * + * Created on: Aug 11, 2010 + * Author: lamikr + */ + +#include "ServerEventThread.hh" +#include "OrbServerImpl.hh" +#include "ClientServerCommon.hh" +#include "BusMessageInternal.hh" + +using namespace std; +using namespace plpbus; +using namespace plpbus_orb; + +static omni_mutex server_thread_mutex; +static omni_condition server_thread_shutdown_signal(&server_thread_mutex); + +OrbServerImpl::OrbServerImpl() +{ + _orb = NULL; + _poa = NULL; + _server_thread_count = 0; + _shutdown_pending = 0; + _listener = NULL; +} + +OrbServerImpl::~OrbServerImpl() +{ + cout << "OrbServerImpl destroyed." << endl; +} + +void OrbServerImpl::send_message_and_request_response(OrbClient_ptr response_listener_param, + const char* msg_req) +{ + char *msg_rsp; + + msg_rsp = NULL; + if (CORBA::is_nil(response_listener_param) == false) { + if (_listener != NULL) { + cout << "send_message_and_request_response(): " << msg_req << ", server_callback != NULL" << endl; + _listener->request_received(msg_req, &msg_rsp); + response_listener_param->receive_response_message(msg_rsp); + } + else { + cout << "send_message_and_request_response() error! " << msg_req << ", server_callback == NULL" << endl; + } + } + else { + cerr << "invalid callback object received.\n"; + } +} + +char *OrbServerImpl::send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) { + char *msg_rsp; + char *ret_val; + + err_flg = 0; + msg_rsp = NULL; + if (_listener != NULL) { + cout << "send_message_and_wait_response(): " << msg_req_param << ", server_callback != NULL" << endl; + _listener->request_received(msg_req_param, &msg_rsp); + } + else { + cout << "send_message_and_wait_response() error! " << msg_req_param << ", server_callback == NULL" << endl; + msg_rsp = strdup(msg_req_param); + err_flg = -1; + } + ret_val = CORBA::string_dup(msg_rsp); + return ret_val; +} + +void OrbServerImpl::send_dataitem_message_and_request_response(OrbClient_ptr response_listener_param, + const ::DataItemSequence& msg_req_param) { + BusMessage *msg_req; + BusMessage *msg_rsp; + + if (CORBA::is_nil(response_listener_param) == false) { + if (_listener != NULL) { + msg_req = new BusMessageInternal(msg_req_param); + cout << "send_dataitem_message_and_request_response(), server_callback != NULL" << endl; + cout << "msg_req:" << endl; + msg_req->printout(); + msg_rsp = NULL; + _listener->request_received(msg_req, &msg_rsp); + cout << "msg_rsp length:" << msg_rsp->_dataItemSeq.length() << endl; + msg_rsp->printout(); + response_listener_param->receive_response_dataitem_sequence(msg_rsp->_dataItemSeq); + } + else { + cout << "send_dataitem_message_and_request_response() error, server_callback == NULL" << endl; + } + } +} + +CORBA::Long OrbServerImpl::send_dataitem_message_and_wait_response(const DataItemSequence& req_seq_param, + DataItemSequence_out rsp_seq_param) { + BusMessage *msg_req; + BusMessage *msg_rsp; + + msg_req = new BusMessageInternal(req_seq_param); + msg_rsp = NULL; + _listener->request_received(msg_req, &msg_rsp); + //rsp_seq_param = new DataItemSequence_out(msg_rsp._dataItemSeq); + rsp_seq_param._data = &(msg_rsp->_dataItemSeq); + + return 0; +} + +void OrbServerImpl::add_event_listener(OrbClient_ptr client_param, + const char *msg, + CORBA::UShort period_secs) +{ + ServerEventThread *srvr_thread; + + if (CORBA::is_nil(client_param) == false) { + cout << "add_event_listener()" << endl; + server_thread_mutex.lock(); + _server_thread_count++; + server_thread_mutex.unlock(); + srvr_thread = new ServerEventThread(client_param, msg, period_secs, this); + srvr_thread->start(); + } + else { + cerr << "Failed to add event listener, listener NULL.\n"; + } +} + +void OrbServerImpl::shutdown() +{ + omni_mutex_lock sync(server_thread_mutex); + if (is_shutdown_pending() == 0) { + cout << "shutdown request received!" << endl; + // Tell the servers to exit, and wait for them to do so. + _shutdown_pending = 1; + while(_server_thread_count > 0) { + server_thread_shutdown_signal.wait(); + } + // Shutdown the ORB (but do not wait for completion). This also + // causes the main thread to unblock from CORBA::ORB::run(). + _orb->shutdown(0); + } +} + +int OrbServerImpl::init() { + int argc; + char **argv; + int retVal; + + argc = -1; + argv = NULL; + retVal = 0; + _orb = CORBA::ORB_init(argc, argv); + if (_orb != NULL) { + _poa = create_poa(_orb); + retVal = 0; + } + else { + cout << "init() failed" << endl; + } + return retVal; +} + +int OrbServerImpl::launch(const char *server_name) +{ + CORBA::Object_var server_ref; + PortableServer::ObjectId_var server_id; + bool ok_flg; + int ret_val; + CosNaming::NamingContext_var naming_context; + + ret_val = -1; + POA_plpbus_orb::OrbServer_tie server_impl(this); + server_id = _poa->activate_object(&server_impl); + server_ref = server_impl._this(); + //this->_remove_ref(); + naming_context = get_service_naming_context(CONST_CONTEXT_NAME__PLPBUS, CONST_CONTEXT_KIND__PLPBUS); + if (naming_context != NULL) { + ok_flg = bind_naming_context_and_service(naming_context, server_ref, server_name, CONST_CONTEXT_KIND__PLPBUS); + if (ok_flg == true) { + cout << "Registered to naming service: " << server_name << endl; + _orb->run(); + ret_val = 0; + } + else { + cout << "Failed to register to naming service: " << server_name << endl; + } + } + return ret_val; +} + +PortableServer::POA_var OrbServerImpl::create_poa(CORBA::ORB_var orb) { + PortableServer::POA_var ret_val; + CORBA::Object_var poa_obj; + CORBA::PolicyList policy_list; + CORBA::Any policyVal; + PortableServer::POAManager_var poa_man; + PortableServer::POA_var rootpoa; + + ret_val = NULL; + poa_obj = orb->resolve_initial_references(CONST_ROOT_POA_NAME); + if (poa_obj != NULL) { + rootpoa = PortableServer::POA::_narrow(poa_obj); + if (rootpoa != NULL) { + poa_man = rootpoa->the_POAManager(); + if (poa_man != NULL) { + poa_man->activate(); + // bidirectional policy + policy_list.length(1); + policyVal <<= BiDirPolicy::BOTH; + policy_list[0] = orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, policyVal); + ret_val = rootpoa->create_POA(CONST_ROOT_POA_BIDIR_POLICY_NAME, + poa_man, + policy_list); + } + } + } + else { + cerr << "Failed to create RootPOA." << endl; + } + return ret_val; +} + +CosNaming::NamingContext_var OrbServerImpl::get_service_naming_context(const char *service_name_param, + const char *service_kind_param) +{ + CosNaming::NamingContext_var ret_val; + CosNaming::NamingContext_var ns_context; + CORBA::Object_var ns_obj; + CORBA::Object_var service_obj; + CosNaming::Name context_data; + + ret_val = NULL; + try { + // get nameservice reference + ns_obj = _orb->resolve_initial_references(CONST_NAME_SERVICE_NAME); + // get nameservice context + ns_context = CosNaming::NamingContext::_narrow(ns_obj); + if (CORBA::is_nil(ns_context) == false) { + context_data.length(1); + context_data[0].id = service_name_param; + context_data[0].kind = service_kind_param; + try { + service_obj = ns_context->resolve(context_data); + if (CORBA::is_nil(service_obj)) { + // not found, try to bind the new context to name service + ret_val = ns_context->bind_new_context(context_data); + if (CORBA::is_nil(ret_val) ) { + cerr << "Failed to create new context to name service for " << service_name_param << "." << endl; + } + } + else { + ret_val = CosNaming::NamingContext::_narrow(service_obj); + if (CORBA::is_nil(ret_val) ) { + cerr << "Failed to get existing context from name service for " << service_name_param << ", narrowing failed." << endl; + } + } + } + catch(CosNaming::NamingContext::AlreadyBound& ex) { + cerr << "Could not get context from nameservice for " << service_name_param << ". Context with same name already existed."<< endl; + } + } + } + catch (CORBA::ORB::InvalidName&) { + // This should not happen! + cerr << "Could not get context from name service for " << service_name_param << ", name service does not exist." << endl; + } + catch(CORBA::TRANSIENT& ex) { + cerr << "Could not get context from name service for " << service_name_param << ", verify that name service is running. " << service_name_param << endl; + } + catch (CORBA::NO_RESOURCES&) { + cerr << "Could not get context from name service for " << service_name_param << ". Name service is not running or has configuration problem." << endl; + } + catch(CORBA::SystemException& ex) { + cerr << "Could not get context from name service for " << service_name_param << ", could not determine reason." << endl; + } + return ret_val; +} + +bool OrbServerImpl::bind_naming_context_and_service(CosNaming::NamingContext_var service_context_param, + CORBA::Object_ptr service_ref_param, + const char *service_name_param, + const char *service_kind_param) +{ + bool retVal; + CosNaming::Name context_data; + + retVal = false; + try { + context_data.length(1); + context_data[0].id = service_name_param; + context_data[0].kind = service_kind_param; + try { + service_context_param->bind(context_data, service_ref_param); + retVal = true; + } + catch(CosNaming::NamingContext::AlreadyBound& ex) { + /** + * service existed already for the naming context with similar description. + * Replace the existing one with a new one. + */ + cout << "service " << service_name_param << " existed, replacing it." << endl; + service_context_param->rebind(context_data, service_ref_param); + retVal = true; + } + } + catch (CosNaming::NamingContext::InvalidName&) { + cerr << "Could not register service to name server, invalid service name." << endl; + } + catch (CosNaming::NamingContext::NotFound&) { + cerr << "Could not register service to name server, service object reference is invalid." << endl; + } + catch (CosNaming::NamingContext::CannotProceed&) { + // This should not happen! + cerr << "Could not register service to name server, unknown error." << endl; + } + catch(CORBA::SystemException& ex) { + cerr << "Could not register service to name server, unknown error." << endl; + } + return retVal; +} + +int OrbServerImpl::add_server_listener(IServerListener *listener_param) +{ + int retVal; + + retVal = 0; + cout << "register_request_received_callback() started" << endl; + _listener = listener_param; + cout << "register_callback() done" << endl; + return retVal; +} + +int OrbServerImpl::is_shutdown_pending() { + return _shutdown_pending; +} + +void OrbServerImpl::server_thread_closed() { + bool send_signal = false; + + server_thread_mutex.lock(); + _server_thread_count--; + if (_server_thread_count == 0) { + send_signal = true; + } + server_thread_mutex.unlock(); + if (send_signal == true) { + server_thread_shutdown_signal.signal(); + } +} diff --git a/src/plpbus/OrbServerImpl.hh b/src/plpbus/OrbServerImpl.hh new file mode 100644 index 0000000..3ca7d7a --- /dev/null +++ b/src/plpbus/OrbServerImpl.hh @@ -0,0 +1,60 @@ +/* + * OrbServerImpl.hh + * + * Created on: Aug 11, 2010 + * Author: lamikr + */ + +#ifndef ORBSERVERIMPL_HH_ +#define ORBSERVERIMPL_HH_ + +#include +#include + +#include "RequestResponseBus.hh" +#include "IServerListener.hh" + +namespace plpbus { + class OrbServerImpl + { + public: + OrbServerImpl(); + virtual ~OrbServerImpl(); + + virtual void send_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_req_param); + virtual void send_dataitem_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param); + virtual char *send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg); + virtual CORBA::Long send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param); + virtual void add_event_listener(plpbus_orb::OrbClient_ptr client_param, + const char *msg, + CORBA::UShort period_secs); + virtual void shutdown(); + virtual int init(); + virtual int launch(const char *server_name); + virtual int is_shutdown_pending(); + virtual void server_thread_closed(); + virtual int add_server_listener(IServerListener *listener_param); + private: + PortableServer::POA_var _poa; + CORBA::ORB_var _orb; + IServerListener *_listener; + int _server_thread_count; + int _shutdown_pending; + virtual PortableServer::POA_var create_poa(CORBA::ORB_var orb); + /** + * Gets naming context from the name service. If the naming context does not yet exist, create it. + */ + CosNaming::NamingContext_var get_service_naming_context(const char *leafcontext_name, + const char *leafcontext_kind); + /** + * Bind service to naming context. + * If service with same name has already been binded, replace the existing service with the new one. + */ + bool bind_naming_context_and_service(CosNaming::NamingContext_var service_context_param, + CORBA::Object_ptr service_ref_param, + const char *service_name_param, + const char *service_kind_param); + }; +} + +#endif /* ORBSERVERIMPL_HH_ */ diff --git a/src/plpbus/RequestResponseBus.hh b/src/plpbus/RequestResponseBus.hh new file mode 100644 index 0000000..ddebb17 --- /dev/null +++ b/src/plpbus/RequestResponseBus.hh @@ -0,0 +1,625 @@ +// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit. +#ifndef __RequestResponseBus_hh__ +#define __RequestResponseBus_hh__ + +#ifndef __CORBA_H_EXTERNAL_GUARD__ +#include +#endif + +#ifndef USE_stub_in_nt_dll +# define USE_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifndef USE_core_stub_in_nt_dll +# define USE_core_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifndef USE_dyn_stub_in_nt_dll +# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif + + + + + + +#ifdef USE_stub_in_nt_dll +# ifndef USE_core_stub_in_nt_dll +# define USE_core_stub_in_nt_dll +# endif +# ifndef USE_dyn_stub_in_nt_dll +# define USE_dyn_stub_in_nt_dll +# endif +#endif + +#ifdef _core_attr +# error "A local CPP macro _core_attr has already been defined." +#else +# ifdef USE_core_stub_in_nt_dll +# define _core_attr _OMNIORB_NTDLL_IMPORT +# else +# define _core_attr +# endif +#endif + +#ifdef _dyn_attr +# error "A local CPP macro _dyn_attr has already been defined." +#else +# ifdef USE_dyn_stub_in_nt_dll +# define _dyn_attr _OMNIORB_NTDLL_IMPORT +# else +# define _dyn_attr +# endif +#endif + + + + + +_CORBA_MODULE plpbus_orb + +_CORBA_MODULE_BEG + + struct DataItem { + typedef _CORBA_ConstrType_Variable_Var _var_type; + + + ::CORBA::String_member name; + + ::CORBA::Any value; + + + + void operator>>= (cdrStream &) const; + void operator<<= (cdrStream &); + }; + + typedef DataItem::_var_type DataItem_var; + + typedef _CORBA_ConstrType_Variable_OUT_arg< DataItem,DataItem_var > DataItem_out; + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DataItem; + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DataItemSequence; + + class DataItemSequence_var; + + class DataItemSequence : public _CORBA_Unbounded_Sequence< DataItem > { + public: + typedef DataItemSequence_var _var_type; + inline DataItemSequence() {} + inline DataItemSequence(const DataItemSequence& _s) + : _CORBA_Unbounded_Sequence< DataItem > (_s) {} + + inline DataItemSequence(_CORBA_ULong _max) + : _CORBA_Unbounded_Sequence< DataItem > (_max) {} + inline DataItemSequence(_CORBA_ULong _max, _CORBA_ULong _len, DataItem* _val, _CORBA_Boolean _rel=0) + : _CORBA_Unbounded_Sequence< DataItem > (_max, _len, _val, _rel) {} + + + + inline DataItemSequence& operator = (const DataItemSequence& _s) { + _CORBA_Unbounded_Sequence< DataItem > ::operator=(_s); + return *this; + } + }; + + class DataItemSequence_out; + + class DataItemSequence_var { + public: + inline DataItemSequence_var() : _pd_seq(0) {} + inline DataItemSequence_var(DataItemSequence* _s) : _pd_seq(_s) {} + inline DataItemSequence_var(const DataItemSequence_var& _s) { + if( _s._pd_seq ) _pd_seq = new DataItemSequence(*_s._pd_seq); + else _pd_seq = 0; + } + inline ~DataItemSequence_var() { if( _pd_seq ) delete _pd_seq; } + + inline DataItemSequence_var& operator = (DataItemSequence* _s) { + if( _pd_seq ) delete _pd_seq; + _pd_seq = _s; + return *this; + } + inline DataItemSequence_var& operator = (const DataItemSequence_var& _s) { + if( _s._pd_seq ) { + if( !_pd_seq ) _pd_seq = new DataItemSequence; + *_pd_seq = *_s._pd_seq; + } else if( _pd_seq ) { + delete _pd_seq; + _pd_seq = 0; + } + return *this; + } + inline DataItem& operator [] (_CORBA_ULong _s) { + return (*_pd_seq)[_s]; + } + + + + inline DataItemSequence* operator -> () { return _pd_seq; } + inline const DataItemSequence* operator -> () const { return _pd_seq; } +#if defined(__GNUG__) + inline operator DataItemSequence& () const { return *_pd_seq; } +#else + inline operator const DataItemSequence& () const { return *_pd_seq; } + inline operator DataItemSequence& () { return *_pd_seq; } +#endif + + inline const DataItemSequence& in() const { return *_pd_seq; } + inline DataItemSequence& inout() { return *_pd_seq; } + inline DataItemSequence*& out() { + if( _pd_seq ) { delete _pd_seq; _pd_seq = 0; } + return _pd_seq; + } + inline DataItemSequence* _retn() { DataItemSequence* tmp = _pd_seq; _pd_seq = 0; return tmp; } + + friend class DataItemSequence_out; + + private: + DataItemSequence* _pd_seq; + }; + + class DataItemSequence_out { + public: + inline DataItemSequence_out(DataItemSequence*& _s) : _data(_s) { _data = 0; } + inline DataItemSequence_out(DataItemSequence_var& _s) + : _data(_s._pd_seq) { _s = (DataItemSequence*) 0; } + inline DataItemSequence_out(const DataItemSequence_out& _s) : _data(_s._data) {} + inline DataItemSequence_out& operator = (const DataItemSequence_out& _s) { + _data = _s._data; + return *this; + } + inline DataItemSequence_out& operator = (DataItemSequence* _s) { + _data = _s; + return *this; + } + inline operator DataItemSequence*&() { return _data; } + inline DataItemSequence*& ptr() { return _data; } + inline DataItemSequence* operator->() { return _data; } + + inline DataItem& operator [] (_CORBA_ULong _i) { + return (*_data)[_i]; + } + + + + DataItemSequence*& _data; + + private: + DataItemSequence_out(); + DataItemSequence_out& operator=(const DataItemSequence_var&); + }; + +#ifndef __plpbus__orb_mOrbClient__ +#define __plpbus__orb_mOrbClient__ + + class OrbClient; + class _objref_OrbClient; + class _impl_OrbClient; + + typedef _objref_OrbClient* OrbClient_ptr; + typedef OrbClient_ptr OrbClientRef; + + class OrbClient_Helper { + public: + typedef OrbClient_ptr _ptr_type; + + static _ptr_type _nil(); + static _CORBA_Boolean is_nil(_ptr_type); + static void release(_ptr_type); + static void duplicate(_ptr_type); + static void marshalObjRef(_ptr_type, cdrStream&); + static _ptr_type unmarshalObjRef(cdrStream&); + }; + + typedef _CORBA_ObjRef_Var<_objref_OrbClient, OrbClient_Helper> OrbClient_var; + typedef _CORBA_ObjRef_OUT_arg<_objref_OrbClient,OrbClient_Helper > OrbClient_out; + +#endif + + // interface OrbClient + class OrbClient { + public: + // Declarations for this interface type. + typedef OrbClient_ptr _ptr_type; + typedef OrbClient_var _var_type; + + static _ptr_type _duplicate(_ptr_type); + static _ptr_type _narrow(::CORBA::Object_ptr); + static _ptr_type _unchecked_narrow(::CORBA::Object_ptr); + + static _ptr_type _nil(); + + static inline void _marshalObjRef(_ptr_type, cdrStream&); + + static inline _ptr_type _unmarshalObjRef(cdrStream& s) { + omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s); + if (o) + return (_ptr_type) o->_ptrToObjRef(_PD_repoId); + else + return _nil(); + } + + static _core_attr const char* _PD_repoId; + + // Other IDL defined within this scope. + + }; + + class _objref_OrbClient : + public virtual ::CORBA::Object, + public virtual omniObjRef + { + public: + void receive_event_message(const char* event_param); + void receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param); + void receive_response_message(const char* msg_rsp_param); + void receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param); + + inline _objref_OrbClient() { _PR_setobj(0); } // nil + _objref_OrbClient(omniIOR*, omniIdentity*); + + protected: + virtual ~_objref_OrbClient(); + + + private: + virtual void* _ptrToObjRef(const char*); + + _objref_OrbClient(const _objref_OrbClient&); + _objref_OrbClient& operator = (const _objref_OrbClient&); + // not implemented + + friend class OrbClient; + }; + + class _pof_OrbClient : public _OMNI_NS(proxyObjectFactory) { + public: + inline _pof_OrbClient() : _OMNI_NS(proxyObjectFactory)(OrbClient::_PD_repoId) {} + virtual ~_pof_OrbClient(); + + virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*); + virtual _CORBA_Boolean is_a(const char*) const; + }; + + class _impl_OrbClient : + public virtual omniServant + { + public: + virtual ~_impl_OrbClient(); + + virtual void receive_event_message(const char* event_param) = 0; + virtual void receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param) = 0; + virtual void receive_response_message(const char* msg_rsp_param) = 0; + virtual void receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param) = 0; + + public: // Really protected, workaround for xlC + virtual _CORBA_Boolean _dispatch(omniCallHandle&); + + private: + virtual void* _ptrToInterface(const char*); + virtual const char* _mostDerivedRepoId(); + + }; + + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_OrbClient; + +#ifndef __plpbus__orb_mOrbServer__ +#define __plpbus__orb_mOrbServer__ + + class OrbServer; + class _objref_OrbServer; + class _impl_OrbServer; + + typedef _objref_OrbServer* OrbServer_ptr; + typedef OrbServer_ptr OrbServerRef; + + class OrbServer_Helper { + public: + typedef OrbServer_ptr _ptr_type; + + static _ptr_type _nil(); + static _CORBA_Boolean is_nil(_ptr_type); + static void release(_ptr_type); + static void duplicate(_ptr_type); + static void marshalObjRef(_ptr_type, cdrStream&); + static _ptr_type unmarshalObjRef(cdrStream&); + }; + + typedef _CORBA_ObjRef_Var<_objref_OrbServer, OrbServer_Helper> OrbServer_var; + typedef _CORBA_ObjRef_OUT_arg<_objref_OrbServer,OrbServer_Helper > OrbServer_out; + +#endif + + // interface OrbServer + class OrbServer { + public: + // Declarations for this interface type. + typedef OrbServer_ptr _ptr_type; + typedef OrbServer_var _var_type; + + static _ptr_type _duplicate(_ptr_type); + static _ptr_type _narrow(::CORBA::Object_ptr); + static _ptr_type _unchecked_narrow(::CORBA::Object_ptr); + + static _ptr_type _nil(); + + static inline void _marshalObjRef(_ptr_type, cdrStream&); + + static inline _ptr_type _unmarshalObjRef(cdrStream& s) { + omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s); + if (o) + return (_ptr_type) o->_ptrToObjRef(_PD_repoId); + else + return _nil(); + } + + static _core_attr const char* _PD_repoId; + + // Other IDL defined within this scope. + + }; + + class _objref_OrbServer : + public virtual ::CORBA::Object, + public virtual omniObjRef + { + public: + void send_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param); + void send_dataitem_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param); + char* send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg); + ::CORBA::Long send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param); + void add_event_listener(::plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs); + void shutdown(); + + inline _objref_OrbServer() { _PR_setobj(0); } // nil + _objref_OrbServer(omniIOR*, omniIdentity*); + + protected: + virtual ~_objref_OrbServer(); + + + private: + virtual void* _ptrToObjRef(const char*); + + _objref_OrbServer(const _objref_OrbServer&); + _objref_OrbServer& operator = (const _objref_OrbServer&); + // not implemented + + friend class OrbServer; + }; + + class _pof_OrbServer : public _OMNI_NS(proxyObjectFactory) { + public: + inline _pof_OrbServer() : _OMNI_NS(proxyObjectFactory)(OrbServer::_PD_repoId) {} + virtual ~_pof_OrbServer(); + + virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*); + virtual _CORBA_Boolean is_a(const char*) const; + }; + + class _impl_OrbServer : + public virtual omniServant + { + public: + virtual ~_impl_OrbServer(); + + virtual void send_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param) = 0; + virtual void send_dataitem_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param) = 0; + virtual char* send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) = 0; + virtual ::CORBA::Long send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param) = 0; + virtual void add_event_listener(::plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs) = 0; + virtual void shutdown() = 0; + + public: // Really protected, workaround for xlC + virtual _CORBA_Boolean _dispatch(omniCallHandle&); + + private: + virtual void* _ptrToInterface(const char*); + virtual const char* _mostDerivedRepoId(); + + }; + + + _CORBA_MODULE_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_OrbServer; + +_CORBA_MODULE_END + + + +_CORBA_MODULE POA_plpbus_orb +_CORBA_MODULE_BEG + + class OrbClient : + public virtual plpbus_orb::_impl_OrbClient, + public virtual ::PortableServer::ServantBase + { + public: + virtual ~OrbClient(); + + inline ::plpbus_orb::OrbClient_ptr _this() { + return (::plpbus_orb::OrbClient_ptr) _do_this(::plpbus_orb::OrbClient::_PD_repoId); + } + }; + + template + class OrbClient_tie : public virtual OrbClient + { + public: + OrbClient_tie(_omniT& t) + : pd_obj(&t), pd_poa(0), pd_rel(0) {} + OrbClient_tie(_omniT& t, ::PortableServer::POA_ptr p) + : pd_obj(&t), pd_poa(p), pd_rel(0) {} + OrbClient_tie(_omniT* t, _CORBA_Boolean r=1) + : pd_obj(t), pd_poa(0), pd_rel(r) {} + OrbClient_tie(_omniT* t, ::PortableServer::POA_ptr p,_CORBA_Boolean r=1) + : pd_obj(t), pd_poa(p), pd_rel(r) {} + ~OrbClient_tie() { + if( pd_poa ) ::CORBA::release(pd_poa); + if( pd_rel ) delete pd_obj; + } + + _omniT* _tied_object() { return pd_obj; } + + void _tied_object(_omniT& t) { + if( pd_rel ) delete pd_obj; + pd_obj = &t; + pd_rel = 0; + } + + void _tied_object(_omniT* t, _CORBA_Boolean r=1) { + if( pd_rel ) delete pd_obj; + pd_obj = t; + pd_rel = r; + } + + _CORBA_Boolean _is_owner() { return pd_rel; } + void _is_owner(_CORBA_Boolean io) { pd_rel = io; } + + ::PortableServer::POA_ptr _default_POA() { + if( !pd_poa ) return ::PortableServer::POA::_the_root_poa(); + else return ::PortableServer::POA::_duplicate(pd_poa); + } + + void receive_event_message(const char* event_param) { pd_obj->receive_event_message(event_param); } + void receive_event_dataitem_sequence(const plpbus_orb::DataItemSequence& event_param) { pd_obj->receive_event_dataitem_sequence(event_param); } + void receive_response_message(const char* msg_rsp_param) { pd_obj->receive_response_message(msg_rsp_param); } + void receive_response_dataitem_sequence(const plpbus_orb::DataItemSequence& msg_rsp_param) { pd_obj->receive_response_dataitem_sequence(msg_rsp_param); } + + + private: + _omniT* pd_obj; + ::PortableServer::POA_ptr pd_poa; + _CORBA_Boolean pd_rel; + }; + + class OrbServer : + public virtual plpbus_orb::_impl_OrbServer, + public virtual ::PortableServer::ServantBase + { + public: + virtual ~OrbServer(); + + inline ::plpbus_orb::OrbServer_ptr _this() { + return (::plpbus_orb::OrbServer_ptr) _do_this(::plpbus_orb::OrbServer::_PD_repoId); + } + }; + + template + class OrbServer_tie : public virtual OrbServer + { + public: + OrbServer_tie(_omniT& t) + : pd_obj(&t), pd_poa(0), pd_rel(0) {} + OrbServer_tie(_omniT& t, ::PortableServer::POA_ptr p) + : pd_obj(&t), pd_poa(p), pd_rel(0) {} + OrbServer_tie(_omniT* t, _CORBA_Boolean r=1) + : pd_obj(t), pd_poa(0), pd_rel(r) {} + OrbServer_tie(_omniT* t, ::PortableServer::POA_ptr p,_CORBA_Boolean r=1) + : pd_obj(t), pd_poa(p), pd_rel(r) {} + ~OrbServer_tie() { + if( pd_poa ) ::CORBA::release(pd_poa); + if( pd_rel ) delete pd_obj; + } + + _omniT* _tied_object() { return pd_obj; } + + void _tied_object(_omniT& t) { + if( pd_rel ) delete pd_obj; + pd_obj = &t; + pd_rel = 0; + } + + void _tied_object(_omniT* t, _CORBA_Boolean r=1) { + if( pd_rel ) delete pd_obj; + pd_obj = t; + pd_rel = r; + } + + _CORBA_Boolean _is_owner() { return pd_rel; } + void _is_owner(_CORBA_Boolean io) { pd_rel = io; } + + ::PortableServer::POA_ptr _default_POA() { + if( !pd_poa ) return ::PortableServer::POA::_the_root_poa(); + else return ::PortableServer::POA::_duplicate(pd_poa); + } + + void send_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param) { pd_obj->send_message_and_request_response(response_listener_param, msg_param); } + void send_dataitem_message_and_request_response(plpbus_orb::OrbClient_ptr response_listener_param, const plpbus_orb::DataItemSequence& req_seq_param) { pd_obj->send_dataitem_message_and_request_response(response_listener_param, req_seq_param); } + char* send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) { return pd_obj->send_message_and_wait_response(msg_req_param, err_flg); } + ::CORBA::Long send_dataitem_message_and_wait_response(const plpbus_orb::DataItemSequence& req_seq_param, plpbus_orb::DataItemSequence_out rsp_seq_param) { return pd_obj->send_dataitem_message_and_wait_response(req_seq_param, rsp_seq_param); } + void add_event_listener(plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs) { pd_obj->add_event_listener(callback_client_param, msg_param, period_secs); } + void shutdown() { pd_obj->shutdown(); } + + + private: + _omniT* pd_obj; + ::PortableServer::POA_ptr pd_poa; + _CORBA_Boolean pd_rel; + }; + +_CORBA_MODULE_END + + + +_CORBA_MODULE OBV_plpbus_orb +_CORBA_MODULE_BEG + +_CORBA_MODULE_END + + + + + +#undef _core_attr +#undef _dyn_attr + +extern void operator<<=(::CORBA::Any& _a, const plpbus_orb::DataItem& _s); +extern void operator<<=(::CORBA::Any& _a, plpbus_orb::DataItem* _sp); +extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::DataItem*& _sp); +extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const plpbus_orb::DataItem*& _sp); + +void operator<<=(::CORBA::Any& _a, const plpbus_orb::DataItemSequence& _s); +void operator<<=(::CORBA::Any& _a, plpbus_orb::DataItemSequence* _sp); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::DataItemSequence*& _sp); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const plpbus_orb::DataItemSequence*& _sp); + +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbClient_ptr _s); +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbClient_ptr* _s); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::OrbClient_ptr& _s); + +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbServer_ptr _s); +void operator<<=(::CORBA::Any& _a, plpbus_orb::OrbServer_ptr* _s); +_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, plpbus_orb::OrbServer_ptr& _s); + + + +inline void +plpbus_orb::OrbClient::_marshalObjRef(::plpbus_orb::OrbClient_ptr obj, cdrStream& s) { + omniObjRef::_marshal(obj->_PR_getobj(),s); +} + + +inline void +plpbus_orb::OrbServer::_marshalObjRef(::plpbus_orb::OrbServer_ptr obj, cdrStream& s) { + omniObjRef::_marshal(obj->_PR_getobj(),s); +} + + + + +#ifdef USE_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +# undef USE_stub_in_nt_dll +# undef USE_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifdef USE_core_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +# undef USE_core_stub_in_nt_dll +# undef USE_core_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif +#ifdef USE_dyn_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +# undef USE_dyn_stub_in_nt_dll +# undef USE_dyn_stub_in_nt_dll_NOT_DEFINED_RequestResponseBus +#endif + +#endif // __RequestResponseBus_hh__ + diff --git a/src/plpbus/RequestResponseBusSK.cc b/src/plpbus/RequestResponseBusSK.cc new file mode 100644 index 0000000..9877936 --- /dev/null +++ b/src/plpbus/RequestResponseBusSK.cc @@ -0,0 +1,1012 @@ +// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit. + +#include "RequestResponseBus.hh" +#include +#include +#include +#include +#include + + +OMNI_USING_NAMESPACE(omni) + +static const char* _0RL_library_version = omniORB_4_1; + + + +void +plpbus_orb::DataItem::operator>>= (cdrStream &_n) const +{ + _n.marshalString(name,0); + (const ::CORBA::Any&) value >>= _n; + +} + +void +plpbus_orb::DataItem::operator<<= (cdrStream &_n) +{ + name = _n.unmarshalString(0); + (::CORBA::Any&)value <<= _n; + +} + +plpbus_orb::OrbClient_ptr plpbus_orb::OrbClient_Helper::_nil() { + return ::plpbus_orb::OrbClient::_nil(); +} + +::CORBA::Boolean plpbus_orb::OrbClient_Helper::is_nil(::plpbus_orb::OrbClient_ptr p) { + return ::CORBA::is_nil(p); + +} + +void plpbus_orb::OrbClient_Helper::release(::plpbus_orb::OrbClient_ptr p) { + ::CORBA::release(p); +} + +void plpbus_orb::OrbClient_Helper::marshalObjRef(::plpbus_orb::OrbClient_ptr obj, cdrStream& s) { + ::plpbus_orb::OrbClient::_marshalObjRef(obj, s); +} + +plpbus_orb::OrbClient_ptr plpbus_orb::OrbClient_Helper::unmarshalObjRef(cdrStream& s) { + return ::plpbus_orb::OrbClient::_unmarshalObjRef(s); +} + +void plpbus_orb::OrbClient_Helper::duplicate(::plpbus_orb::OrbClient_ptr obj) { + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); +} + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_duplicate(::plpbus_orb::OrbClient_ptr obj) +{ + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); + return obj; +} + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId); + return e ? e : _nil(); +} + + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_unchecked_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); + return e ? e : _nil(); +} + +plpbus_orb::OrbClient_ptr +plpbus_orb::OrbClient::_nil() +{ +#ifdef OMNI_UNLOADABLE_STUBS + static _objref_OrbClient _the_nil_obj; + return &_the_nil_obj; +#else + static _objref_OrbClient* _the_nil_ptr = 0; + if( !_the_nil_ptr ) { + omni::nilRefLock().lock(); + if( !_the_nil_ptr ) { + _the_nil_ptr = new _objref_OrbClient; + registerNilCorbaObject(_the_nil_ptr); + } + omni::nilRefLock().unlock(); + } + return _the_nil_ptr; +#endif +} + +const char* plpbus_orb::OrbClient::_PD_repoId = "IDL:plpbus_orb/OrbClient:1.0"; + + +plpbus_orb::_objref_OrbClient::~_objref_OrbClient() { + +} + + +plpbus_orb::_objref_OrbClient::_objref_OrbClient(omniIOR* ior, omniIdentity* id) : + omniObjRef(::plpbus_orb::OrbClient::_PD_repoId, ior, id, 1) + + +{ + _PR_setobj(this); +} + +void* +plpbus_orb::_objref_OrbClient::_ptrToObjRef(const char* id) +{ + if( id == ::plpbus_orb::OrbClient::_PD_repoId ) + return (::plpbus_orb::OrbClient_ptr) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (::CORBA::Object_ptr) this; + + if( omni::strMatch(id, ::plpbus_orb::OrbClient::_PD_repoId) ) + return (::plpbus_orb::OrbClient_ptr) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (::CORBA::Object_ptr) this; + + return 0; +} + +// Proxy call descriptor class. Mangled signature: +// void_i_cstring +class _0RL_cd_00d6793dc2c2a80c_00000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_00000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + ::CORBA::String_var arg_0_; + const char* arg_0; +}; + +void _0RL_cd_00d6793dc2c2a80c_00000000::marshalArguments(cdrStream& _n) +{ + _n.marshalString(arg_0,0); + +} + +void _0RL_cd_00d6793dc2c2a80c_00000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = _n.unmarshalString(0); + arg_0 = arg_0_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_00000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_10000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_00000000* tcd = (_0RL_cd_00d6793dc2c2a80c_00000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_event_message(tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_event_message(const char* event_param) +{ + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_10000000, "receive_event_message", 22); + _call_desc.arg_0 = event_param; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mDataItemSequence +class _0RL_cd_00d6793dc2c2a80c_20000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_20000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::DataItemSequence_var arg_0_; + const plpbus_orb::DataItemSequence* arg_0; +}; + +void _0RL_cd_00d6793dc2c2a80c_20000000::marshalArguments(cdrStream& _n) +{ + (const plpbus_orb::DataItemSequence&) *arg_0 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_20000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_0_ <<= _n; + arg_0 = &arg_0_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_20000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_30000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_20000000* tcd = (_0RL_cd_00d6793dc2c2a80c_20000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_event_dataitem_sequence(*tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_event_dataitem_sequence(const ::plpbus_orb::DataItemSequence& event_param) +{ + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_30000000, "receive_event_dataitem_sequence", 32); + _call_desc.arg_0 = &(::plpbus_orb::DataItemSequence&) event_param; + + _invoke(_call_desc); + + + +} +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_40000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_00000000* tcd = (_0RL_cd_00d6793dc2c2a80c_00000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_response_message(tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_response_message(const char* msg_rsp_param) +{ + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_40000000, "receive_response_message", 25); + _call_desc.arg_0 = msg_rsp_param; + + _invoke(_call_desc); + + + +} +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_50000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_20000000* tcd = (_0RL_cd_00d6793dc2c2a80c_20000000*)cd; + plpbus_orb::_impl_OrbClient* impl = (plpbus_orb::_impl_OrbClient*) svnt->_ptrToInterface(plpbus_orb::OrbClient::_PD_repoId); + impl->receive_response_dataitem_sequence(*tcd->arg_0); + + +} + +void plpbus_orb::_objref_OrbClient::receive_response_dataitem_sequence(const ::plpbus_orb::DataItemSequence& msg_rsp_param) +{ + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_50000000, "receive_response_dataitem_sequence", 35); + _call_desc.arg_0 = &(::plpbus_orb::DataItemSequence&) msg_rsp_param; + + _invoke(_call_desc); + + + +} +plpbus_orb::_pof_OrbClient::~_pof_OrbClient() {} + + +omniObjRef* +plpbus_orb::_pof_OrbClient::newObjRef(omniIOR* ior, omniIdentity* id) +{ + return new ::plpbus_orb::_objref_OrbClient(ior, id); +} + + +::CORBA::Boolean +plpbus_orb::_pof_OrbClient::is_a(const char* id) const +{ + if( omni::ptrStrMatch(id, ::plpbus_orb::OrbClient::_PD_repoId) ) + return 1; + + return 0; +} + +const plpbus_orb::_pof_OrbClient _the_pof_plpbus__orb_mOrbClient; + +plpbus_orb::_impl_OrbClient::~_impl_OrbClient() {} + + +::CORBA::Boolean +plpbus_orb::_impl_OrbClient::_dispatch(omniCallHandle& _handle) +{ + const char* op = _handle.operation_name(); + + if( omni::strMatch(op, "receive_event_message") ) { + + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_10000000, "receive_event_message", 22, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "receive_event_dataitem_sequence") ) { + + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_30000000, "receive_event_dataitem_sequence", 32, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "receive_response_message") ) { + + _0RL_cd_00d6793dc2c2a80c_00000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_40000000, "receive_response_message", 25, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "receive_response_dataitem_sequence") ) { + + _0RL_cd_00d6793dc2c2a80c_20000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_50000000, "receive_response_dataitem_sequence", 35, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + + return 0; +} + +void* +plpbus_orb::_impl_OrbClient::_ptrToInterface(const char* id) +{ + if( id == ::plpbus_orb::OrbClient::_PD_repoId ) + return (::plpbus_orb::_impl_OrbClient*) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (void*) 1; + + if( omni::strMatch(id, ::plpbus_orb::OrbClient::_PD_repoId) ) + return (::plpbus_orb::_impl_OrbClient*) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (void*) 1; + return 0; +} + +const char* +plpbus_orb::_impl_OrbClient::_mostDerivedRepoId() +{ + return ::plpbus_orb::OrbClient::_PD_repoId; +} + +plpbus_orb::OrbServer_ptr plpbus_orb::OrbServer_Helper::_nil() { + return ::plpbus_orb::OrbServer::_nil(); +} + +::CORBA::Boolean plpbus_orb::OrbServer_Helper::is_nil(::plpbus_orb::OrbServer_ptr p) { + return ::CORBA::is_nil(p); + +} + +void plpbus_orb::OrbServer_Helper::release(::plpbus_orb::OrbServer_ptr p) { + ::CORBA::release(p); +} + +void plpbus_orb::OrbServer_Helper::marshalObjRef(::plpbus_orb::OrbServer_ptr obj, cdrStream& s) { + ::plpbus_orb::OrbServer::_marshalObjRef(obj, s); +} + +plpbus_orb::OrbServer_ptr plpbus_orb::OrbServer_Helper::unmarshalObjRef(cdrStream& s) { + return ::plpbus_orb::OrbServer::_unmarshalObjRef(s); +} + +void plpbus_orb::OrbServer_Helper::duplicate(::plpbus_orb::OrbServer_ptr obj) { + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); +} + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_duplicate(::plpbus_orb::OrbServer_ptr obj) +{ + if( obj && !obj->_NP_is_nil() ) omni::duplicateObjRef(obj); + return obj; +} + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId); + return e ? e : _nil(); +} + + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_unchecked_narrow(::CORBA::Object_ptr obj) +{ + if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); + _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); + return e ? e : _nil(); +} + +plpbus_orb::OrbServer_ptr +plpbus_orb::OrbServer::_nil() +{ +#ifdef OMNI_UNLOADABLE_STUBS + static _objref_OrbServer _the_nil_obj; + return &_the_nil_obj; +#else + static _objref_OrbServer* _the_nil_ptr = 0; + if( !_the_nil_ptr ) { + omni::nilRefLock().lock(); + if( !_the_nil_ptr ) { + _the_nil_ptr = new _objref_OrbServer; + registerNilCorbaObject(_the_nil_ptr); + } + omni::nilRefLock().unlock(); + } + return _the_nil_ptr; +#endif +} + +const char* plpbus_orb::OrbServer::_PD_repoId = "IDL:plpbus_orb/OrbServer:1.0"; + + +plpbus_orb::_objref_OrbServer::~_objref_OrbServer() { + +} + + +plpbus_orb::_objref_OrbServer::_objref_OrbServer(omniIOR* ior, omniIdentity* id) : + omniObjRef(::plpbus_orb::OrbServer::_PD_repoId, ior, id, 1) + + +{ + _PR_setobj(this); +} + +void* +plpbus_orb::_objref_OrbServer::_ptrToObjRef(const char* id) +{ + if( id == ::plpbus_orb::OrbServer::_PD_repoId ) + return (::plpbus_orb::OrbServer_ptr) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (::CORBA::Object_ptr) this; + + if( omni::strMatch(id, ::plpbus_orb::OrbServer::_PD_repoId) ) + return (::plpbus_orb::OrbServer_ptr) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (::CORBA::Object_ptr) this; + + return 0; +} + +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mOrbClient_i_cstring +class _0RL_cd_00d6793dc2c2a80c_60000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_60000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::OrbClient_var arg_0_; + plpbus_orb::OrbClient_ptr arg_0; + ::CORBA::String_var arg_1_; + const char* arg_1; +}; + +void _0RL_cd_00d6793dc2c2a80c_60000000::marshalArguments(cdrStream& _n) +{ + plpbus_orb::OrbClient::_marshalObjRef(arg_0,_n); + _n.marshalString(arg_1,0); + +} + +void _0RL_cd_00d6793dc2c2a80c_60000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = plpbus_orb::OrbClient::_unmarshalObjRef(_n); + arg_0 = arg_0_.in(); + arg_1_ = _n.unmarshalString(0); + arg_1 = arg_1_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_60000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_70000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_60000000* tcd = (_0RL_cd_00d6793dc2c2a80c_60000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->send_message_and_request_response(tcd->arg_0, tcd->arg_1); + + +} + +void plpbus_orb::_objref_OrbServer::send_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const char* msg_param) +{ + _0RL_cd_00d6793dc2c2a80c_60000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_70000000, "send_message_and_request_response", 34); + _call_desc.arg_0 = response_listener_param; + _call_desc.arg_1 = msg_param; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mOrbClient_i_cplpbus__orb_mDataItemSequence +class _0RL_cd_00d6793dc2c2a80c_80000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_80000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::OrbClient_var arg_0_; + plpbus_orb::OrbClient_ptr arg_0; + plpbus_orb::DataItemSequence_var arg_1_; + const plpbus_orb::DataItemSequence* arg_1; +}; + +void _0RL_cd_00d6793dc2c2a80c_80000000::marshalArguments(cdrStream& _n) +{ + plpbus_orb::OrbClient::_marshalObjRef(arg_0,_n); + (const plpbus_orb::DataItemSequence&) *arg_1 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_80000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = plpbus_orb::OrbClient::_unmarshalObjRef(_n); + arg_0 = arg_0_.in(); + arg_1_ = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_1_ <<= _n; + arg_1 = &arg_1_.in(); + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_80000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_90000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_80000000* tcd = (_0RL_cd_00d6793dc2c2a80c_80000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->send_dataitem_message_and_request_response(tcd->arg_0, *tcd->arg_1); + + +} + +void plpbus_orb::_objref_OrbServer::send_dataitem_message_and_request_response(::plpbus_orb::OrbClient_ptr response_listener_param, const ::plpbus_orb::DataItemSequence& req_seq_param) +{ + _0RL_cd_00d6793dc2c2a80c_80000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_90000000, "send_dataitem_message_and_request_response", 43); + _call_desc.arg_0 = response_listener_param; + _call_desc.arg_1 = &(::plpbus_orb::DataItemSequence&) req_seq_param; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// _cstring_i_cstring_o_clong +class _0RL_cd_00d6793dc2c2a80c_a0000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_a0000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + void unmarshalReturnedValues(cdrStream&); + void marshalReturnedValues(cdrStream&); + + + static const char* const _user_exns[]; + + ::CORBA::String_var arg_0_; + const char* arg_0; + ::CORBA::Long arg_1; + ::CORBA::String_var result; +}; + +void _0RL_cd_00d6793dc2c2a80c_a0000000::marshalArguments(cdrStream& _n) +{ + _n.marshalString(arg_0,0); + +} + +void _0RL_cd_00d6793dc2c2a80c_a0000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = _n.unmarshalString(0); + arg_0 = arg_0_.in(); + +} + +void _0RL_cd_00d6793dc2c2a80c_a0000000::marshalReturnedValues(cdrStream& _n) +{ + _n.marshalString(result,0); + arg_1 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_a0000000::unmarshalReturnedValues(cdrStream& _n) +{ + result = _n.unmarshalString(0); + (::CORBA::Long&)arg_1 <<= _n; + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_a0000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_b0000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_a0000000* tcd = (_0RL_cd_00d6793dc2c2a80c_a0000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + tcd->result = impl->send_message_and_wait_response(tcd->arg_0, tcd->arg_1); + + +} + +char* plpbus_orb::_objref_OrbServer::send_message_and_wait_response(const char* msg_req_param, ::CORBA::Long& err_flg) +{ + _0RL_cd_00d6793dc2c2a80c_a0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_b0000000, "send_message_and_wait_response", 31); + _call_desc.arg_0 = msg_req_param; + + _invoke(_call_desc); + err_flg = _call_desc.arg_1; + return _call_desc.result._retn(); + + +} +// Proxy call descriptor class. Mangled signature: +// _clong_i_cplpbus__orb_mDataItemSequence_o_cplpbus__orb_mDataItemSequence +class _0RL_cd_00d6793dc2c2a80c_c0000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_c0000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + void unmarshalReturnedValues(cdrStream&); + void marshalReturnedValues(cdrStream&); + + + static const char* const _user_exns[]; + + plpbus_orb::DataItemSequence_var arg_0_; + const plpbus_orb::DataItemSequence* arg_0; + plpbus_orb::DataItemSequence_var arg_1; + ::CORBA::Long result; +}; + +void _0RL_cd_00d6793dc2c2a80c_c0000000::marshalArguments(cdrStream& _n) +{ + (const plpbus_orb::DataItemSequence&) *arg_0 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_c0000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_0_ <<= _n; + arg_0 = &arg_0_.in(); + +} + +void _0RL_cd_00d6793dc2c2a80c_c0000000::marshalReturnedValues(cdrStream& _n) +{ + result >>= _n; + (const plpbus_orb::DataItemSequence&) arg_1 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_c0000000::unmarshalReturnedValues(cdrStream& _n) +{ + (::CORBA::Long&)result <<= _n; + arg_1 = new plpbus_orb::DataItemSequence; + (plpbus_orb::DataItemSequence&)arg_1 <<= _n; + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_c0000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_d0000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_c0000000* tcd = (_0RL_cd_00d6793dc2c2a80c_c0000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + tcd->result = impl->send_dataitem_message_and_wait_response(*tcd->arg_0, tcd->arg_1.out()); + + +} + +::CORBA::Long plpbus_orb::_objref_OrbServer::send_dataitem_message_and_wait_response(const ::plpbus_orb::DataItemSequence& req_seq_param, ::plpbus_orb::DataItemSequence_out rsp_seq_param) +{ + _0RL_cd_00d6793dc2c2a80c_c0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_d0000000, "send_dataitem_message_and_wait_response", 40); + _call_desc.arg_0 = &(::plpbus_orb::DataItemSequence&) req_seq_param; + + _invoke(_call_desc); + rsp_seq_param = _call_desc.arg_1._retn(); + return _call_desc.result; + + +} +// Proxy call descriptor class. Mangled signature: +// void_i_cplpbus__orb_mOrbClient_i_cstring_i_cunsigned_pshort +class _0RL_cd_00d6793dc2c2a80c_e0000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_e0000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + void marshalArguments(cdrStream&); + void unmarshalArguments(cdrStream&); + + + + static const char* const _user_exns[]; + + plpbus_orb::OrbClient_var arg_0_; + plpbus_orb::OrbClient_ptr arg_0; + ::CORBA::String_var arg_1_; + const char* arg_1; + ::CORBA::UShort arg_2; +}; + +void _0RL_cd_00d6793dc2c2a80c_e0000000::marshalArguments(cdrStream& _n) +{ + plpbus_orb::OrbClient::_marshalObjRef(arg_0,_n); + _n.marshalString(arg_1,0); + arg_2 >>= _n; + +} + +void _0RL_cd_00d6793dc2c2a80c_e0000000::unmarshalArguments(cdrStream& _n) +{ + arg_0_ = plpbus_orb::OrbClient::_unmarshalObjRef(_n); + arg_0 = arg_0_.in(); + arg_1_ = _n.unmarshalString(0); + arg_1 = arg_1_.in(); + (::CORBA::UShort&)arg_2 <<= _n; + +} + +const char* const _0RL_cd_00d6793dc2c2a80c_e0000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_f0000000(omniCallDescriptor* cd, omniServant* svnt) +{ + _0RL_cd_00d6793dc2c2a80c_e0000000* tcd = (_0RL_cd_00d6793dc2c2a80c_e0000000*)cd; + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->add_event_listener(tcd->arg_0, tcd->arg_1, tcd->arg_2); + + +} + +void plpbus_orb::_objref_OrbServer::add_event_listener(::plpbus_orb::OrbClient_ptr callback_client_param, const char* msg_param, ::CORBA::UShort period_secs) +{ + _0RL_cd_00d6793dc2c2a80c_e0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_f0000000, "add_event_listener", 19); + _call_desc.arg_0 = callback_client_param; + _call_desc.arg_1 = msg_param; + _call_desc.arg_2 = period_secs; + + _invoke(_call_desc); + + + +} +// Proxy call descriptor class. Mangled signature: +// void +class _0RL_cd_00d6793dc2c2a80c_01000000 + : public omniCallDescriptor +{ +public: + inline _0RL_cd_00d6793dc2c2a80c_01000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): + omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) + { + + } + + + + + static const char* const _user_exns[]; + + +}; + +const char* const _0RL_cd_00d6793dc2c2a80c_01000000::_user_exns[] = { + 0 +}; + +// Local call call-back function. +static void +_0RL_lcfn_00d6793dc2c2a80c_11000000(omniCallDescriptor*, omniServant* svnt) +{ + + plpbus_orb::_impl_OrbServer* impl = (plpbus_orb::_impl_OrbServer*) svnt->_ptrToInterface(plpbus_orb::OrbServer::_PD_repoId); + impl->shutdown(); + + +} + +void plpbus_orb::_objref_OrbServer::shutdown() +{ + _0RL_cd_00d6793dc2c2a80c_01000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_11000000, "shutdown", 9); + + + _invoke(_call_desc); + + + +} +plpbus_orb::_pof_OrbServer::~_pof_OrbServer() {} + + +omniObjRef* +plpbus_orb::_pof_OrbServer::newObjRef(omniIOR* ior, omniIdentity* id) +{ + return new ::plpbus_orb::_objref_OrbServer(ior, id); +} + + +::CORBA::Boolean +plpbus_orb::_pof_OrbServer::is_a(const char* id) const +{ + if( omni::ptrStrMatch(id, ::plpbus_orb::OrbServer::_PD_repoId) ) + return 1; + + return 0; +} + +const plpbus_orb::_pof_OrbServer _the_pof_plpbus__orb_mOrbServer; + +plpbus_orb::_impl_OrbServer::~_impl_OrbServer() {} + + +::CORBA::Boolean +plpbus_orb::_impl_OrbServer::_dispatch(omniCallHandle& _handle) +{ + const char* op = _handle.operation_name(); + + if( omni::strMatch(op, "send_message_and_request_response") ) { + + _0RL_cd_00d6793dc2c2a80c_60000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_70000000, "send_message_and_request_response", 34, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "send_dataitem_message_and_request_response") ) { + + _0RL_cd_00d6793dc2c2a80c_80000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_90000000, "send_dataitem_message_and_request_response", 43, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "send_message_and_wait_response") ) { + + _0RL_cd_00d6793dc2c2a80c_a0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_b0000000, "send_message_and_wait_response", 31, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "send_dataitem_message_and_wait_response") ) { + + _0RL_cd_00d6793dc2c2a80c_c0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_d0000000, "send_dataitem_message_and_wait_response", 40, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "add_event_listener") ) { + + _0RL_cd_00d6793dc2c2a80c_e0000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_f0000000, "add_event_listener", 19, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + if( omni::strMatch(op, "shutdown") ) { + + _0RL_cd_00d6793dc2c2a80c_01000000 _call_desc(_0RL_lcfn_00d6793dc2c2a80c_11000000, "shutdown", 9, 1); + + _handle.upcall(this,_call_desc); + return 1; + } + + + return 0; +} + +void* +plpbus_orb::_impl_OrbServer::_ptrToInterface(const char* id) +{ + if( id == ::plpbus_orb::OrbServer::_PD_repoId ) + return (::plpbus_orb::_impl_OrbServer*) this; + + if( id == ::CORBA::Object::_PD_repoId ) + return (void*) 1; + + if( omni::strMatch(id, ::plpbus_orb::OrbServer::_PD_repoId) ) + return (::plpbus_orb::_impl_OrbServer*) this; + + if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) + return (void*) 1; + return 0; +} + +const char* +plpbus_orb::_impl_OrbServer::_mostDerivedRepoId() +{ + return ::plpbus_orb::OrbServer::_PD_repoId; +} + +POA_plpbus_orb::OrbClient::~OrbClient() {} + +POA_plpbus_orb::OrbServer::~OrbServer() {} + diff --git a/src/plpbus/ServerEventThread.cc b/src/plpbus/ServerEventThread.cc new file mode 100644 index 0000000..f0cb4dc --- /dev/null +++ b/src/plpbus/ServerEventThread.cc @@ -0,0 +1,42 @@ +/* + * server_thread.cc + * + * Created on: Jun 2, 2010 + * Author: lamikr + */ + +////////////////////////////////////////////////////////////////////// + +// A thread object used to server clients registered +// using the plpbus_orb::OrbServer::register() method. +#include "BusServer.hh" +#include "ServerEventThread.hh" +using namespace std; +using namespace plpbus; + +ServerEventThread::ServerEventThread(plpbus_orb::OrbClient_ptr client, + const char *msg, + int period, + OrbServerImpl *server_obj) +{ + this->_orb_client = plpbus_orb::OrbClient::_duplicate(client); + this->_orb_msg = msg; + this->_interval = period; + this->_server_obj = server_obj; + _orb_client->receive_event_message("event_listener_started"); +} + +void ServerEventThread::run(void* arg) +{ + try { + while(_server_obj->is_shutdown_pending() == 0) { + omni_thread::sleep(_interval); + _orb_client->receive_event_message(_orb_msg); + } + } + catch(...) { + cout << "server_thread failed, could not connect to client!" << endl; + } + cout << "server_thread, closing" << endl; + _server_obj->server_thread_closed(); +} diff --git a/src/plpbus/ServerEventThread.hh b/src/plpbus/ServerEventThread.hh new file mode 100644 index 0000000..da0561b --- /dev/null +++ b/src/plpbus/ServerEventThread.hh @@ -0,0 +1,34 @@ +/* + * server_thread.hh + * + * Created on: Jun 2, 2010 + * Author: lamikr + */ + +#ifndef SERVEREVENTTHREAD_HH_ +#define SERVEREVENTTHREAD_HH_ + +#include +#include + +#include "RequestResponseBus.hh" +#include "OrbServerImpl.hh" + +namespace plpbus { + class ServerEventThread : public omni_thread { + public: + ServerEventThread(plpbus_orb::OrbClient_ptr client, + const char *msg, + int period, + plpbus::OrbServerImpl *server_obj); + virtual void run(void* arg); + + private: + plpbus_orb::OrbClient_var _orb_client; + CORBA::String_var _orb_msg; + int _interval; + plpbus::OrbServerImpl *_server_obj; + }; +} + +#endif /* SERVEREVENTTHREAD_HH_ */ diff --git a/src_test/Makefile.am b/src_test/Makefile.am new file mode 100644 index 0000000..35cf430 --- /dev/null +++ b/src_test/Makefile.am @@ -0,0 +1,16 @@ +bin_PROGRAMS = test_admin \ + test_client \ + test_server + +test_admin_SOURCES = test_admin.cc +test_admin_LDADD = $(SRC_LIBS) ../src/.libs/libplpbus.a + +test_client_SOURCES = test_client.cc +test_client_LDADD = $(SRC_LIBS) ../src/.libs/libplpbus.a + +test_server_SOURCES = test_server.cc +test_server_LDADD = $(SRC_LIBS) ../src/.libs/libplpbus.a + +AM_CPPFLAGS = $(SRC_CFLAGS) -I../src + +DISTCLEANFILES = Makefile.in diff --git a/src_test/test_admin.cc b/src_test/test_admin.cc new file mode 100644 index 0000000..5f2ba79 --- /dev/null +++ b/src_test/test_admin.cc @@ -0,0 +1,21 @@ +/* + * test_admin.cc + * + * Created on: Jun 7, 2010 + * Author: lamikr + */ +#include "plpbus/BusClient.hh" + +using namespace std; +using namespace plpbus; + +int main(int argc, char** argv) +{ + BusClient *client; + + cout << "hello world" << endl; + client = new plpbus::BusClient(); + client->init(argv[1]); + client->request_shutdown(); + return 0; +} diff --git a/src_test/test_client.cc b/src_test/test_client.cc new file mode 100644 index 0000000..aeca510 --- /dev/null +++ b/src_test/test_client.cc @@ -0,0 +1,90 @@ +/* + * test_client.cc + * + * Created on: Jun 9, 2010 + * Author: lamikr + */ + +#include "plpbus/BusServer.hh" +#include "plpbus/BusClient.hh" +#include "plpbus/BusMessage.hh" + +using namespace std; +using namespace plpbus; + +class ClientListenerImpl : public IClientListener +{ + public: + inline ClientListenerImpl() {} + virtual ~ClientListenerImpl() {} + virtual int response_received(const char *msg_rsp_param); + virtual int response_received(const BusMessage *msg_rsp_param); + virtual int event_received(const char *event_param); + virtual int event_received(const BusMessage *event_param); +}; + +int ClientListenerImpl::response_received(const char *msg_rsp_param) { + cout << "response_received(char *: " << msg_rsp_param << ") " << endl; + return 0; +} + +int ClientListenerImpl::response_received(const BusMessage *msg_rsp_param) { + cout << "response_received(BusMessage *) " << endl; + return 0; +} + +int ClientListenerImpl::event_received(const char *event_param) { + cout << "event_received(char *" << event_param << ") " << endl; + return 0; +} + +int ClientListenerImpl::event_received(const BusMessage *event_param) { + cout << "event_received(BusMessage *)" << endl; + return 0; +} + +int main(int argc, char** argv) +{ + BusClient *client; + ClientListenerImpl *lstnr; + int err_flg; + BusMessage *busmsg; + + if (argc >= 3) { + client = new BusClient(); + lstnr = new ClientListenerImpl(); + err_flg = client->init(argv[1]); + if (err_flg == 0) { + cout << "init success" << endl; + err_flg = client->add_client_listener(lstnr); + if (err_flg == 0) { + int err_flg; + char *rsp; + + busmsg = new BusMessage(); + busmsg->add_string_parameter("a", "hello"); + busmsg->add_string_parameter("b", "world"); + client->send_message_and_request_response(busmsg); + + rsp = NULL; + err_flg = client->send_message_and_wait_response(argv[2], &rsp); + cout << "rsp: " << rsp << endl; + err_flg = client->send_message_and_request_response(argv[2]); + if (err_flg == 0) { + cout << "request message send successfully" << endl; + } + sleep(10); + } + else { + cout << "client failed to add response listener" << endl; + } + } + else { + cout << "client failed to init" << endl; + } + } + else { + cout << "usage: " << endl; + } + return 0; +} diff --git a/src_test/test_server.cc b/src_test/test_server.cc new file mode 100644 index 0000000..801ca08 --- /dev/null +++ b/src_test/test_server.cc @@ -0,0 +1,46 @@ +#include "plpbus/BusServer.hh" + +using namespace std; +using namespace plpbus; + +class ServerListenerImpl : public IServerListener +{ + public: + inline ServerListenerImpl() {} + virtual ~ServerListenerImpl() {} + virtual int request_received(const char *msg_req, char **msg_rsp); + virtual int request_received(const BusMessage *msg_req, BusMessage **msg_rsp); +}; + +int ServerListenerImpl::request_received(const char *msg_req_param, char **msg_rsp_param) { + cout << "request_received(char *" << msg_req_param << ") " << endl; + *msg_rsp_param = strdup("jee"); + return 0; +} + +int ServerListenerImpl::request_received(const BusMessage *msg_req_param, BusMessage **msg_rsp_param) { + cout << "request_received(BusMessage *) " << endl; + *msg_rsp_param = new BusMessage(); + double dbl = (double)1.0; + (*msg_rsp_param)->add_double_parameter("rsp_param_double", dbl); + return 0; +} + +int main(int argc, char** argv) +{ + BusServer *server; + ServerListenerImpl *listener; + + if (argc >= 2) { + cout << "starting server" << endl; + server = new BusServer(); + server->init(); + listener = new ServerListenerImpl(); + server->add_server_listener(listener); + server->launch(argv[1]); + } + else { + cout << "usage: give server name as a parameter" << endl; + } + return 0; +}