1 #include "tao/ObjectKey_Table.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/Refcounted_ObjectKey.h"
5 #if !defined (__ACE_INLINE__)
6 # include "tao/ObjectKey_Table.inl"
7 #endif /* ! __ACE_INLINE__ */
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 TAO::Less_Than_ObjectKey::operator () (const TAO::ObjectKey
&lhs
,
13 const TAO::ObjectKey
&rhs
) const
15 const CORBA::ULong rlen
= rhs
.length ();
16 const CORBA::ULong llen
= lhs
.length ();
26 const CORBA::Octet
* rhs_buff
= rhs
.get_buffer ();
27 const CORBA::Octet
* lhs_buff
= lhs
.get_buffer ();
28 const bool result
= (ACE_OS::memcmp (lhs_buff
, rhs_buff
, rlen
) < 0);
33 /********************************************************/
34 TAO::ObjectKey_Table::ObjectKey_Table ()
39 TAO::ObjectKey_Table::~ObjectKey_Table ()
41 this->table_
.close ();
45 TAO::ObjectKey_Table::destroy ()
47 if (this->table_
.current_size ())
49 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
54 TABLE::ITERATOR end_iter
= this->table_
.end ();
55 TABLE::ITERATOR start
;
57 while ((start
= this->table_
.begin ()) != end_iter
)
59 TABLE::ENTRY
&ent
= (*start
);
61 ent
.item ()->decr_refcount ();
62 this->table_
.unbind (&ent
);
70 TAO::ObjectKey_Table::bind_i (const TAO::ObjectKey
&key
,
71 TAO::Refcounted_ObjectKey
*&key_new
)
73 ACE_NEW_RETURN (key_new
,
74 TAO::Refcounted_ObjectKey (key
),
77 int const retval
= this->table_
.bind (key
, key_new
);
81 key_new
->incr_refcount ();
85 key_new
->decr_refcount ();
92 TAO::ObjectKey_Table::unbind_i (TAO::Refcounted_ObjectKey
*&key_new
)
94 TAO::Refcounted_ObjectKey
*tmp
= nullptr;
96 if (this->table_
.unbind (key_new
->object_key (), tmp
) != -1)
98 // @@ Cant do much if the unbind fails.
99 // Remove our refcount on the ObjectKey
100 (void) tmp
->decr_refcount ();
106 TAO_END_VERSIONED_NAMESPACE_DECL