00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file ORBInitializer_Registry_Impl.h 00006 * 00007 * ORBInitializer_Registry_Impl.h,v 1.13 2006/05/10 20:17:28 mesnier_p Exp 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 ACE_ENV_ARG_DECL); 00069 00070 /// Begin initialization of all registered ORBInitializers before 00071 /// the ORB itself is initialized. 00072 virtual size_t pre_init ( 00073 TAO_ORB_Core *orb_core, 00074 int argc, 00075 char *argv[], 00076 PortableInterceptor::SlotId &slotid 00077 ACE_ENV_ARG_DECL); 00078 00079 /// Complete initialization of all registered ORBInitializers after 00080 /// the ORB has been initialized. 00081 virtual void post_init ( 00082 size_t pre_init_count, 00083 TAO_ORB_Core *orb_core, 00084 int argc, 00085 char *argv[], 00086 PortableInterceptor::SlotId slotid 00087 ACE_ENV_ARG_DECL); 00088 00089 private: 00090 // Prevent copying 00091 ORBInitializer_Registry (const ORBInitializer_Registry &); 00092 void operator= (const ORBInitializer_Registry &); 00093 00094 private: 00095 TAO_SYNCH_RECURSIVE_MUTEX lock_; 00096 00097 /// Dynamic array containing registered ORBInitializers. 00098 ACE_Array_Base<PortableInterceptor::ORBInitializer_var> initializers_; 00099 }; 00100 } 00101 00102 TAO_END_VERSIONED_NAMESPACE_DECL 00103 00104 ACE_STATIC_SVC_DECLARE (ORBInitializer_Registry) 00105 ACE_FACTORY_DECLARE (TAO_PI, ORBInitializer_Registry) 00106 00107 #include /**/ "ace/post.h" 00108 00109 #endif /* TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H */