/* -*- C++ -*- */ // $Id$ # if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) template ACE_INLINE ACE_Map_Entry::~ACE_Map_Entry (void) { // No-op just to keep some compilers happy... } #endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ template ACE_INLINE size_t ACE_Map_Entry::next (void) const { return this->next_; } template ACE_INLINE void ACE_Map_Entry::next (size_t n) { this->next_ = n; } template ACE_INLINE size_t ACE_Map_Entry::prev (void) const { return this->prev_; } template ACE_INLINE void ACE_Map_Entry::prev (size_t p) { this->prev_ = p; } template ACE_INLINE ACE_Map_Manager::ACE_Map_Manager (size_t size, ACE_Allocator *alloc) : allocator_ (0), search_structure_ (0), total_size_ (0), cur_size_ (0) { if (this->open (size, alloc) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Map_Manager\n"))); } template ACE_INLINE ACE_Map_Manager::ACE_Map_Manager (ACE_Allocator *alloc) : allocator_ (0), search_structure_ (0), total_size_ (0), cur_size_ (0) { if (this->open (ACE_DEFAULT_MAP_SIZE, alloc) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Map_Manager\n"))); } template ACE_INLINE int ACE_Map_Manager::close (void) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->close_i (); } template ACE_INLINE ACE_Map_Manager::~ACE_Map_Manager (void) { this->close (); } template ACE_INLINE int ACE_Map_Manager::bind (const EXT_ID &ext_id, const INT_ID &int_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->bind_i (ext_id, int_id); } template ACE_INLINE int ACE_Map_Manager::rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); } template ACE_INLINE int ACE_Map_Manager::rebind (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id, old_int_id); } template ACE_INLINE int ACE_Map_Manager::rebind (const EXT_ID &ext_id, const INT_ID &int_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->rebind_i (ext_id, int_id); } template ACE_INLINE int ACE_Map_Manager::trybind (const EXT_ID &ext_id, INT_ID &int_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->trybind_i (ext_id, int_id); } template ACE_INLINE int ACE_Map_Manager::find (const EXT_ID &ext_id) { ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); size_t slot = 0; return this->find_and_return_index (ext_id, slot); } template ACE_INLINE int ACE_Map_Manager::find (const EXT_ID &ext_id, INT_ID &int_id) { ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->find_i (ext_id, int_id); } template ACE_INLINE int ACE_Map_Manager::unbind_i (const EXT_ID &ext_id) { // Unbind the entry. size_t slot = 0; return this->unbind_and_return_index (ext_id, slot); } template ACE_INLINE int ACE_Map_Manager::unbind (const EXT_ID &ext_id, INT_ID &int_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id, int_id); } template ACE_INLINE int ACE_Map_Manager::unbind (const EXT_ID &ext_id) { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->unbind_i (ext_id); } template ACE_INLINE size_t ACE_Map_Manager::current_size (void) const { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, ACE_const_cast (ACE_LOCK &, this->lock_), ACE_static_cast (size_t, -1)); return this->cur_size_; } template ACE_INLINE size_t ACE_Map_Manager::total_size (void) const { ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, ACE_const_cast (ACE_LOCK &, this->lock_), ACE_static_cast (size_t, -1)); return this->total_size_; } template ACE_INLINE ACE_LOCK & ACE_Map_Manager::mutex (void) { return this->lock_; } template ACE_INLINE void ACE_Map_Manager::move_from_free_list_to_occupied_list (size_t slot) { this->shared_move (slot, this->free_list_, this->free_list_id (), this->occupied_list_, this->occupied_list_id ()); } template ACE_INLINE void ACE_Map_Manager::move_from_occupied_list_to_free_list (size_t slot) { this->shared_move (slot, this->occupied_list_, this->occupied_list_id (), this->free_list_, this->free_list_id ()); } template ACE_INLINE int ACE_Map_Manager::equal (const EXT_ID &id1, const EXT_ID &id2) { return id1 == id2; } template ACE_INLINE size_t ACE_Map_Manager::free_list_id (void) const { // If you change ~0, please change // ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key() // accordingly. return ~0; } template ACE_INLINE size_t ACE_Map_Manager::occupied_list_id (void) const { return ~1; } template ACE_INLINE ACE_Map_Iterator ACE_Map_Manager::begin (void) { return ACE_Map_Iterator (*this); } template ACE_INLINE ACE_Map_Iterator ACE_Map_Manager::end (void) { return ACE_Map_Iterator (*this, 1); } template ACE_INLINE ACE_Map_Reverse_Iterator ACE_Map_Manager::rbegin (void) { return ACE_Map_Reverse_Iterator (*this); } template ACE_INLINE ACE_Map_Reverse_Iterator ACE_Map_Manager::rend (void) { return ACE_Map_Reverse_Iterator (*this, 1); } template ACE_INLINE ACE_Map_Iterator_Base::ACE_Map_Iterator_Base (ACE_Map_Manager &mm) : map_man_ (&mm), next_ (this->map_man_->occupied_list_id ()) { } template ACE_INLINE int ACE_Map_Iterator_Base::next (ACE_Map_Entry *&mm) const { if (this->next_ != this->map_man_->occupied_list_id ()) { mm = &this->map_man_->search_structure_[this->next_]; return 1; } else { return 0; } } template ACE_INLINE int ACE_Map_Iterator_Base::done (void) const { return this->next_ == this->map_man_->occupied_list_id (); } template ACE_INLINE int ACE_Map_Iterator_Base::forward_i (void) { if (this->next_ == this->map_man_->occupied_list_id ()) { this->next_ = this->map_man_->occupied_list_.next (); } else { this->next_ = this->map_man_->search_structure_[this->next_].next (); } return this->next_ != this->map_man_->occupied_list_id (); } template ACE_INLINE int ACE_Map_Iterator_Base::reverse_i (void) { if (this->next_ == this->map_man_->occupied_list_id ()) { this->next_ = this->map_man_->occupied_list_.prev (); } else { this->next_ = this->map_man_->search_structure_[this->next_].prev (); } return this->next_ != this->map_man_->occupied_list_id (); } template ACE_INLINE ACE_Map_Manager & ACE_Map_Iterator_Base::map (void) { return *this->map_man_; } template ACE_INLINE int ACE_Map_Iterator_Base::operator== (const ACE_Map_Iterator_Base &rhs) const { return (this->map_man_ == rhs.map_man_ && this->next_ == rhs.next_); } template ACE_INLINE int ACE_Map_Iterator_Base::operator!= (const ACE_Map_Iterator_Base &rhs) const { return !this->operator== (rhs); } template ACE_INLINE ACE_Map_Iterator::ACE_Map_Iterator (ACE_Map_Manager &mm, int pass_end) : ACE_Map_Iterator_Base (mm) { if (!pass_end) this->forward_i (); } template ACE_INLINE int ACE_Map_Iterator::advance (void) { return this->forward_i (); } template ACE_INLINE ACE_Map_Iterator & ACE_Map_Iterator::operator++ (void) { this->forward_i (); return *this; } template ACE_INLINE ACE_Map_Iterator ACE_Map_Iterator::operator++ (int) { ACE_Map_Iterator retv (*this); this->forward_i (); return retv; } template ACE_INLINE ACE_Map_Iterator & ACE_Map_Iterator::operator-- (void) { this->reverse_i (); return *this; } template ACE_INLINE ACE_Map_Iterator ACE_Map_Iterator::operator-- (int) { ACE_Map_Iterator retv (*this); this->reverse_i (); return retv; } template ACE_INLINE ACE_Map_Reverse_Iterator::ACE_Map_Reverse_Iterator (ACE_Map_Manager &mm, int pass_end) : ACE_Map_Iterator_Base (mm) { if (!pass_end) this->reverse_i (); } template ACE_INLINE int ACE_Map_Reverse_Iterator::advance (void) { return this->reverse_i (); } template ACE_INLINE ACE_Map_Reverse_Iterator & ACE_Map_Reverse_Iterator::operator++ (void) { this->reverse_i (); return *this; } template ACE_INLINE ACE_Map_Reverse_Iterator ACE_Map_Reverse_Iterator::operator++ (int) { ACE_Map_Reverse_Iterator retv (*this); this->reverse_i (); return retv; } template ACE_INLINE ACE_Map_Reverse_Iterator & ACE_Map_Reverse_Iterator::operator-- (void) { this->forward_i (); return *this; } template ACE_INLINE ACE_Map_Reverse_Iterator ACE_Map_Reverse_Iterator::operator-- (int) { ACE_Map_Reverse_Iterator retv (*this); this->forward_i (); return retv; }