target_specification.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    target_specification.h
00006  *
00007  *  $Id: target_specification.h 76593 2007-01-25 19:19:27Z johnnyw $
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, CORBA::ULong prof_index);
00087 
00088   /**
00089    * Returns the object key after a check of the stored specifier. If
00090    * the stored specifier is not of the right type then this would
00091    * return a NULL
00092    */
00093   const TAO::ObjectKey* object_key (void);
00094 
00095   /**
00096    * Returns the IOP::TaggedProfile after a check of the stored specifier. If
00097    * the stored specifier is not of the right type then this would
00098    * return a NULL
00099    */
00100   const IOP::TaggedProfile *profile (void);
00101 
00102   /**
00103    * Returns a  pointer to IOP::IOR through the parameters and the
00104    * index of the selected profile as a return parameter after a check
00105    * of the stored specifier. If the stored specifier is not of the
00106    * right type then this would return a NULL.
00107    */
00108   CORBA::ULong iop_ior (IOP::IOR *&ior);
00109 
00110   /// Access the TArget_Address specifier
00111   TAO_Target_Address specifier (void);
00112 
00113 private:
00114   /// The union of all the possibilities
00115   union
00116   {
00117     TAO::ObjectKey *object_key_;
00118     IOP::TaggedProfile *profile_;
00119     IOP::IOR *ior_;
00120   } u_;
00121 
00122   /// The enum identifier
00123   TAO_Target_Address specifier_;
00124 
00125   /// The profile index
00126   CORBA::ULong profile_index_;
00127 };
00128 
00129 TAO_END_VERSIONED_NAMESPACE_DECL
00130 
00131 #if defined (__ACE_INLINE__)
00132 #include "tao/target_specification.inl"
00133 #endif /* defined INLINE */
00134 
00135 #include /**/ "ace/post.h"
00136 
00137 #endif /*TAO_TARGET_SPECIFICATION_H*/

Generated on Sun Jan 27 13:07:37 2008 for TAO by doxygen 1.3.6