[sword-cvs] sword/bindings/corba/orbitcpp Makefile,1.1,1.2 server.cpp,1.1,1.2 sword-impl.hpp,1.1,1.2 swordorb-impl.cpp,1.1,1.2 testclient.cpp,1.1,1.2

sword@www.crosswire.org sword@www.crosswire.org
Sat, 3 May 2003 18:03:02 -0700


Update of /usr/local/cvsroot/sword/bindings/corba/orbitcpp
In directory www:/tmp/cvs-serv30176/bindings/corba/orbitcpp

Modified Files:
	Makefile server.cpp sword-impl.hpp swordorb-impl.cpp 
	testclient.cpp 
Log Message:


Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile	2 May 2003 10:36:38 -0000	1.1
--- Makefile	4 May 2003 01:03:00 -0000	1.2
***************
*** 2,8 ****
  
  server: server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o
! 	g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o server server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o `orbit2-config --libs` -lORBit-2-cpp
  
! testclient: server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o
  	g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o testclient testclient.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o `orbit2-config --libs` -lORBit-2-cpp
  
--- 2,8 ----
  
  server: server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o
! 	g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o server server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-cpp-skels.o swordorb-skels.o `orbit2-config --libs` -lORBit-2-cpp -lsword -lz
  
! testclient: testclient.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o
  	g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o testclient testclient.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o `orbit2-config --libs` -lORBit-2-cpp
  

Index: server.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/server.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** server.cpp	2 May 2003 10:36:38 -0000	1.1
--- server.cpp	4 May 2003 01:03:00 -0000	1.2
***************
*** 3,11 ****
  #include "sword-impl.hpp"
  #include <iostream>
  
! int main (int argc, char* argv[])
! {
!   try
!   {
   	  // Initialize the CORBA orb
   	  CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
--- 3,12 ----
  #include "sword-impl.hpp"
  #include <iostream>
+ #include <swmgr.h>
  
! sword::SWMgr swordmgr;
! 
! int main (int argc, char* argv[]) {
!   try {
   	  // Initialize the CORBA orb
   	  CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
***************
*** 23,38 ****
  
   	  // Create a Servant and explicitly create a CORBA object
! // 	  swordorb::SWModule_impl servant;
! // 	  CORBA::Object_var object = servant._this();
  
   	  // Here we get the IOR for the Hello server object.
   	  // Our "client" will use the IOR to find the object to connect to
! // 	  CORBA::String_var ref = orb->object_to_string( object );
  
   	  // print out the IOR
! // 	  std::cout << ref << std::endl;
  
   	  // run the server event loop
! // 	  orb->run();
    }
    catch(const CORBA::Exception& ex)
--- 24,39 ----
  
   	  // Create a Servant and explicitly create a CORBA object
!  	  swordorb::SWMgr_impl servant(&swordmgr);
!  	  CORBA::Object_var object = servant._this();
  
   	  // Here we get the IOR for the Hello server object.
   	  // Our "client" will use the IOR to find the object to connect to
!  	  CORBA::String_var ref = orb->object_to_string( object );
  
   	  // print out the IOR
!  	  std::cout << ref << std::endl;
  
   	  // run the server event loop
!  	  orb->run();
    }
    catch(const CORBA::Exception& ex)

Index: sword-impl.hpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/sword-impl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sword-impl.hpp	2 May 2003 10:36:38 -0000	1.1
--- sword-impl.hpp	4 May 2003 01:03:00 -0000	1.2
***************
*** 5,9 ****
  #include "swordorb-cpp-skels.h"
  #include <swmodule.h>
! #include <swkey.h>
  
  
--- 5,9 ----
  #include "swordorb-cpp-skels.h"
  #include <swmodule.h>
! #include <swmgr.h>
  
  
***************
*** 31,34 ****
--- 31,51 ----
  };
  
+ class SWMgr_impl : public POA_swordorb::SWMgr {
+ 	sword::SWMgr *delegate;
+ public:
+ 	SWMgr_impl(sword::SWMgr *delegate)  { this->delegate = delegate; }
+ 
+ 	ModInfoList *getModInfoList() throw(CORBA::SystemException);
+ 	SWModule_ptr getModuleByName(const char *name) throw(CORBA::SystemException);
+ 	char *getPrefixPath() throw(CORBA::SystemException) { return delegate->prefixPath; }
+ 	char *getConfigPath() throw(CORBA::SystemException) { return delegate->configPath; }
+ 	void  setGlobalOption(const char *option, const char *value) throw(CORBA::SystemException) { delegate->setGlobalOption(option, value); }
+ 	char *getGlobalOption(const char *option) throw(CORBA::SystemException) { return (char *)delegate->getGlobalOption(option); }
+ 	char *getGlobalOptionTip(const char *option) throw(CORBA::SystemException) { return (char *)delegate->getGlobalOptionTip(option); }
+ 	StringList *getGlobalOptionsIterator() throw(CORBA::SystemException);
+ 	StringList *getGlobalOptionValuesIterator(const char *option) throw(CORBA::SystemException);
+ 	void     setCipherKey(const char *modName, const char *key) throw(CORBA::SystemException) { delegate->setCipherKey(modName, key); }
+ 
+ };
  }; // namespace hellomodule
  

