target_specification.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    target_specification.h
00006  *
00007  *  target_specification.h,v 1.14 2006/03/10 07:19:07 jtc Exp
00008  *
00009  *  A class that encapsulates the target identification details.
00010  *
00011  *  @author  Balachandran  Natarajan <bala@cs.wustl.edu>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef TAO_TARGET_SPECIFICATION_H
00016 #define TAO_TARGET_SPECIFICATION_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "tao/TAO_Export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "tao/Basic_Types.h"
00027 
00028 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00029 # pragma once
00030 #endif /* ACE_LACKS_PRAGMA_ONCE */
00031 
00032 #if defined (HPUX) && defined (IOR)
00033    /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
00034       and we don't want that definition.  See IOP_IORC.h. */
00035 # undef IOR
00036 #endif /* HPUX && IOR */
00037 
00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00039 
00040 namespace IOP
00041 {
00042   struct IOR;
00043   struct TaggedProfile;
00044 }
00045 
00046 namespace TAO
00047 {
00048   class ObjectKey;
00049 }
00050 
00051 /**
00052  * @class TAO_Target_Specification
00053  *
00054  * @brief A class to encapsulate all the ways of specifying targets.
00055  *
00056  */
00057 class TAO_Export TAO_Target_Specification
00058 {
00059 public:
00060 
00061   /// Ctor
00062   TAO_Target_Specification (void);
00063   enum TAO_Target_Address
00064   {
00065     // Note that this could be extended for other protocols
00066     Key_Addr = 0,
00067     Profile_Addr,
00068     Reference_Addr
00069   };
00070 
00071   // Note: Please do not pass in a identifiers that is allocated on
00072   // stack. These methods does not make a copy but holds the pointer
00073   // passed in.
00074   /// Set the target specification by giving the object key.
00075   void target_specifier (const TAO::ObjectKey &key);
00076 
00077 
00078   /// Set the target specification by passing in an IOP::TaggedProfile.
00079   void target_specifier (IOP::TaggedProfile &profile);
00080 
00081   /**
00082    * Specify the target by passing in the IOP::IOR with a profile
00083    * index. Please see the header file IOPC.h on why a profile index
00084    * is required.
00085    */
00086   void target_specifier (IOP::IOR &ior,
00087                          CORBA::ULong prof_index);
00088 
00089 
00090   /**
00091    * Returns the object key after a check of the stored specifier. If
00092    * the stored specifier is not of the right type then this would
00093    * return a NULL
00094    */
00095   const TAO::ObjectKey* object_key (void);
00096 
00097   /**
00098    * Returns the IOP::TaggedProfile after a check of the stored specifier. If
00099    * the stored specifier is not of the right type then this would
00100    * return a NULL
00101    */
00102   const IOP::TaggedProfile *profile (void);
00103 
00104   /**
00105    * Returns a  pointer to IOP::IOR through the parameters and the
00106    * index of the selected profile as a return parameter after a check
00107    * of the stored specifier. If the stored specifier is not of the
00108    * right type then this would return a NULL.
00109    */
00110   CORBA::ULong iop_ior (IOP::IOR *&ior);
00111 
00112   /// Access the TArget_Address specifier
00113   TAO_Target_Address specifier (void);
00114 
00115 private:
00116   /// The union of all the possibilities
00117   union
00118   {
00119     TAO::ObjectKey *object_key_;
00120     IOP::TaggedProfile *profile_;
00121     IOP::IOR *ior_;
00122   } u_;
00123 
00124   /// The enum identifier
00125   TAO_Target_Address specifier_;
00126 
00127   /// The profile index
00128   CORBA::ULong profile_index_;
00129 };
00130 
00131 TAO_END_VERSIONED_NAMESPACE_DECL
00132 
00133 #if defined (__ACE_INLINE__)
00134 #include "tao/target_specification.i"
00135 #endif /* defined INLINE */
00136 
00137 #include /**/ "ace/post.h"
00138 
00139 #endif /*TAO_TARGET_SPECIFICATION_H*/

Generated on Thu Nov 9 11:54:24 2006 for TAO by doxygen 1.3.6