1 #include "tao/Object_Ref_Table.h"
4 #include "tao/ORB_Constants.h"
5 #include "tao/SystemException.h"
6 #include "ace/OS_NS_string.h"
7 #include "ace/Log_Msg.h"
10 #ifndef __ACE_INLINE__
11 # include "tao/Object_Ref_Table.inl"
12 #endif /* __ACE_INLINE__ */
14 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
17 TAO_Object_Ref_Table::register_initial_reference (
19 CORBA::Object_ptr obj
,
22 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
29 if (this->unbind_i (id
) == -1)
32 return this->bind_i (id
, obj
);
35 return this->bind_i (id
, obj
);
39 TAO_Object_Ref_Table::unregister_initial_reference (
42 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
45 CORBA::Object::_nil());
47 CORBA::Object_ptr obj
= this->find_i (id
);
48 if (this->unbind_i (id
) == -1)
50 if (TAO_debug_level
> 1)
52 TAOLIB_ERROR ((LM_ERROR
,
53 ACE_TEXT ("(%P|%t) Object_Ref_Table::bind_i: ")
54 ACE_TEXT ("Could not unregister object <%C> ")
55 ACE_TEXT ("from the ORB\n"),
64 TAO_Object_Ref_Table::bind_i (const char *id
, CORBA::Object_ptr obj
)
66 // Make sure that the supplied Object reference is valid,
69 || std::strlen (id
) == 0
70 || ::CORBA::is_nil (obj
))
76 Table::value_type
const value
=
77 std::make_pair (CORBA::String_var (id
),
78 CORBA::Object_var (CORBA::Object::_duplicate (obj
)));
80 std::pair
<iterator
, bool> const result
= this->table_
.insert (value
);
84 if (TAO_debug_level
> 1)
86 TAOLIB_ERROR ((LM_ERROR
,
87 ACE_TEXT ("(%P|%t) Object_Ref_Table::bind_i: ")
88 ACE_TEXT ("Could not register duplicate object <%C> ")
89 ACE_TEXT ("with the ORB\n"),
100 TAO_Object_Ref_Table::resolve_initial_reference (const char * id
)
102 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
105 CORBA::Object::_nil ());
107 return this->find_i (id
); // Returns a duplicate.
110 TAO_END_VERSIONED_NAMESPACE_DECL