Index: swordorb-impl.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/swordorb-impl.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** swordorb-impl.cpp	2 May 2003 10:36:38 -0000	1.1
--- swordorb-impl.cpp	4 May 2003 01:03:00 -0000	1.2
***************
*** 1,4 ****
--- 1,5 ----
  #include "sword-impl.hpp"
  #include <iostream>
+ #include <swmgr.h>
  
  /*
***************
*** 8,9 ****
--- 9,37 ----
  }
  */
+ 
+ namespace swordorb {
+ 	ModInfoList *SWMgr_impl::getModInfoList() throw(CORBA::SystemException) {
+ 		ModInfoList *milist = new ModInfoList;
+ 		sword::SWModule *module = 0;
+ 		int size = 0;
+ 		for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) size++;
+ 		milist->length(size);
+ 		int i = 0;
+ 		for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) {
+ 			module = it->second;
+ 			(*milist)[i].name = CORBA::string_dup(module->Name());
+ 			(*milist)[i].type = CORBA::string_dup(module->Type());
+ 			(*milist)[i++].lang = CORBA::string_dup(module->Lang());
+ 		}
+ 		return milist;
+ 	}
+ 
+ 	SWModule_ptr SWMgr_impl::getModuleByName(const char *name) throw(CORBA::SystemException) {
+ 	}
+ 
+ 	StringList *SWMgr_impl::getGlobalOptionsIterator() throw(CORBA::SystemException) {
+ 	}
+ 
+ 	StringList *SWMgr_impl::getGlobalOptionValuesIterator(const char *option) throw(CORBA::SystemException) {
+ 	}
+ }

Index: testclient.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/testclient.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** testclient.cpp	2 May 2003 10:36:38 -0000	1.1
--- testclient.cpp	4 May 2003 01:03:00 -0000	1.2
***************
*** 23,39 ****
  		// command line
  		CORBA::Object_var obj = orb->string_to_object(argv[1]);
! 		swordorb::SWModule_var ptr = swordorb::SWModule::_narrow(obj);
! 
! 		// The argument is a simple string
! 		const char* message = "Hello server, from client!";
! 
! 		// The result is stored in a CORBA-aware smartpointer
! 		CORBA::String_var reply;
  
  		// Do the actual CORBA call here
! 		reply = ptr->getName();
! 
! 		// Print reply
! 		std::cout << "Client: Reply was \"" << reply << "\"" << std::endl;
  		
  	} catch(const CORBA::Exception& ex) {
--- 23,35 ----
  		// command line
  		CORBA::Object_var obj = orb->string_to_object(argv[1]);
! 		swordorb::SWMgr_var ptr = swordorb::SWMgr::_narrow(obj);
  
+ 		swordorb::ModInfoList *modInfoList;
  		// Do the actual CORBA call here
! 		modInfoList = ptr->getModInfoList();
! 		std::cout << "sequence length: " << modInfoList->length() << "\n";
! 		for (int i = 0; i < modInfoList->length(); i++) {
! 			std::cout << (*modInfoList)[i].name << ": " << (*modInfoList)[i].type << ": " << (*modInfoList)[i].lang << "\n";
! 		}
  		
  	} catch(const CORBA::Exception& ex) {