00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Table_Adapter.h 00006 * 00007 * $Id: Table_Adapter.h 84215 2009-01-22 18:31:17Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan (coryan@uci.edu) 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_TABLE_ADAPTER_H 00015 #define TAO_TABLE_ADAPTER_H 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/IORTable/iortable_export.h" 00019 #include "tao/IORTable/IORTable.h" 00020 #include "tao/IORTable/IOR_Table_Impl.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include "tao/Adapter.h" 00027 #include "tao/Adapter_Factory.h" 00028 #include "ace/Service_Config.h" 00029 #include "ace/Lock.h" 00030 #include "tao/ORB_Core.h" 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_IORTable_Export TAO_Table_Adapter : public TAO_Adapter 00035 { 00036 public: 00037 00038 /// Constructor 00039 TAO_Table_Adapter (TAO_ORB_Core &orb_core); 00040 00041 /// Destructor 00042 virtual ~TAO_Table_Adapter (void); 00043 00044 // = The TAO_Adapter methods, please check tao/Adapter.h for the 00045 // documentation 00046 virtual void open (void); 00047 virtual void close (int wait_for_completion); 00048 virtual void check_close (int wait_for_completion); 00049 virtual int priority (void) const; 00050 virtual int dispatch (TAO::ObjectKey &key, 00051 TAO_ServerRequest &request, 00052 CORBA::Object_out foward_to); 00053 00054 virtual const char *name (void) const; 00055 virtual CORBA::Object_ptr root (void); 00056 virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *, 00057 const TAO_MProfile &); 00058 00059 virtual CORBA::Long initialize_collocated_object (TAO_Stub *stub); 00060 00061 private: 00062 static ACE_Lock * create_lock (bool enable_locking, TAO_SYNCH_MUTEX &l); 00063 /// Helper method to find an object bound in the table. 00064 bool find_object (TAO::ObjectKey &key, 00065 CORBA::Object_out forward_to); 00066 00067 /// The ORB Core we belong to 00068 TAO_ORB_Core &orb_core_; 00069 00070 /// The table implementation 00071 TAO_IOR_Table_Impl_var root_; 00072 00073 bool closed_; 00074 bool enable_locking_; 00075 TAO_SYNCH_MUTEX thread_lock_; 00076 ACE_Lock *lock_; 00077 }; 00078 00079 // **************************************************************** 00080 00081 class TAO_IORTable_Export TAO_Table_Adapter_Factory : public TAO_Adapter_Factory 00082 { 00083 public: 00084 /// Constructor 00085 TAO_Table_Adapter_Factory (void); 00086 00087 // = The TAO_Adapter_Factory methods, please read tao/Adapter.h for 00088 // details. 00089 virtual TAO_Adapter *create (TAO_ORB_Core *orb_core); 00090 }; 00091 00092 TAO_END_VERSIONED_NAMESPACE_DECL 00093 00094 ACE_STATIC_SVC_DECLARE (TAO_Table_Adapter_Factory) 00095 ACE_FACTORY_DECLARE (TAO_IORTable, TAO_Table_Adapter_Factory) 00096 00097 #include /**/ "ace/post.h" 00098 #endif /* TAO_TABLE_ADAPTER_H */