#include <Object_Ref_Table.h>
Collaboration diagram for TAO_Object_Ref_Table:

Public Types | |
| typedef ACE_Array_Map< CORBA::String_var, CORBA::Object_var, TAO::String_Var_Equal_To > | Table |
| typedef Table::iterator | iterator |
Public Member Functions | |
| TAO_Object_Ref_Table (void) | |
| Constructor. | |
| int | register_initial_reference (const char *id, CORBA::Object_ptr obj, bool rebind=false) |
| CORBA::Object_ptr | resolve_initial_reference (const char *id) |
| void | destroy (void) |
| Explicitly destroy the contents of the object reference table. | |
| size_t | current_size (void) const |
| Return the current size of the underlying table. | |
Forward Iterators | |
| iterator | begin (void) |
| iterator | end (void) |
Private Member Functions | |
| TAO_Object_Ref_Table (const TAO_Object_Ref_Table &) | |
| void | operator= (const TAO_Object_Ref_Table &) |
The canonical ACE_Map methods | |
| int | bind (const char *orb_id, CORBA::Object_ptr obj) |
| CORBA::Object_ptr | find (const char *orb_id) |
| int | unbind (const char *orb_id) |
Private Attributes | |
| Table | table_ |
| The implementation. | |
| TAO_SYNCH_MUTEX | lock_ |
| Table synchronization lock. | |
The class is necessary to allow local objects to be accessible via the resolve_initial_references() mechanism. Since local object references cannot be stringified, they cannot be placed into the initial reference map that maps object key/name to stringified object reference. Hence, another table is needed.
Definition at line 56 of file Object_Ref_Table.h.
|
|
Definition at line 64 of file Object_Ref_Table.h. |
|
|
Definition at line 62 of file Object_Ref_Table.h. Referenced by destroy(). |
|
|
Constructor.
Definition at line 8 of file Object_Ref_Table.inl. References TAO_DEFAULT_OBJECT_REF_TABLE_SIZE.
|
|
|
|
|
|
Definition at line 51 of file Object_Ref_Table.inl. References ACE_Array_Map< Key, Value, EqualTo >::begin(). Referenced by TAO_ORB_Core::list_initial_references().
|
|
||||||||||||
|
Definition at line 27 of file Object_Ref_Table.cpp. References ACE_ERROR, ACE_GUARD_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_Array_Map< Key, Value, EqualTo >::insert(), LM_ERROR, CORBA::Object_ptr, CORBA::Object_var, CORBA::String_var, ACE_OS::strlen(), TAO_debug_level, and TAO_SYNCH_MUTEX. Referenced by register_initial_reference().
00029 {
00030 // Make sure that the supplied Object reference is valid,
00031 // i.e. not nil.
00032 if (id == 0
00033 || ACE_OS::strlen (id) == 0
00034 || ::CORBA::is_nil (obj))
00035 {
00036 errno = EINVAL;
00037 return -1;
00038 };
00039
00040 Table::value_type const value =
00041 std::make_pair (CORBA::String_var (id),
00042 CORBA::Object_var (CORBA::Object::_duplicate (obj)));
00043
00044 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00045 guard,
00046 this->lock_,
00047 -1);
00048
00049 std::pair<iterator, bool> const result = this->table_.insert (value);
00050
00051 if (!result.second)
00052 {
00053 if (TAO_debug_level > 1)
00054 {
00055 ACE_ERROR ((LM_ERROR,
00056 ACE_TEXT ("(%P|%t) Object_Ref_Table::")
00057 ACE_TEXT ("bind:")
00058 ACE_TEXT (" Could not register duplicate object <%s> ")
00059 ACE_TEXT ("with the ORB\n"),
00060 ACE_TEXT_CHAR_TO_TCHAR (id)));
00061 }
00062
00063 return -1;
00064 }
00065
00066 return 0;
00067 }
|
|
|
Return the current size of the underlying table.
Definition at line 63 of file Object_Ref_Table.inl. References ACE_Array_Map< Key, Value, EqualTo >::size(). Referenced by TAO_ORB_Core::list_initial_references().
|
|
|
Explicitly destroy the contents of the object reference table.
Definition at line 39 of file Object_Ref_Table.inl. References ACE_GUARD, ACE_Array_Map< Key, Value, EqualTo >::swap(), Table, and TAO_SYNCH_MUTEX. Referenced by TAO_ORB_Core::shutdown().
|
|
|
Definition at line 57 of file Object_Ref_Table.inl. References ACE_Array_Map< Key, Value, EqualTo >::end(). Referenced by TAO_ORB_Core::list_initial_references().
|
|
|
Definition at line 70 of file Object_Ref_Table.cpp. References CORBA::Object::_duplicate(), CORBA::Object::_nil(), ACE_GUARD_RETURN, ACE_Array_Map< Key, Value, EqualTo >::end(), ACE_Array_Map< Key, Value, EqualTo >::find(), CORBA::String_var, and TAO_SYNCH_MUTEX. Referenced by resolve_initial_reference().
00071 {
00072 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00073 guard,
00074 this->lock_,
00075 CORBA::Object::_nil ());
00076
00077 iterator const found =
00078 this->table_.find (CORBA::String_var (id));
00079
00080 if (found == this->table_.end ())
00081 return CORBA::Object::_nil ();
00082
00083 return CORBA::Object::_duplicate ((*found).second.in ());
00084 }
|
|
|
|
|
||||||||||||||||
|
Register an object reference with the table, and map the given ID to it.
Definition at line 15 of file Object_Ref_Table.inl. References bind(), CORBA::Object_ptr, and unbind(). Referenced by CORBA::ORB::register_initial_reference().
|
|
|
Return the object reference associated with the given ID. A duplicate is returned. Definition at line 32 of file Object_Ref_Table.inl. References find(). Referenced by CORBA::ORB::resolve_initial_references(), and TAO_ORB_Core::resolve_rt_orb().
00034 {
00035 return this->find (id); // Returns a duplicate.
00036 }
|
|
|
Definition at line 69 of file Object_Ref_Table.inl. References ACE_Array_Map< Key, Value, EqualTo >::erase(), and CORBA::String_var. Referenced by register_initial_reference().
00070 {
00071 return
00072 (this->table_.erase (CORBA::String_var (id)) == 0 ? -1 : 0);
00073 }
|
|
|
Table synchronization lock.
Definition at line 120 of file Object_Ref_Table.h. |
|
|
The implementation.
Definition at line 117 of file Object_Ref_Table.h. |
1.3.6