⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 corbaorb.cc

📁 编译工具
💻 CC
📖 第 1 页 / 共 3 页
字号:
// -*- Mode: C++; -*-//                            Package   : omniORB// corbaOrb.cc                Created on: 6/2/96//                            Author    : Sai Lai Lo (sll)////    Copyright (C) 1996-1999 AT&T Laboratories Cambridge////    This file is part of the omniORB library////    The omniORB library is free software; you can redistribute it and/or//    modify it under the terms of the GNU Library General Public//    License as published by the Free Software Foundation; either//    version 2 of the License, or (at your option) any later version.////    This library is distributed in the hope that it will be useful,//    but WITHOUT ANY WARRANTY; without even the implied warranty of//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU//    Library General Public License for more details.////    You should have received a copy of the GNU Library General Public//    License along with this library; if not, write to the Free//    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA//    02111-1307, USA////// Description://      Implementation of the ORB interface///*  $Log: corbaOrb.cc,v $  Revision 1.33.2.48  2005/11/28 14:57:51  dgrisby  New abortOnNativeException parameter for Windows.  Revision 1.33.2.47  2005/09/08 14:26:17  dgrisby  New -ORBconfigFile command line argument.  Revision 1.33.2.46  2005/03/14 13:36:02  dgrisby  Call detach() not attach() on shutdown!  Revision 1.33.2.45  2003/08/21 14:57:44  dgrisby  Really silly bug broke registry reading on Windows.  Revision 1.33.2.44  2003/07/30 14:23:35  dgrisby  Fix various race conditions in ORB shutdown.  Revision 1.33.2.43  2003/06/02 13:26:59  dgrisby  Configuration dump error on some platforms.  Revision 1.33.2.42  2003/05/27 11:20:44  dgrisby  For some reason the config file was not looked at on Windows.  Revision 1.33.2.41  2002/09/09 00:24:40  dgrisby  Make sure various modules initialise. Needed by MacOSX.  Revision 1.33.2.40  2002/09/08 21:58:54  dgrisby  Support for MSVC 7. (Untested.)  Revision 1.33.2.39  2002/03/18 15:13:07  dpg1  Fix bug with old-style ORBInitRef in config file; look for  -ORBtraceLevel arg before anything else; update Windows registry  key. Correct error message.  Revision 1.33.2.38  2002/03/13 16:05:38  dpg1  Transport shutdown fixes. Reference count SocketCollections to avoid  connections using them after they are deleted. Properly close  connections when in thread pool mode.  Revision 1.33.2.37  2002/02/21 15:57:46  dpg1  Remove dead code.  Revision 1.33.2.36  2002/02/11 15:15:50  dpg1  Things for ETS kernel.  Revision 1.33.2.35  2002/01/16 11:31:58  dpg1  Race condition in use of registerNilCorbaObject/registerTrackedObject.  (Reported by Teemu Torma).  Revision 1.33.2.34  2002/01/15 16:38:12  dpg1  On the road to autoconf. Dependencies refactored, configure.ac  written. No makefiles yet.  Revision 1.33.2.33  2002/01/09 11:35:22  dpg1  Remove separate omniAsyncInvoker library to save library overhead.  Revision 1.33.2.32  2001/11/13 14:11:45  dpg1  Tweaks for CORBA 2.5 compliance.  Revision 1.33.2.31  2001/11/06 15:41:38  dpg1  Reimplement Context. Remove CORBA::Status. Tidying up.  Revision 1.33.2.30  2001/10/19 11:06:45  dpg1  Principal support for GIOP 1.0. Correct some spelling mistakes.  Revision 1.33.2.29  2001/09/20 14:18:12  dpg1  Make hooked initialiser suitable for ORB restart.  Revision 1.33.2.28  2001/09/20 13:26:13  dpg1  Allow ORB_init() after orb->destroy().  Revision 1.33.2.27  2001/09/19 17:26:48  dpg1  Full clean-up after orb->destroy().  Revision 1.33.2.26  2001/08/24 16:44:59  sll  Switch to use Winsock 2. Replaced wsock32.lib with ws2_32.lib and mswsock.lib  Revision 1.33.2.25  2001/08/23 16:01:43  sll  Added initialisers for transportRules and giopEndpoint.  Revision 1.33.2.24  2001/08/21 11:02:13  sll  orbOptions handlers are now told where an option comes from. This  is necessary to process DefaultInitRef and InitRef correctly.  Revision 1.33.2.23  2001/08/20 08:19:22  sll  Read the new ORB configuration file format. Can still read old format.  Can also set configuration parameters from environment variables.  Revision 1.33.2.22  2001/08/17 17:12:35  sll  Modularise ORB configuration parameters.  Revision 1.33.2.21  2001/08/08 15:57:11  sll  New options unixTransportDirectory & unixTransportPermission.  Revision 1.33.2.20  2001/08/03 17:41:19  sll  System exception minor code overhaul. When a system exeception is raised,  a meaning minor code is provided.  Revision 1.33.2.19  2001/08/01 10:08:21  dpg1  Main thread policy.  Revision 1.33.2.18  2001/07/31 16:28:00  sll  Added GIOP BiDir support.  Revision 1.33.2.17  2001/07/13 15:23:09  sll  New ORB initialisation options.  Revision 1.33.2.16  2001/06/18 16:28:49  dpg1  Print out distribution date at ORB_init()  Revision 1.33.2.15  2001/06/18 16:18:49  dpg1  Print out distribution date at ORB_init()  Revision 1.33.2.14  2001/06/11 17:57:13  sll   External libraries can now hook-up to the orb initialiser list irrespective   of whether the global variables in the external libraries are initialised   before the core library.  Revision 1.33.2.13  2001/06/07 16:24:09  dpg1  PortableServer::Current support.  Revision 1.33.2.12  2001/05/31 16:18:12  dpg1  inline string matching functions, re-ordered string matching in  _ptrToInterface/_ptrToObjRef  Revision 1.33.2.11  2001/05/09 20:03:14  sll  ORB::shutdown() now works as expected.  Moved calling detach() on all the initializers from shutdown() to destroy()  Revision 1.33.2.10  2001/04/19 11:16:39  sll  Missing -ORBhelp listing for -ORBmaxGIOPVersion  Revision 1.33.2.9  2001/04/18 18:18:09  sll  Big checkin with the brand new internal APIs.  Revision 1.33.2.8  2000/11/20 11:59:44  dpg1  API to configure code sets.  Revision 1.33.2.7  2000/11/15 17:19:07  sll  Added initialiser for cdrStream.  Revision 1.33.2.6  2000/11/09 12:27:56  dpg1  Huge merge from omni3_develop, plus full long long from omni3_1_develop.  Revision 1.33.2.5  2000/10/27 15:42:07  dpg1  Initial code set conversion support. Not yet enabled or fully tested.  Revision 1.33.2.4  2000/10/04 16:54:41  sll  Added omni_omniIOR_initialiser_.  Revision 1.33.2.3  2000/10/03 17:37:42  sll  New initialiser for omniIOR.  Revision 1.33.2.2  2000/09/27 17:54:29  sll  Updated to identify the ORB as omniORB4. Added initialiser calls to the new  code.  Revision 1.33.2.1  2000/07/17 10:35:52  sll  Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0.  Revision 1.34  2000/07/13 15:25:58  dpg1  Merge from omni3_develop for 3.0 release.  Revision 1.29.6.20  2000/07/10 10:56:43  sll  Minor rearrangement to keep DEC C++ 5.6 happy.  Revision 1.29.6.19  2000/06/22 10:40:14  dpg1  exception.h renamed to exceptiondefs.h to avoid name clash on some  platforms.  Revision 1.29.6.18  2000/06/19 14:18:33  dpg1  Explicit cast to (const char*) when using String_var with logger.  Revision 1.29.6.17  2000/06/02 14:17:05  dpg1  Add static install() method to initialiser so extra initialisers /  deinitialisers can be added at run time (needed by omniORBpy).  Revision 1.29.6.16  2000/05/24 17:19:41  dpg1  Add documented but non-existent -ORBobjectTableSize and  -ORBno_bootstrap_agent arguments  Revision 1.29.6.15  2000/04/27 10:46:30  dpg1  Interoperable Naming Service  Add initialisers for URI and initRefs modules.  object_to_string() and string_to_object() use omniURI:: functions.  resolve_initial_references() replaced with omniInitialReferences::resolve().  Add -ORBInitRef and -ORBDefaultInitRef command-line options.  Revision 1.29.6.14  2000/02/04 18:11:01  djr  Minor mods for IRIX (casting pointers to ulong instead of int).  Revision 1.29.6.13  2000/01/27 10:55:45  djr  Mods needed for powerpc_aix.  New macro OMNIORB_BASE_CTOR to provide  fqname for base class constructor for some compilers.  Revision 1.29.6.12  2000/01/22 16:46:04  djr  Added -ORBtraceInvocations to option help summary.  Revision 1.29.6.11  2000/01/20 11:51:34  djr  (Most) Pseudo objects now used omni::poRcLock for ref counting.  New assertion check OMNI_USER_CHECK.  Revision 1.29.6.10  2000/01/07 14:51:13  djr  Call timeouts are now disabled by default.  Revision 1.29.6.9  2000/01/05 17:59:45  djr  Added check for reinitialisation in ORB_init.  Revision 1.29.6.8  1999/11/02 17:47:01  djr  Removed obsolete references to rope factories.  Revision 1.29.6.7  1999/10/29 13:18:17  djr  Changes to ensure mutexes are constructed when accessed.  Revision 1.29.6.6  1999/10/14 16:22:06  djr  Implemented logging when system exceptions are thrown.  Revision 1.29.6.5  1999/10/04 17:08:32  djr  Some more fixes/MSVC work-arounds.  Revision 1.29.6.4  1999/09/24 17:11:11  djr  New option -ORBtraceInvocations and omniORB::traceInvocations.  Revision 1.29.6.3  1999/09/24 15:01:33  djr  Added module initialisers, and sll's new scavenger implementation.  Revision 1.29.6.2  1999/09/24 10:27:30  djr  Improvements to ORB and BOA options.  Revision 1.29.6.1  1999/09/22 14:26:45  djr  Major rewrite of orbcore to support POA.  Revision 1.28  1999/08/30 16:53:04  sll  Added new options -ORBclientCallTimeOutPeriod, -ORBserverCallTimeOutPeriod  -ORBscanOutgoingPeriod, -ORBscanIncomingPeriod and -ORBhelp.  Revision 1.25  1999/06/26 18:05:36  sll  New options -ORBabortOnInternalError, -ORBverifyObjectExistsAndType.  Revision 1.24  1999/05/25 17:20:44  sll  Added check for invalid arguments in static member functions.  Default to throw system exception in the DII interface.  resolve_initial_reference now deals with InterfaceRepository.  Revision 1.23  1999/05/22 17:40:57  sll  Added #ifdef __CIAO__ so that CCia would not complain about gnu/linux  particulars.  Revision 1.22  1999/03/19 15:18:00  djr  New option acceptMisalignedIndirections  Revision 1.21  1999/03/11 16:25:52  djr  Updated copyright notice  Revision 1.20  1999/02/18 15:15:12  djr  omniORB::strictIIOP if now true by default.  New runtime option -ORBlcdMode  (omniORB::enableLcdMode())  Revision 1.19  1999/02/01 15:16:14  djr  Replace copy-initialisation of _var types with direct initialisation.  Revision 1.18  1999/01/07 15:33:34  djr  New configuration variable omniORB::diiThrowsSysExceptions  New command line options -ORBdiiThrowsSysExceptions                           -ORBinConScanPeriod                           -ORBoutConScanPeriod  Revision 1.17  1998/08/26 21:52:29  sll  Added configuration variable omniORB::maxTcpConnectionPerServer.  Revision 1.16  1998/08/21 19:13:32  sll  Use omniInitialReferences::singleton() to manage initial object references.  New command line options: -ORBInitialHost, -ORBInitialPort.  Revision 1.15  1998/08/14 13:44:57  sll  Added pragma hdrstop to control pre-compile header if the compiler feature  is available.  Revision 1.14  1998/04/18 10:09:52  sll  Make the definition of omniORB::serverName consistent with omniORB.h  Revision 1.13  1998/04/08 16:06:25  sll  Added support for Reliant UNIX 5.43.  Revision 1.12  1998/04/07 19:32:38  sll  Replace cerr with omniORB::log.  Use namespace and bool type if available.// Revision 1.11  1998/03/04  15:21:39  ewc// giopServerThreadWrapper singelton initialised//// Revision 1.10  1998/02/26  10:41:18  sll// Parse_ORB_args once again handles the case when argv is a NULL pointer// properly.//// Revision 1.9  1998/01/27  15:32:14  ewc// Added -ORBtcAliasExpand flag//  Revision 1.8  1997/12/12 18:42:24  sll  New command line option to set omniORB::serverName.  Revision 1.7  1997/12/09 18:29:46  sll  Merged in code from orb.cc  Updated to use the new rope factory interface.  Old code to deal with server side thread management removed.// Revision 1.6  1997/05/06  15:11:03  sll// Public release.// */#include <omniORB4/CORBA.h>#ifdef HAS_pch#pragma hdrstop#endif#include <corbaOrb.h>#include <initRefs.h>#include <omniORB4/omniObjRef.h>#include <poaimpl.h>#include <initialiser.h>#include <exceptiondefs.h>#include <omniORB4/omniURI.h>#include <omniORB4/minorCode.h>#include <omniORB4/objTracker.h>#include <giopStreamImpl.h>#include <invoker.h>#include <omniCurrent.h>#include <omniORB4/distdate.hh>#include <orbOptions.h>#include <orbParameters.h>#include <omniIdentity.h>#include <SocketCollection.h>#ifdef HAVE_SIGNAL_H#  include <signal.h>#  include <errno.h>#endif#include <stdio.h>#include <stdlib.h>OMNI_USING_NAMESPACE(omni)#define ORB_ID_STRING "omniORB4"static const char* orb_ids[] = { ORB_ID_STRING,				 "omniORB3",				 "omniORB2",				 0 };static omniOrbORB*          the_orb                   = 0;static int                  orb_count                 = 0;static omni_tracedmutex     orb_lock;static omni_tracedcondition orb_signal(&orb_lock);static volatile int         orb_n_blocked_in_run      = 0;// For the main thread AsyncInvoker:static volatile int         invoker_threads           = 0;static omni_tracedcondition invoker_signal(&orb_lock);static omniTaskLink         invoker_dedicated_tq;static CORBA::Boolean       invoker_shutting_down     = 0;#ifdef __SINIX__// Why haven't we got this signature from signal.h? - sll//extern "C" int sigaction(int, const struct sigaction *, struct sigaction *);#endif// Config file#if defined(NTArchitecture) && !defined(__ETS_KERNEL__)static const char* config_fname = 0;#elsestatic const char* config_fname = CONFIG_DEFAULT_LOCATION;#endif/////////////////////////////////////////////////////////////////////////          Per module initialisers.//OMNI_NAMESPACE_BEGIN(omni)ORBAsyncInvoker* orbAsyncInvoker = 0;extern omniInitialiser& omni_omniIOR_initialiser_;extern omniInitialiser& omni_corbaOrb_initialiser_;extern omniInitialiser& omni_omniInternal_initialiser_;extern omniInitialiser& omni_initRefs_initialiser_;extern omniInitialiser& omni_hooked_initialiser_;extern omniInitialiser& omni_interceptor_initialiser_;extern omniInitialiser& omni_ior_initialiser_;extern omniInitialiser& omni_codeSet_initialiser_;extern omniInitialiser& omni_cdrStream_initialiser_;extern omniInitialiser& omni_giopStrand_initialiser_;extern omniInitialiser& omni_giopStreamImpl_initialiser_;extern omniInitialiser& omni_giopRope_initialiser_;extern omniInitialiser& omni_giopserver_initialiser_;extern omniInitialiser& omni_giopbidir_initialiser_;extern omniInitialiser& omni_omniTransport_initialiser_;extern omniInitialiser& omni_omniCurrent_initialiser_;extern omniInitialiser& omni_dynamiclib_initialiser_;extern omniInitialiser& omni_objadpt_initialiser_;extern omniInitialiser& omni_giopEndpoint_initialiser_;extern omniInitialiser& omni_transportRules_initialiser_;extern omniInitialiser& omni_ObjRef_initialiser_;extern omniInitialiser& omni_orbOptions_initialiser_;extern omniInitialiser& omni_poa_initialiser_;extern omniInitialiser& omni_uri_initialiser_;OMNI_NAMESPACE_END(omni)static voidshutdownAsyncInvoker();/////////////////////////////////////////////////////////////////////////////////////////////////// CORBA::ORB ///////////////////////////////////////////////////////////////////////////////////////////////////CORBA::ORB::~ORB()  {}CORBA::ORB_ptrCORBA::ORB::_duplicate(CORBA::ORB_ptr obj){  if( !CORBA::is_nil(obj) )  obj->_NP_incrRefCount();  return obj;}CORBA::ORB_ptrCORBA::ORB::_narrow(CORBA::Object_ptr obj){  if( CORBA::is_nil(obj) || !obj->_NP_is_pseudo() )  return _nil();  ORB_ptr p = (ORB_ptr) obj->_ptrToObjRef(_PD_repoId);  if( p )  p->_NP_incrRefCount();  return p ? p : _nil();}CORBA::ORB_ptrCORBA::ORB::_nil(){  static omniOrbORB* _the_nil_ptr = 0;  if( !_the_nil_ptr ) {    omni::nilRefLock().lock();    if( !_the_nil_ptr ) {      _the_nil_ptr = new omniOrbORB(1 /* is nil */);      registerNilCorbaObject(_the_nil_ptr);    }    omni::nilRefLock().unlock();  }  return _the_nil_ptr;}const char*CORBA::ORB::_PD_repoId = "IDL:omg.org/CORBA/ORB:1.0";#if defined(__sunos__) && defined(__sparc__) && __OSVERSION__ >= 5#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500#include <exception.h>static void omni_abort(){  abort();}#endif#endifstatic void enableLcdMode() {  orbParameters::strictIIOP = 0;  orbParameters::tcAliasExpand = 1;  orbParameters::scanGranularity = 0;  orbParameters::outConScanPeriod = 0;  orbParameters::inConScanPeriod = 0;  orbParameters::useTypeCodeIndirections = 0;  orbParameters::verifyObjectExistsAndType = 0;  orbParameters::acceptMisalignedTcIndirections = 1;}CORBA::ORB_ptrCORBA::ORB_init(int& argc, char** argv, const char* orb_identifier,		const char* options[][2]){  omni_tracedmutex_lock sync(orb_lock);  if( the_orb ) {    the_orb->_NP_incrRefCount();    return the_orb;  }  const char* option_src_1 = "configuration file";  const char* option_src_2 = "environment variable";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -