summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming/Entries.cpp
blob: 32020a57daa21aec6ffbfbb567b66b4876a28ec6 (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
//=============================================================================
/**
 *  @file    Entries.cpp
 *
 *  @author Marina Spivak <marina@cs.wustl.edu>
 */
//=============================================================================

#include "orbsvcs/Naming/Entries.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO_IntId::TAO_IntId ()
  : type_ (CosNaming::nobject)
{
  ref_ = CORBA::Object::_nil ();
}

TAO_IntId::TAO_IntId (CORBA::Object_ptr obj,
                      CosNaming::BindingType type)
  : type_ (type)
{
  ref_ = CORBA::Object::_duplicate (obj);
}

TAO_IntId::TAO_IntId (const TAO_IntId &rhs)
{
  type_ = rhs.type_;
  ref_ = CORBA::Object::_duplicate (rhs.ref_);
}

TAO_IntId::~TAO_IntId ()
{
  CORBA::release (ref_);
}

void
TAO_IntId::operator= (const TAO_IntId &rhs)
{
  // check for self assignment.
  if (&rhs == this)
    return;

  type_ = rhs.type_;

  CORBA::release (ref_);
  ref_ = CORBA::Object::_duplicate (rhs.ref_);
}

TAO_ExtId::TAO_ExtId ()
  : kind_ (),
    id_ ()
{
}

TAO_ExtId::TAO_ExtId (const char *id,
                    const char *kind)
  : kind_ (kind),
    id_ (id)
{
}

TAO_ExtId::TAO_ExtId (const TAO_ExtId &rhs)
{
  id_ = rhs.id_;
  kind_ = rhs.kind_;
}

TAO_ExtId::~TAO_ExtId ()
{
}

const char *
TAO_ExtId::id ()
{
  return id_.fast_rep ();
}

const char *
TAO_ExtId::kind ()
{
  return kind_.fast_rep ();
}

void
TAO_ExtId::operator= (const TAO_ExtId &rhs)
{
  // Check for self assignment.
  if (&rhs == this)
    return;

  id_ = rhs.id_;
  kind_ = rhs.kind_;
}

bool
TAO_ExtId::operator== (const TAO_ExtId &rhs) const
{
  return id_ == rhs.id_ && kind_ == rhs.kind_;
}

bool
TAO_ExtId::operator!= (const TAO_ExtId &rhs) const
{
  return id_ != rhs.id_ || kind_ != rhs.kind_;
}

u_long
TAO_ExtId::hash () const
{
  ACE_CString temp (id_);
  temp += kind_;

  return temp.hash ();
}

TAO_END_VERSIONED_NAMESPACE_DECL