00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file ORBInitializer_Registry_Impl.h 00006 * 00007 * $Id: ORBInitializer_Registry_Impl.h 84281 2009-01-30 15:01:17Z wotte $ 00008 * 00009 * @author Ossama Othman <ossama@uci.edu> 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H 00014 #define TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/PI/pi_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/PI/PI.h" 00025 00026 #include "tao/CORBA_methods.h" 00027 #include "tao/Objref_VarOut_T.h" 00028 #include "tao/ORBInitializer_Registry_Adapter.h" 00029 00030 #include "ace/Array_Base.h" 00031 #include "ace/Service_Config.h" 00032 #include "ace/Recursive_Thread_Mutex.h" 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 namespace TAO 00037 { 00038 /** 00039 * @class ORBInitializer_Registry 00040 * 00041 * @brief Global list that contains all portable interceptor ORB 00042 * initializers. 00043 */ 00044 class ORBInitializer_Registry 00045 : public ORBInitializer_Registry_Adapter 00046 { 00047 public: 00048 ORBInitializer_Registry (void); 00049 00050 /// Added to provide registration for the several static service 00051 /// objects, brought in with this ORBInitializer_Registry 00052 /// implementation. Note that this is more reliable than using 00053 /// static initializers, since multiple copies of the dynamic 00054 /// service object will require their own (multiple) copies of the 00055 /// dependent static service objects. That is just impossible 00056 /// without registering those static services in the same repo, the 00057 /// dynamic SO is registered with. 00058 virtual int init (int, ACE_TCHAR *[]); 00059 00060 /// Service config fini method, release all ORBInitializers at this 00061 /// moment 00062 virtual int fini (void); 00063 00064 /// Register an ORBInitializer with the underlying ORBInitializer 00065 /// array. 00066 virtual void register_orb_initializer ( 00067 PortableInterceptor::ORBInitializer_ptr init); 00068 00069 /// Begin initialization of all registered ORBInitializers before 00070 /// the ORB itself is initialized. 00071 virtual size_t pre_init (TAO_ORB_Core *orb_core, 00072 int argc, 00073 char *argv[], 00074 PortableInterceptor::SlotId &slotid); 00075 00076 /// Complete initialization of all registered ORBInitializers after 00077 /// the ORB has been initialized. 00078 virtual void post_init (size_t pre_init_count, 00079 TAO_ORB_Core *orb_core, 00080 int argc, 00081 char *argv[], 00082 PortableInterceptor::SlotId slotid); 00083 00084 private: 00085 // Prevent copying 00086 ORBInitializer_Registry (const ORBInitializer_Registry &); 00087 void operator= (const ORBInitializer_Registry &); 00088 00089 private: 00090 TAO_SYNCH_RECURSIVE_MUTEX lock_; 00091 00092 /// Dynamic array containing registered ORBInitializers. 00093 ACE_Array_Base<PortableInterceptor::ORBInitializer_var> initializers_; 00094 }; 00095 } 00096 00097 00098 ACE_STATIC_SVC_DECLARE (ORBInitializer_Registry) 00099 ACE_FACTORY_DECLARE (TAO_PI, ORBInitializer_Registry) 00100 00101 TAO_END_VERSIONED_NAMESPACE_DECL 00102 00103 #include /**/ "ace/post.h" 00104 00105 #endif /* TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H */