📄 poaimpl.h
字号:
// -*- Mode: C++; -*-// Package : omniORB// poaimpl.h Created on: 31/3/99// Author : David Riddoch (djr)//// Copyright (C) 1996-1999 AT&T Research 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:// Internal implementation of the POA.///* $Log: poaimpl.h,v $ Revision 1.1.4.13 2005/07/21 15:25:11 dgrisby Silence some gcc 4 warnings / errors. Revision 1.1.4.12 2002/11/08 17:26:25 dgrisby Hang on shutdown with servant locators. Revision 1.1.4.11 2002/10/14 15:14:54 dgrisby Fix create_POA / destroy deadlock, unique persistent system ids. Revision 1.1.4.10 2001/11/13 14:11:44 dpg1 Tweaks for CORBA 2.5 compliance. Revision 1.1.4.9 2001/11/08 16:33:50 dpg1 Local servant POA shortcut policy. Revision 1.1.4.8 2001/08/17 15:00:48 dpg1 Fixes for pre-historic compilers. Revision 1.1.4.7 2001/08/15 10:26:09 dpg1 New object table behaviour, correct POA semantics. Revision 1.1.4.6 2001/08/01 10:08:21 dpg1 Main thread policy. Revision 1.1.4.5 2001/07/31 16:10:38 sll Added GIOP BiDir support. Revision 1.1.4.4 2001/06/29 16:24:47 dpg1 Support re-entrancy in single thread policy POAs. Revision 1.1.4.3 2001/06/07 16:24:09 dpg1 PortableServer::Current support. Revision 1.1.4.2 2001/05/29 17:03:49 dpg1 In process identity. Revision 1.1.4.1 2001/04/18 17:18:15 sll Big checkin with the brand new internal APIs. These files were relocated and scoped with the omni namespace. Revision 1.2.2.1 2000/07/17 10:35:57 sll Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. Revision 1.3 2000/07/13 15:25:56 dpg1 Merge from omni3_develop for 3.0 release. Revision 1.1.2.8 2000/06/02 16:09:59 dpg1 If an object is deactivated while its POA is in the HOLDING state, clients which were held now receive a TRANSIENT exception when the POA becomes active again. Revision 1.1.2.7 2000/04/27 10:51:44 dpg1 Interoperable Naming Service Add magic INS POA. Revision 1.1.2.6 2000/02/09 12:04:53 djr Fixed memory allocation bug in Any insertion/extraction of strings. Optimisation for insertion/extraction of sequence of simple types. Revision 1.1.2.5 1999/10/04 17:08:33 djr Some more fixes/MSVC work-arounds. Revision 1.1.2.4 1999/09/30 11:52:32 djr Implemented use of AdapterActivators in POAs. Revision 1.1.2.3 1999/09/28 10:54:35 djr Removed pretty-printing of object keys from object adapters. Revision 1.1.2.2 1999/09/24 10:28:52 djr Added POA_Helper and POA::the_children(). Revision 1.1.2.1 1999/09/22 14:27:01 djr Major rewrite of orbcore to support POA.*/#ifndef __POAIMPL_H__#define __POAIMPL_H__#include <objectAdapter.h>#include <poamanager.h>#include <rmutex.h>#include <omniORB4/callHandle.h>OMNI_NAMESPACE_BEGIN(omni)#define PS_VERSION ":2.4"class omniOrbPOAManager;class omniOrbPOA : public PortableServer::POA, public omniObjAdapter{public: virtual ~omniOrbPOA(); // Must not hold <omni::internalLock>. ///////////////////////// // PortableServer::POA // ///////////////////////// virtual PortableServer::POA_ptr create_POA(const char* adapter_name, PortableServer::POAManager_ptr a_POAManager, const CORBA::PolicyList& policies); virtual PortableServer::POA_ptr find_POA(const char* adapter_name, CORBA::Boolean activate_it); virtual void destroy(CORBA::Boolean etherealize_objects, CORBA::Boolean wait_for_completion); virtual char* the_name(); virtual PortableServer::POA_ptr the_parent(); virtual PortableServer::POAList* the_children(); virtual PortableServer::POAManager_ptr the_POAManager(); virtual PortableServer::AdapterActivator_ptr the_activator(); virtual void the_activator(PortableServer::AdapterActivator_ptr aa); virtual PortableServer::ServantManager_ptr get_servant_manager(); virtual void set_servant_manager(PortableServer::ServantManager_ptr imgr); virtual PortableServer::Servant get_servant(); virtual void set_servant(PortableServer::Servant p_servant); virtual PortableServer::ObjectId* activate_object( PortableServer::Servant p_servant); virtual void activate_object_with_id(const PortableServer::ObjectId& id, PortableServer::Servant p_servant); virtual void deactivate_object(const PortableServer::ObjectId& oid); virtual CORBA::Object_ptr create_reference(const char* intf); virtual CORBA::Object_ptr create_reference_with_id( const PortableServer::ObjectId& oid, const char* intf); virtual PortableServer::ObjectId* servant_to_id(PortableServer::Servant p_servant); virtual CORBA::Object_ptr servant_to_reference(PortableServer::Servant p_servant); virtual PortableServer::Servant reference_to_servant(CORBA::Object_ptr reference); virtual PortableServer::ObjectId* reference_to_id(CORBA::Object_ptr reference); virtual PortableServer::Servant id_to_servant(const PortableServer::ObjectId& oid); virtual CORBA::Object_ptr id_to_reference(const PortableServer::ObjectId& oid); virtual CORBA::OctetSeq* id(); //////////////////////////// // Override CORBA::Object // //////////////////////////// virtual _CORBA_Boolean _non_existent(); virtual void* _ptrToObjRef(const char* repoId); virtual void _NP_incrRefCount(); virtual void _NP_decrRefCount(); ///////////////////////////// // Override omniObjAdapter // ///////////////////////////// virtual void incrRefCount(); virtual void decrRefCount(); virtual void dispatch(omniCallHandle&, omniLocalIdentity*); virtual void dispatch(omniCallHandle&, const _CORBA_Octet* key, int keysize); virtual void dispatch(omniCallDescriptor&, omniLocalIdentity*); virtual int objectExists(const _CORBA_Octet* key, int keysize); virtual void lastInvocationHasCompleted(omniLocalIdentity* id); ////////////////////// // omniORB Internal // ////////////////////// enum { TP_ORB_CTRL = 0, TP_SINGLE_THREAD = 1, TP_MAIN_THREAD = 2 }; // Values for the threading field of Policies below. enum { RPP_ACTIVE_OBJ_MAP = 0, RPP_DEFAULT_SERVANT = 1, RPP_SERVANT_MANAGER = 2 }; // Values for the req_processing field of Policies below. struct Policies { unsigned threading : 2; unsigned transient : 1; unsigned multiple_id : 1; unsigned user_assigned_id : 1; unsigned retain_servants : 1; unsigned req_processing : 2; unsigned implicit_activation : 1; unsigned bidirectional_accept : 1; unsigned local_shortcut : 1; }; inline _CORBA_Boolean acceptBiDirectional() const { return pd_policy.bidirectional_accept; } typedef _CORBA_PseudoValue_Sequence<omniOrbPOA*> ChildSeq; omniOrbPOA(const char* name, omniOrbPOAManager* manager, const Policies& policies, omniOrbPOA* parent); // Consumes <manager>. omniOrbPOA(); // Constructor for nil POA object. void do_destroy(_CORBA_Boolean etherealize_objects); // The main work of destroying a POA. Called by destroy(), // either directly or from a separate thread. POA is // already marked dying at this stage. // Must not hold any mutexes. ///////////////////////// // POA Manager support // ///////////////////////// void pm_change_state(omniOrbPOAManager::State new_state); // Changes the current POA state, returning immediately. // Must be called by the POAManager (pd_manager) only. void pm_waitForReqCmpltnOrSttChnge(omniOrbPOAManager::State state); // Blocks until all outstanding requests on objects in this POA // complete, or the state changes (due to another call on the // POA manager). void pm_deactivate(_CORBA_Boolean etherealize_objects); // Implements POAManager::deactivate(). Blocks until complete. void* servant__this(PortableServer::Servant servant, const char* repoId); // Used by PortableServer::ServantBase::_do_this() to implement // POA_foo::_this(). static PortableServer::POA_ptr rootPOA(int init_if_none = 1); // Returns a reference to the root poa, initialising the // POA and omniObjAdapter if necessary. if <init_if_none> // is zero, and the POA has not been initialised, then this // returns 0 (*not* POA::_nil()). // This function is thread-safe. //?? Can this throw exceptions? What if it fails?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -