summaryrefslogtreecommitdiff
path: root/TAO/tao/Tagged_Profile.h
blob: 91ebca5d93d8b649974217bb21ccda8c4d8e8480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// -*- C++ -*-

//=============================================================================
/**
 *  @file   Tagged_Profile.h
 *
 *  $Id$
 *
 *  @author Bala Natarajan <bala@cs.wustl.edu>
 */
//=============================================================================

#ifndef TAO_TAGGED_PROFILE_H
#define TAO_TAGGED_PROFILE_H

#include /**/ "ace/pre.h"

#include "tao/IOPC.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/Object_KeyC.h"
#include /**/ "tao/Versioned_Namespace.h"
#include "ace/SString.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace CSD
  {
    class FW_Server_Request_Wrapper;
  }
}

/**
 * @class TAO_Tagged_Profile
 *
 * @brief This class is used to manipulate and access the target
 *        address field of a GIOP 1.2 request.
 */
class TAO_Export TAO_Tagged_Profile
{
public:

  /// Declare FW_Server_Request_Wrapper a friend
  /// This friendship makes the FW_Server_Request_Wrapper be able to
  /// clone the TAO_Tagged_Profile data member in TAO_ServerRequest.
  friend class TAO::CSD::FW_Server_Request_Wrapper;

  /// Ctor
  TAO_Tagged_Profile (TAO_ORB_Core *orb_core);

  /// Unmarshal the GIOP 1.2 target address field.
  CORBA::Boolean unmarshall_target_address (TAO_InputCDR &cdr);

  /// Unmarshals the received object key for GIOP 1.0/1.1
  CORBA::Boolean unmarshall_object_key (TAO_InputCDR &cdr);

  /// Return the object key
  TAO::ObjectKey &object_key (void);

  /// Save the object key
  void object_key (TAO::ObjectKey &object_key);

  /// Return a const object key
  const TAO::ObjectKey &object_key (void) const;

  /// Get the tagged_profile
  const IOP::TaggedProfile &tagged_profile (void) const;

  /// Get the profile index, that needs to be used in the
  /// sequnce of TaggedProfiles contained  IOP::IOR that is
  /// received from the client.
  CORBA::ULong profile_index (void) const;

  /// Accessor to the type_id contained in the IOP::IOR received from
  /// the client.
  const char* type_id (void) const;

  CORBA::Short discriminator (void) const;

private:
  /// Extract the object key from the TaggedProfile and store it in
  /// <object_key_>
  CORBA::Boolean extract_object_key (IOP::TaggedProfile &profile);

  /// Unmarshals the received object key
  CORBA::Boolean unmarshall_object_key_i (TAO_InputCDR &cdr);

  /// Unmarshall the IOP::TaggedProfile
  CORBA::Boolean unmarshall_iop_profile_i (TAO_InputCDR &cdr);

  /// Unmarshalls the GIOP::IORAddressingInfo
  CORBA::Boolean unmarshall_ref_addr_i (TAO_InputCDR &cdr);

private:
  /// Our ORB Core
  TAO_ORB_Core *orb_core_;

  /// Keep track of which kind of target profile that was extracted.
  CORBA::Short discriminator_;

  /// Flag to denote whether the object key has been extracted yet.
  CORBA::Boolean object_key_extracted_;

  /// The object key
  TAO::ObjectKey object_key_;

  /// The Tagged profile. This class would have the Tagged Profile
  IOP::TaggedProfile profile_;

  /*
   * The GIOP::IORAddressingInfo is defined as follows
   *   struct IORAddressingInfo
   *     {
   *       unsigned long selected_profile_index;
   *       IOP::IOR ior;
   *     };
   *
   * and the IOP::IOR is defined to be
   *   struct IOR
   *      {
   *        string type_id;
   *        sequence<TaggedProfile>   profiles;
   *      };
   * The mapping for the type_id of type string is TAO::String_Manager
   * which does lot of bad things like allocation on construction and
   * a deallocation on destruction. This is bad along the critical
   * path. So we will store this nested structure ripped open with the
   * profile_index and the type_id with the TaggedProfile that is
   * pointed to.
   */

  /// The profile index incase we receive a GIOP::IORAddressingInfo
  /// information
  CORBA::ULong profile_index_;

  /// The type_id in the IOP::IOR in case we receive the
  /// GIOP::IORAddressingInfo information.
  const char* type_id_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
# include "tao/Tagged_Profile.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif /*TAO_TAGGED_PROFILE_H*/