Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / target_specification.h
blobcc2b43ce9bdc42361716de2d6014b33fcffc2b37
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file target_specification.h
7 * A class that encapsulates the target identification details.
9 * @author Balachandran Natarajan <bala@cs.wustl.edu>
11 //=============================================================================
13 #ifndef TAO_TARGET_SPECIFICATION_H
14 #define TAO_TARGET_SPECIFICATION_H
16 #include /**/ "ace/pre.h"
18 #include /**/ "tao/TAO_Export.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/Basic_Types.h"
26 #if !defined (ACE_LACKS_PRAGMA_ONCE)
27 # pragma once
28 #endif /* ACE_LACKS_PRAGMA_ONCE */
30 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
32 namespace IOP
34 struct IOR;
35 struct TaggedProfile;
38 namespace TAO
40 class ObjectKey;
43 /**
44 * @class TAO_Target_Specification
46 * @brief A class to encapsulate all the ways of specifying targets.
48 class TAO_Export TAO_Target_Specification
50 public:
51 /// Ctor
52 TAO_Target_Specification ();
53 enum TAO_Target_Address
55 // Note that this could be extended for other protocols
56 Key_Addr = 0,
57 Profile_Addr,
58 Reference_Addr
61 /// Set the target specification by giving the object key.
62 /// @note Please do not pass in a identifiers that is allocated on
63 /// stack. These methods does not make a copy but holds the pointer
64 /// passed in.
65 void target_specifier (const TAO::ObjectKey &key);
67 /// Set the target specification by passing in an IOP::TaggedProfile.
68 void target_specifier (IOP::TaggedProfile &profile);
70 /**
71 * Specify the target by passing in the IOP::IOR with a profile
72 * index. Please see the header file IOPC.h on why a profile index
73 * is required.
75 void target_specifier (IOP::IOR &ior, CORBA::ULong prof_index);
77 /**
78 * Returns the object key after a check of the stored specifier. If
79 * the stored specifier is not of the right type then this would
80 * return a NULL
82 const TAO::ObjectKey* object_key ();
84 /**
85 * Returns the IOP::TaggedProfile after a check of the stored specifier. If
86 * the stored specifier is not of the right type then this would
87 * return a NULL
89 const IOP::TaggedProfile *profile ();
91 /**
92 * Returns a pointer to IOP::IOR through the parameters and the
93 * index of the selected profile as a return parameter after a check
94 * of the stored specifier. If the stored specifier is not of the
95 * right type then this would return a NULL.
97 CORBA::ULong iop_ior (IOP::IOR *&ior);
99 /// Access the TArget_Address specifier
100 TAO_Target_Address specifier ();
102 private:
103 /// The union of all the possibilities
104 union
106 TAO::ObjectKey *object_key_;
107 IOP::TaggedProfile *profile_;
108 IOP::IOR *ior_;
109 } u_;
111 /// The enum identifier
112 TAO_Target_Address specifier_;
114 /// The profile index
115 CORBA::ULong profile_index_;
118 TAO_END_VERSIONED_NAMESPACE_DECL
120 #if defined (__ACE_INLINE__)
121 #include "tao/target_specification.inl"
122 #endif /* defined INLINE */
124 #include /**/ "ace/post.h"
126 #endif /*TAO_TARGET_SPECIFICATION_H*/