summaryrefslogtreecommitdiff
path: root/TAO/tao/target_specification.inl
blob: dd1265bf0df0d8db61c68d98fbe2baae4d1f34f6 (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
// -*- C++ -*-
//
//$Id$

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE
TAO_Target_Specification::TAO_Target_Specification (void)
  :specifier_ (TAO_Target_Specification::Key_Addr),
   profile_index_ (0)
{
  //no-op
}

ACE_INLINE void
TAO_Target_Specification::target_specifier (const TAO::ObjectKey &key)
{
  this->specifier_ = TAO_Target_Specification::Key_Addr;
  // @@ Bala: this is a good recipe for a crash, if the <key> was on
  //    the stack or is otherwise destroyed then you are in big
  //    trouble.
  // @@ Carlos: As suggested by you I have documented that in the
  //    headerfile.
  // @@ Bala: beware, documentation is good, code that works in
  // general is better....  but you are probably right in this case, i
  // suspect this stuff goes right in the critical path, right? So
  // making a copy of the object key would be too expensive..
  this->u_.object_key_ = const_cast<TAO::ObjectKey *> (&key);
}

ACE_INLINE void
TAO_Target_Specification::target_specifier (IOP::TaggedProfile &profile)

{
  this->specifier_ = TAO_Target_Specification::Profile_Addr;
  this->u_.profile_ = const_cast<IOP::TaggedProfile *> (&profile);

}

ACE_INLINE void
TAO_Target_Specification::target_specifier (IOP::IOR &ior,
                                            CORBA::ULong prof_index)
{
  this->specifier_ = TAO_Target_Specification::Reference_Addr;
  this->u_.ior_ = const_cast<IOP::IOR *> (&ior);
  this->profile_index_ = prof_index;

}

ACE_INLINE const TAO::ObjectKey*
TAO_Target_Specification::object_key (void)
{
  if (this->specifier_ == TAO_Target_Specification::Key_Addr)
    return this->u_.object_key_;

  return 0;
}

ACE_INLINE const IOP::TaggedProfile *
TAO_Target_Specification::profile (void)
{
  if (this->specifier_ == TAO_Target_Specification::Profile_Addr)
    return this->u_.profile_;

  return 0;
}

ACE_INLINE CORBA::ULong
TAO_Target_Specification::iop_ior (IOP::IOR *& ior)
{
  if (this->specifier_ == TAO_Target_Specification::Reference_Addr)
    {
      ior = this->u_.ior_;
      return this->profile_index_;
    }

  ior = 0;
  return 0;
}

ACE_INLINE TAO_Target_Specification::TAO_Target_Address
TAO_Target_Specification::specifier (void)
{
  return this->specifier_;
}

TAO_END_VERSIONED_NAMESPACE_DECL