#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 51 of file Object_Ref_Table.h.
|
|
Definition at line 59 of file Object_Ref_Table.h. |
|
|
Definition at line 57 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 50 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 26 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().
00027 {
00028 // Make sure that the supplied Object reference is valid,
00029 // i.e. not nil.
00030 if (id == 0
00031 || ACE_OS::strlen (id) == 0
00032 || ::CORBA::is_nil (obj))
00033 {
00034 errno = EINVAL;
00035 return -1;
00036 };
00037
00038 Table::value_type const value =
00039 std::make_pair (CORBA::String_var (id),
00040 CORBA::Object_var (CORBA::Object::_duplicate (obj)));
00041
00042 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00043 guard,
00044 this->lock_,
00045 -1);
00046
00047 std::pair<iterator, bool> const result = this->table_.insert (value);
00048
00049 if (!result.second)
00050 {
00051 if (TAO_debug_level > 1)
00052 {
00053 ACE_ERROR ((LM_ERROR,
00054 ACE_TEXT ("(%P|%t) Object_Ref_Table::")
00055 ACE_TEXT ("bind:")
00056 ACE_TEXT (" Could not register duplicate object <%s> ")
00057 ACE_TEXT ("with the ORB\n"),
00058 ACE_TEXT_CHAR_TO_TCHAR (id)));
00059 }
00060
00061 return -1;
00062 }
00063
00064 return 0;
00065 }
|
|
|
Return the current size of the underlying table.
Definition at line 62 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 38 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 56 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 68 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().
00069 {
00070 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00071 guard,
00072 this->lock_,
00073 CORBA::Object::_nil ());
00074
00075 iterator const found =
00076 this->table_.find (CORBA::String_var (id));
00077
00078 if (found == this->table_.end ())
00079 return CORBA::Object::_nil ();
00080
00081 return CORBA::Object::_duplicate ((*found).second.in ());
00082 }
|
|
|
|
|
||||||||||||||||
|
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().
00033 {
00034 return this->find (id); // Returns a duplicate.
00035 }
|
|
|
Definition at line 68 of file Object_Ref_Table.inl. References ACE_Array_Map< Key, Value, EqualTo >::erase(), and CORBA::String_var. Referenced by register_initial_reference().
00069 {
00070 return
00071 (this->table_.erase (CORBA::String_var (id)) == 0 ? -1 : 0);
00072 }
|
|
|
Table synchronization lock.
Definition at line 115 of file Object_Ref_Table.h. |
|
|
The implementation.
Definition at line 112 of file Object_Ref_Table.h. |
1.3.6