ORBInitInfo.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ===================================================================
00004 /**
00005  *  @file   ORBInitInfo.h
00006  *
00007  *  ORBInitInfo.h,v 1.4 2006/03/10 07:19:12 jtc Exp
00008  *
00009  *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
00010  */
00011 // ===================================================================
00012 
00013 #ifndef TAO_ORB_INIT_INFO_H
00014 #define TAO_ORB_INIT_INFO_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/ORBInitInfoC.h"
00025 #include "tao/LocalObject.h"
00026 
00027 // This is to remove "inherits via dominance" warnings from MSVC.
00028 // MSVC is being a little too paranoid.
00029 #if defined(_MSC_VER)
00030 #pragma warning(push)
00031 #pragma warning(disable:4250)
00032 #endif /* _MSC_VER */
00033 
00034 #if defined (__BORLANDC__)
00035 #pragma option push -w-rvl -w-rch -w-ccc -w-inl
00036 #endif /* __BORLANDC__ */
00037 
00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00039 
00040 class TAO_ORB_Core;
00041 class TAO_ORBInitInfo;
00042 typedef TAO_ORBInitInfo *TAO_ORBInitInfo_ptr;
00043 
00044 typedef TAO_Objref_Var_T<TAO_ORBInitInfo>
00045                          TAO_ORBInitInfo_var;
00046 
00047 typedef TAO_Objref_Out_T<TAO_ORBInitInfo>
00048                          TAO_ORBInitInfo_out;
00049 
00050 /**
00051  * @class TAO_ORBInitInfo
00052  *
00053  * @brief An implementation of the PortableInterceptor::ORBInitInfo_3_1
00054  *        interface.
00055  *
00056  * This class encapsulates the data passed to ORBInitializers during
00057  * ORB initialization.
00058  */
00059 class TAO_PI_Export TAO_ORBInitInfo
00060   : public virtual PortableInterceptor::ORBInitInfo_3_1,
00061     public virtual TAO_Local_RefCounted_Object
00062 {
00063 public:
00064 
00065   /// Constructor.
00066   TAO_ORBInitInfo (TAO_ORB_Core *orb_core,
00067                    int argc,
00068                    char *argv[],
00069                    PortableInterceptor::SlotId slotid);
00070 
00071   /**
00072    * @name PortableInterceptor::ORBInitInfo Methods
00073    *
00074    * These methods are exported by the
00075    * PortableInterceptor::ORBInitInfo interface.
00076    */
00077   //@{
00078   /// Return the argument vector for the ORB currently being
00079   /// initialized as a string sequence.
00080   virtual CORBA::StringSeq * arguments (
00081       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00082     ACE_THROW_SPEC ((CORBA::SystemException));
00083 
00084   /// Return the ORBid for the ORB currently being initialized.
00085   virtual char * orb_id (
00086       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00087     ACE_THROW_SPEC ((CORBA::SystemException));
00088 
00089   /// Return the CodecFactory for the ORB currently being
00090   /// initialized.
00091   virtual IOP::CodecFactory_ptr codec_factory (
00092       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00093     ACE_THROW_SPEC ((CORBA::SystemException));
00094 
00095   /// Register a mapping between a string and a corresponding object
00096   /// reference with the ORB being initialized.
00097   /**
00098    * This method is particularly useful for registering references to
00099    * local (locality constrained) objects.  Note that this method
00100    * should be called in ORBInitializer::pre_init() so that the
00101    * registered reference will be available to the
00102    * resolve_initial_references() that may be called in the
00103    * ORBInitializer::post_init() call.
00104    */
00105   virtual void register_initial_reference (
00106       const char * id,
00107       CORBA::Object_ptr obj
00108       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00109     ACE_THROW_SPEC ((CORBA::SystemException,
00110                      PortableInterceptor::ORBInitInfo::InvalidName));
00111 
00112   /// Obtain a reference to an object that may not yet be available
00113   /// via the usual CORBA::ORB::resolve_initial_references() mechanism
00114   /// since the ORB may not be fully initialized yet.
00115   virtual CORBA::Object_ptr resolve_initial_references (
00116       const char * id
00117       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00118     ACE_THROW_SPEC ((CORBA::SystemException,
00119                      PortableInterceptor::ORBInitInfo::InvalidName));
00120 
00121   /// Register a client request interceptor with the ORB currently
00122   /// being initialized.
00123   virtual void add_client_request_interceptor (
00124       PortableInterceptor::ClientRequestInterceptor_ptr interceptor
00125       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00126     ACE_THROW_SPEC ((CORBA::SystemException,
00127                      PortableInterceptor::ORBInitInfo::DuplicateName));
00128 
00129   /// Register a server request interceptor with the ORB currently
00130   /// being initialized.
00131   virtual void add_server_request_interceptor (
00132       PortableInterceptor::ServerRequestInterceptor_ptr interceptor
00133       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00134     ACE_THROW_SPEC ((CORBA::SystemException,
00135                      PortableInterceptor::ORBInitInfo::DuplicateName));
00136 
00137   /// Register an IOR interceptor with the ORB currently being
00138   /// initialized.
00139   virtual void add_ior_interceptor (
00140       PortableInterceptor::IORInterceptor_ptr interceptor
00141       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00142     ACE_THROW_SPEC ((CORBA::SystemException,
00143                      PortableInterceptor::ORBInitInfo::DuplicateName));
00144 
00145   /// Register a client request interceptor with the ORB currently
00146   /// being initialized, along with a list of policies.
00147   virtual void add_client_request_interceptor_with_policy (
00148       PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
00149       const CORBA::PolicyList& policies
00150       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00151     ACE_THROW_SPEC ((CORBA::SystemException,
00152                      PortableInterceptor::ORBInitInfo::DuplicateName,
00153                      CORBA::PolicyError));
00154 
00155   /// Register a server request interceptor with the ORB currently
00156   /// being initialized, along with a list of policies.
00157   virtual void add_server_request_interceptor_with_policy (
00158       PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
00159       const CORBA::PolicyList& policies
00160       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00161     ACE_THROW_SPEC ((CORBA::SystemException,
00162                      PortableInterceptor::ORBInitInfo::DuplicateName,
00163                      CORBA::PolicyError));
00164 
00165   /// Register an IOR interceptor with the ORB currently being
00166   /// initialized, along with a list of policies.
00167   virtual void add_ior_interceptor_with_policy (
00168       PortableInterceptor::IORInterceptor_ptr interceptor,
00169       const CORBA::PolicyList& policies
00170       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00171     ACE_THROW_SPEC ((CORBA::SystemException,
00172                      PortableInterceptor::ORBInitInfo::DuplicateName,
00173                      CORBA::PolicyError));
00174 
00175   /// Reserve a slot in table found within the
00176   /// PortableInterceptor::Current object.
00177   virtual PortableInterceptor::SlotId allocate_slot_id (
00178       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00179     ACE_THROW_SPEC ((CORBA::SystemException));
00180 
00181   /// Register a policy factory of the given policy type with the ORB
00182   /// currently being initialized.
00183   virtual void register_policy_factory (
00184       CORBA::PolicyType type,
00185       PortableInterceptor::PolicyFactory_ptr policy_factory
00186       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00187     ACE_THROW_SPEC ((CORBA::SystemException));
00188 
00189   virtual CORBA::ORB_ptr _get_orb (
00190       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
00191     );
00192   //@}
00193 
00194   /**
00195    * @name TAO Extensions
00196    *
00197    * These methods are not part of the PortableInterceptor
00198    * specification, and are TAO-specific extensions.
00199    */
00200   //@{
00201   /// Allocate a slot in the ORB's TSS resources.
00202   /**
00203    * TAO uses a single TSS key for these resources, so it is useful to
00204    * place TSS objects in TAO's TSS resources on platforms where the
00205    * number of TSS keys is low.  The returned SlotId can be used to
00206    * index into the array stored in ORB's TSS resources structure.
00207    * @par
00208    * An accompanying cleanup function (e.g. a TSS destructor) can also
00209    * be registered.
00210    */
00211   size_t allocate_tss_slot_id (
00212       ACE_CLEANUP_FUNC cleanup
00213       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00214     ACE_THROW_SPEC ((CORBA::SystemException));
00215 
00216   /// Return a pointer to the ORB Core associated with the ORB being
00217   /// initialized.
00218   /**
00219    * The ORB Core is essentialy fully initialized by the time
00220    * ORBInitializer::post_init() is invoked.  As such, it is generally
00221    * best if this method is used in that method.
00222    *
00223    * @note Only use this method if you know what you are doing.
00224    */
00225   TAO_ORB_Core *orb_core (void) const;
00226 
00227   /// Invalidate this ORBInitInfo instance.
00228   /**
00229    * @note This method is only meant to be called by the
00230    *       CORBA::ORB_init() function.
00231    */
00232   void invalidate (void);
00233 
00234   /// Return the number of allocated slots in for the PICurrent
00235   /// object.
00236   PortableInterceptor::SlotId slot_count (void) const;
00237   //@}
00238 
00239   /**
00240    * @name Reference Related Methods
00241    *
00242    * TAO_ORBInitInfo-specific methods and types.
00243    */
00244   //@{
00245   typedef TAO_ORBInitInfo_ptr _ptr_type;
00246   typedef TAO_ORBInitInfo_var _var_type;
00247 
00248   static TAO_ORBInitInfo_ptr _duplicate (TAO_ORBInitInfo_ptr obj);
00249 
00250   static TAO_ORBInitInfo_ptr _narrow (
00251       CORBA::Object_ptr obj
00252       ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00253 
00254 
00255   static TAO_ORBInitInfo_ptr _unchecked_narrow (
00256       CORBA::Object_ptr obj
00257       ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00258 
00259 
00260   static TAO_ORBInitInfo_ptr _nil (void)
00261     {
00262       return (TAO_ORBInitInfo_ptr)0;
00263     }
00264   //@}
00265 
00266   virtual const char* _interface_repository_id (void) const;
00267 
00268 protected:
00269 
00270   /// Destructor is protected to enforce proper memory management
00271   /// through the reference counting mechanism.
00272   ~TAO_ORBInitInfo (void);
00273 
00274   /// Check if this ORBInitInfo instance is valid.  Once post_init()
00275   /// has been called on each of the ORBInitializers, this ORBInitInfo
00276   /// is no longer valid.  Throw an exception in that case.
00277   void check_validity (ACE_ENV_SINGLE_ARG_DECL);
00278 
00279 private:
00280 
00281   /// Prevent copying through the copy constructor and the assignment
00282   /// operator.
00283   TAO_ORBInitInfo (const TAO_ORBInitInfo &);
00284   void operator= (const TAO_ORBInitInfo &);
00285 
00286 private:
00287 
00288   /// Reference to the ORB Core.
00289   TAO_ORB_Core *orb_core_;
00290 
00291   /// The number of arguments in the argument vector passed to
00292   /// CORBA::ORB_init().
00293   int argc_;
00294 
00295   /// The argument vector passed to CORBA::ORB_init().
00296   char **argv_;
00297 
00298   /// Reference to the CodecFactory returned by
00299   /// ORBInitInfo::codec_factory().
00300   IOP::CodecFactory_var codec_factory_;
00301 
00302   /// The number of allocated slots.
00303   PortableInterceptor::SlotId slot_count_;
00304 
00305 };
00306 
00307 // Traits specializations.
00308 namespace TAO
00309 {
00310   // Hand crafted. Not forward declared, but used by PortableServer.
00311   template<>
00312   struct TAO_PI_Export Objref_Traits<TAO_ORBInitInfo>
00313   {
00314     static TAO_ORBInitInfo_ptr duplicate (
00315         TAO_ORBInitInfo_ptr
00316       );
00317     static void release (
00318         TAO_ORBInitInfo_ptr
00319       );
00320     static TAO_ORBInitInfo_ptr nil (void);
00321     static CORBA::Boolean marshal (
00322         TAO_ORBInitInfo_ptr p,
00323         TAO_OutputCDR & cdr
00324       );
00325   };
00326 }
00327 
00328 TAO_END_VERSIONED_NAMESPACE_DECL
00329 
00330 #if defined (__ACE_INLINE__)
00331 #include "tao/PI/ORBInitInfo.inl"
00332 #endif  /* __ACE_INLINE__ */
00333 
00334 #if defined(_MSC_VER)
00335 #pragma warning(pop)
00336 #endif /* _MSC_VER */
00337 
00338 #if defined (__BORLANDC__)
00339 #pragma option pop
00340 #endif /* __BORLANDC__ */
00341 
00342 #include /**/ "ace/post.h"
00343 
00344 #endif /* TAO_ORB_INIT_INFO_H */

Generated on Thu Nov 9 12:51:39 2006 for TAO_PI by doxygen 1.3.6