3 // ===================================================================
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
9 // ===================================================================
11 #ifndef TAO_ORB_INIT_INFO_H
12 #define TAO_ORB_INIT_INFO_H
14 #include /**/ "ace/pre.h"
16 #include "tao/PI/pi_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/PI/PI_includeC.h"
23 #include "tao/LocalObject.h"
25 // This is to remove "inherits via dominance" warnings from MSVC.
26 // MSVC is being a little too paranoid.
29 #pragma warning(disable:4250)
32 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
35 class TAO_ORBInitInfo
;
36 typedef TAO_ORBInitInfo
*TAO_ORBInitInfo_ptr
;
38 typedef TAO_Objref_Var_T
<TAO_ORBInitInfo
>
41 typedef TAO_Objref_Out_T
<TAO_ORBInitInfo
>
45 * @class TAO_ORBInitInfo
47 * @brief An implementation of the PortableInterceptor::ORBInitInfo_3_1
50 * This class encapsulates the data passed to ORBInitializers during
53 class TAO_PI_Export TAO_ORBInitInfo
54 : public virtual PortableInterceptor::ORBInitInfo_3_1
,
55 public virtual ::CORBA::LocalObject
59 TAO_ORBInitInfo (TAO_ORB_Core
*orb_core
,
62 PortableInterceptor::SlotId slotid
);
65 * @name PortableInterceptor::ORBInitInfo Methods
67 * These methods are exported by the
68 * PortableInterceptor::ORBInitInfo interface.
71 /// Return the argument vector for the ORB currently being
72 /// initialized as a string sequence.
73 virtual CORBA::StringSeq
* arguments ();
75 /// Return the ORBid for the ORB currently being initialized.
76 virtual char * orb_id ();
78 /// Return the CodecFactory for the ORB currently being
80 virtual IOP::CodecFactory_ptr
codec_factory ();
82 /// Register a mapping between a string and a corresponding object
83 /// reference with the ORB being initialized.
85 * This method is particularly useful for registering references to
86 * local (locality constrained) objects. Note that this method
87 * should be called in ORBInitializer::pre_init() so that the
88 * registered reference will be available to the
89 * resolve_initial_references() that may be called in the
90 * ORBInitializer::post_init() call.
92 virtual void register_initial_reference (const char * id
, CORBA::Object_ptr obj
);
94 /// Obtain a reference to an object that may not yet be available
95 /// via the usual CORBA::ORB::resolve_initial_references() mechanism
96 /// since the ORB may not be fully initialized yet.
97 virtual CORBA::Object_ptr
resolve_initial_references (const char * id
);
99 /// Register a client request interceptor with the ORB currently
100 /// being initialized.
101 virtual void add_client_request_interceptor (
102 PortableInterceptor::ClientRequestInterceptor_ptr interceptor
);
104 /// Register a server request interceptor with the ORB currently
105 /// being initialized.
106 virtual void add_server_request_interceptor (
107 PortableInterceptor::ServerRequestInterceptor_ptr interceptor
);
109 /// Register an IOR interceptor with the ORB currently being
111 virtual void add_ior_interceptor (
112 PortableInterceptor::IORInterceptor_ptr interceptor
);
114 /// Register a client request interceptor with the ORB currently
115 /// being initialized, along with a list of policies.
116 virtual void add_client_request_interceptor_with_policy (
117 PortableInterceptor::ClientRequestInterceptor_ptr interceptor
,
118 const CORBA::PolicyList
& policies
);
120 /// Register a server request interceptor with the ORB currently
121 /// being initialized, along with a list of policies.
122 virtual void add_server_request_interceptor_with_policy (
123 PortableInterceptor::ServerRequestInterceptor_ptr interceptor
,
124 const CORBA::PolicyList
& policies
);
126 /// Register an IOR interceptor with the ORB currently being
127 /// initialized, along with a list of policies.
128 virtual void add_ior_interceptor_with_policy (
129 PortableInterceptor::IORInterceptor_ptr interceptor
,
130 const CORBA::PolicyList
& policies
);
132 /// Reserve a slot in table found within the
133 /// PortableInterceptor::Current object.
134 virtual PortableInterceptor::SlotId
allocate_slot_id ();
136 /// Register a policy factory of the given policy type with the ORB
137 /// currently being initialized.
138 virtual void register_policy_factory (
139 CORBA::PolicyType type
,
140 PortableInterceptor::PolicyFactory_ptr policy_factory
);
142 virtual CORBA::ORB_ptr
_get_orb ();
146 * @name TAO Extensions
148 * These methods are not part of the PortableInterceptor
149 * specification, and are TAO-specific extensions.
152 /// Allocate a slot in the ORB's TSS resources.
154 * TAO uses a single TSS key for these resources, so it is useful to
155 * place TSS objects in TAO's TSS resources on platforms where the
156 * number of TSS keys is low. The returned SlotId can be used to
157 * index into the array stored in ORB's TSS resources structure.
159 * An accompanying cleanup function (e.g. a TSS destructor) can also
162 size_t allocate_tss_slot_id (ACE_CLEANUP_FUNC cleanup
);
164 /// Return a pointer to the ORB Core associated with the ORB being
167 * The ORB Core is essentialy fully initialized by the time
168 * ORBInitializer::post_init() is invoked. As such, it is generally
169 * best if this method is used in that method.
171 * @note Only use this method if you know what you are doing.
173 TAO_ORB_Core
*orb_core () const;
175 /// Invalidate this ORBInitInfo instance.
177 * @note This method is only meant to be called by the
178 * CORBA::ORB_init() function.
182 /// Return the number of allocated slots in for the PICurrent
184 PortableInterceptor::SlotId
slot_count () const;
188 * @name Reference Related Methods
190 * TAO_ORBInitInfo-specific methods and types.
193 typedef TAO_ORBInitInfo_ptr _ptr_type
;
194 typedef TAO_ORBInitInfo_var _var_type
;
196 static TAO_ORBInitInfo_ptr
_duplicate (TAO_ORBInitInfo_ptr obj
);
198 static TAO_ORBInitInfo_ptr
_narrow (CORBA::Object_ptr obj
);
201 static TAO_ORBInitInfo_ptr
_unchecked_narrow (CORBA::Object_ptr obj
);
204 static TAO_ORBInitInfo_ptr
_nil ()
210 virtual const char* _interface_repository_id () const;
213 /// Destructor is protected to enforce proper memory management
214 /// through the reference counting mechanism.
217 /// Check if this ORBInitInfo instance is valid. Once post_init()
218 /// has been called on each of the ORBInitializers, this ORBInitInfo
219 /// is no longer valid. Throw an exception in that case.
220 void check_validity ();
223 TAO_ORBInitInfo (const TAO_ORBInitInfo
&) = delete;
224 void operator= (const TAO_ORBInitInfo
&) = delete;
227 /// Reference to the ORB Core.
228 TAO_ORB_Core
*orb_core_
;
230 /// The number of arguments in the argument vector passed to
231 /// CORBA::ORB_init().
234 /// The argument vector passed to CORBA::ORB_init().
237 /// Reference to the CodecFactory returned by
238 /// ORBInitInfo::codec_factory().
239 IOP::CodecFactory_var codec_factory_
;
241 /// The number of allocated slots.
242 PortableInterceptor::SlotId slot_count_
;
245 // Traits specializations.
248 // Hand crafted. Not forward declared, but used by PortableServer.
250 struct TAO_PI_Export Objref_Traits
<TAO_ORBInitInfo
>
252 static TAO_ORBInitInfo_ptr
duplicate (TAO_ORBInitInfo_ptr
);
253 static void release (TAO_ORBInitInfo_ptr
);
254 static TAO_ORBInitInfo_ptr
nil ();
255 static CORBA::Boolean
marshal (TAO_ORBInitInfo_ptr p
, TAO_OutputCDR
& cdr
);
259 TAO_END_VERSIONED_NAMESPACE_DECL
261 #if defined (__ACE_INLINE__)
262 #include "tao/PI/ORBInitInfo.inl"
263 #endif /* __ACE_INLINE__ */
265 #if defined(_MSC_VER)
267 #endif /* _MSC_VER */
269 #include /**/ "ace/post.h"
271 #endif /* TAO_ORB_INIT_INFO_H */