00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Table_Adapter.h 00006 * 00007 * $Id: Table_Adapter.h 76995 2007-02-11 12:51:42Z 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 /// @return 1 if found, 0 otherwise. 00065 CORBA::Long find_object (TAO::ObjectKey &key, 00066 CORBA::Object_out forward_to); 00067 00068 /// The ORB Core we belong to 00069 TAO_ORB_Core &orb_core_; 00070 00071 /// The table implementation 00072 TAO_IOR_Table_Impl_var root_; 00073 00074 bool closed_; 00075 bool enable_locking_; 00076 TAO_SYNCH_MUTEX thread_lock_; 00077 ACE_Lock *lock_; 00078 }; 00079 00080 // **************************************************************** 00081 00082 class TAO_IORTable_Export TAO_Table_Adapter_Factory : public TAO_Adapter_Factory 00083 { 00084 public: 00085 /// Constructor 00086 TAO_Table_Adapter_Factory (void); 00087 00088 // = The TAO_Adapter_Factory methods, please read tao/Adapter.h for 00089 // details. 00090 virtual TAO_Adapter *create (TAO_ORB_Core *orb_core); 00091 }; 00092 00093 TAO_END_VERSIONED_NAMESPACE_DECL 00094 00095 ACE_STATIC_SVC_DECLARE (TAO_Table_Adapter_Factory) 00096 ACE_FACTORY_DECLARE (TAO_IORTable, TAO_Table_Adapter_Factory) 00097 00098 #include /**/ "ace/post.h" 00099 #endif /* TAO_TABLE_ADAPTER_H */