00001 // -*- C++ -*- 00002 // 00003 // $Id: Object_Ref_Table.inl 76932 2007-02-06 16:34:57Z johnnyw $ 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 (const char * id) 00033 { 00034 return this->find (id); // Returns a duplicate. 00035 } 00036 00037 ACE_INLINE void 00038 TAO_Object_Ref_Table::destroy (void) 00039 { 00040 Table tmp; 00041 00042 ACE_GUARD (TAO_SYNCH_MUTEX, 00043 guard, 00044 this->lock_); 00045 00046 this->table_.swap (tmp); // Force release of memory held by our table. 00047 } 00048 00049 ACE_INLINE TAO_Object_Ref_Table::iterator 00050 TAO_Object_Ref_Table::begin (void) 00051 { 00052 return this->table_.begin (); 00053 } 00054 00055 ACE_INLINE TAO_Object_Ref_Table::iterator 00056 TAO_Object_Ref_Table::end (void) 00057 { 00058 return this->table_.end (); 00059 } 00060 00061 ACE_INLINE size_t 00062 TAO_Object_Ref_Table::current_size (void) const 00063 { 00064 return this->table_.size (); 00065 } 00066 00067 ACE_INLINE int 00068 TAO_Object_Ref_Table::unbind (const char *id) 00069 { 00070 return 00071 (this->table_.erase (CORBA::String_var (id)) == 0 ? -1 : 0); 00072 } 00073 00074 TAO_END_VERSIONED_NAMESPACE_DECL