3 //=============================================================================
5 * @file Object_Ref_Table.h
7 * @author Ossama Othman <ossama@uci.edu>
9 //=============================================================================
12 #ifndef TAO_OBJECT_REF_TABLE_H
13 #define TAO_OBJECT_REF_TABLE_H
15 #include /**/ "ace/pre.h"
17 #include "tao/orbconf.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "tao/CORBA_String.h"
24 #include "tao/Object.h"
25 #include /**/ "tao/TAO_Export.h"
27 #include "ace/Array_Map.h"
29 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
32 * @class TAO_Object_Ref_Table
34 * @brief Keep a table de-stringified object references registered
37 * The class is necessary to allow local objects to be accessible via
38 * the resolve_initial_references() mechanism. Since local object
39 * references cannot be stringified, they cannot be placed into the
40 * initial reference map that maps object key/name to stringified
41 * object reference. Hence, another table is needed.
44 * The stringified reference table is still needed since it is
45 * sometimes necessary to delay de-stringification of an IOR until it
46 * is needed. For example, "corbaname" may return different results
49 class TAO_Export TAO_Object_Ref_Table
52 typedef ACE_Array_Map
<CORBA::String_var
,
54 TAO::String_Var_Equal_To
> Table
;
56 typedef Table::iterator iterator
;
59 TAO_Object_Ref_Table ();
62 * Register an object reference with the table, and map the given
65 * @retval -1 Duplicate id if @c rebind is false
67 int register_initial_reference (const char * id
,
68 CORBA::Object_ptr obj
,
72 * Unregister an object reference with the table
74 CORBA::Object_ptr
unregister_initial_reference (const char * id
);
76 /// Return the object reference associated with the given ID.
77 /// A duplicate is returned.
78 CORBA::Object_ptr
resolve_initial_reference (const char * id
);
80 /// Explicitly destroy the contents of the object reference table.
84 * @name Forward Iterators
91 /// Return the current size of the underlying table.
92 size_t current_size () const;
96 * @name The canonical ACE_Map methods
99 int bind_i (const char *orb_id
, CORBA::Object_ptr obj
);
100 CORBA::Object_ptr
find_i (const char *orb_id
); // Returns a duplicate.
101 int unbind_i (const char *orb_id
);
105 TAO_Object_Ref_Table (const TAO_Object_Ref_Table
&) = delete;
106 void operator= (const TAO_Object_Ref_Table
&) = delete;
107 TAO_Object_Ref_Table (TAO_Object_Ref_Table
&&) = delete;
108 void operator= (TAO_Object_Ref_Table
&&) = delete;
111 /// The implementation.
114 /// Table synchronization lock.
115 TAO_SYNCH_MUTEX lock_
;
118 TAO_END_VERSIONED_NAMESPACE_DECL
120 #ifdef __ACE_INLINE__
121 # include "tao/Object_Ref_Table.inl"
122 #endif /* __ACE_INLINE__ */
124 #include /**/ "ace/post.h"
126 #endif /* TAO_OBJECT_REF_TABLE_H */