00001 // -*- C++ -*- 00002 // 00003 // $Id: Object_Ref_Table.inl 83527 2008-11-03 11:25:24Z 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 CORBA::Object_ptr 00015 TAO_Object_Ref_Table::find_i (const char *id) 00016 { 00017 iterator const found = 00018 this->table_.find (CORBA::String_var (id)); 00019 00020 if (found == this->table_.end ()) 00021 return CORBA::Object::_nil (); 00022 00023 return CORBA::Object::_duplicate ((*found).second.in ()); 00024 } 00025 00026 ACE_INLINE void 00027 TAO_Object_Ref_Table::destroy (void) 00028 { 00029 Table tmp; 00030 00031 ACE_GUARD (TAO_SYNCH_MUTEX, 00032 guard, 00033 this->lock_); 00034 00035 this->table_.swap (tmp); // Force release of memory held by our table. 00036 } 00037 00038 ACE_INLINE TAO_Object_Ref_Table::iterator 00039 TAO_Object_Ref_Table::begin (void) 00040 { 00041 return this->table_.begin (); 00042 } 00043 00044 ACE_INLINE TAO_Object_Ref_Table::iterator 00045 TAO_Object_Ref_Table::end (void) 00046 { 00047 return this->table_.end (); 00048 } 00049 00050 ACE_INLINE size_t 00051 TAO_Object_Ref_Table::current_size (void) const 00052 { 00053 return this->table_.size (); 00054 } 00055 00056 ACE_INLINE int 00057 TAO_Object_Ref_Table::unbind_i (const char *id) 00058 { 00059 return 00060 (this->table_.erase (CORBA::String_var (id)) == 0 ? -1 : 0); 00061 } 00062 00063 TAO_END_VERSIONED_NAMESPACE_DECL