00001 // -*- C++ -*- 00002 // 00003 // Object_Ref_Table.inl,v 1.7 2006/03/31 21:44:24 schmidt Exp 00004 00005 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 TAO_Object_Ref_Table::TAO_Object_Ref_Table (void) 00009 : table_ (TAO_DEFAULT_OBJECT_REF_TABLE_SIZE) 00010 , lock_ () 00011 { 00012 } 00013 00014 ACE_INLINE int 00015 TAO_Object_Ref_Table::register_initial_reference ( 00016 const char *id, 00017 CORBA::Object_ptr obj, 00018 bool rebind) 00019 { 00020 if (rebind) 00021 { 00022 if (this->unbind (id) == -1) 00023 return -1; 00024 else 00025 return this->bind (id, obj); 00026 } 00027 else 00028 return this->bind (id, obj); 00029 } 00030 00031 ACE_INLINE CORBA::Object_ptr 00032 TAO_Object_Ref_Table::resolve_initial_reference ( 00033 const char * id) 00034 { 00035 return this->find (id); // Returns a duplicate. 00036 } 00037 00038 ACE_INLINE void 00039 TAO_Object_Ref_Table::destroy (void) 00040 { 00041 Table tmp; 00042 00043 ACE_GUARD (TAO_SYNCH_MUTEX, 00044 guard, 00045 this->lock_); 00046 00047 this->table_.swap (tmp); // Force release of memory held by our table. 00048 } 00049 00050 ACE_INLINE TAO_Object_Ref_Table::iterator 00051 TAO_Object_Ref_Table::begin (void) 00052 { 00053 return this->table_.begin (); 00054 } 00055 00056 ACE_INLINE TAO_Object_Ref_Table::iterator 00057 TAO_Object_Ref_Table::end (void) 00058 { 00059 return this->table_.end (); 00060 } 00061 00062 ACE_INLINE size_t 00063 TAO_Object_Ref_Table::current_size (void) const 00064 { 00065 return this->table_.size (); 00066 } 00067 00068 ACE_INLINE int 00069 TAO_Object_Ref_Table::unbind (const char *id) 00070 { 00071 return 00072 (this->table_.erase (CORBA::String_var (id)) == 0 ? -1 : 0); 00073 } 00074 00075 TAO_END_VERSIONED_NAMESPACE_DECL