iterators_fn_imps.hpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // Copyright (C) 2005 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 2, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // You should have received a copy of the GNU General Public License along
00017 // with this library; see the file COPYING.  If not, write to the Free
00018 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00019 // USA.
00020 
00021 // As a special exception, you may use this file as part of a free software
00022 // library without restriction.  Specifically, if other files instantiate
00023 // templates or use macros or inline functions from this file, or you compile
00024 // this file and link it with other files to produce an executable, this
00025 // file does not by itself cause the resulting executable to be covered by
00026 // the GNU General Public License.  This exception does not however
00027 // invalidate any other reasons why the executable file might be covered by
00028 // the GNU General Public License.
00029 
00030 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
00031 
00032 // Permission to use, copy, modify, sell, and distribute this software
00033 // is hereby granted without fee, provided that the above copyright
00034 // notice appears in all copies, and that both that copyright notice and
00035 // this permission notice appear in supporting documentation. None of
00036 // the above authors, nor IBM Haifa Research Laboratories, make any
00037 // representation about the suitability of this software for any
00038 // purpose. It is provided "as is" without express or implied warranty.
00039 
00046 PB_ASSOC_CLASS_T_DEC
00047 typename PB_ASSOC_CLASS_C_DEC::iterator
00048 PB_ASSOC_CLASS_C_DEC::s_end_it;
00049 
00050 PB_ASSOC_CLASS_T_DEC
00051 typename PB_ASSOC_CLASS_C_DEC::const_iterator
00052 PB_ASSOC_CLASS_C_DEC::s_const_end_it;
00053 
00054 PB_ASSOC_CLASS_T_DEC
00055 inline typename PB_ASSOC_CLASS_C_DEC::iterator
00056 PB_ASSOC_CLASS_C_DEC::
00057 begin()
00058 {
00059   pointer p_value;
00060   std::pair<entry_pointer, size_type> pos;
00061 
00062   get_start_it_state(p_value, pos);
00063 
00064   return (iterator(p_value, pos, this));
00065 }
00066 
00067 PB_ASSOC_CLASS_T_DEC
00068 inline typename PB_ASSOC_CLASS_C_DEC::iterator
00069 PB_ASSOC_CLASS_C_DEC::
00070 end()
00071 {
00072   return (s_end_it);
00073 }
00074 
00075 PB_ASSOC_CLASS_T_DEC
00076 inline typename PB_ASSOC_CLASS_C_DEC::const_iterator
00077 PB_ASSOC_CLASS_C_DEC::
00078 begin() const
00079 {
00080   pointer p_value;
00081 
00082   std::pair<entry_pointer, size_type> pos;
00083 
00084   get_start_it_state(p_value, pos);
00085 
00086   return (const_iterator(p_value, pos, this));
00087 }
00088 
00089 PB_ASSOC_CLASS_T_DEC
00090 inline typename PB_ASSOC_CLASS_C_DEC::const_iterator
00091 PB_ASSOC_CLASS_C_DEC::
00092 end() const
00093 {
00094   return (s_const_end_it);
00095 }
00096 
00097 #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
00098 PB_ASSOC_CLASS_T_DEC
00099 void
00100 PB_ASSOC_CLASS_C_DEC::
00101 inc_it_state(pointer& r_p_value, std::pair<entry_pointer, size_type>& r_pos) const
00102 {
00103   inc_it_state((const_pointer& )r_p_value, r_pos);
00104 }
00105 #endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
00106 
00107 PB_ASSOC_CLASS_T_DEC
00108 void
00109 PB_ASSOC_CLASS_C_DEC::
00110 inc_it_state(const_pointer& r_p_value, std::pair<entry_pointer, size_type>& r_pos) const
00111 {
00112   PB_ASSOC_DBG_ASSERT(r_p_value != NULL);
00113 
00114   r_pos.first = r_pos.first->m_p_next;
00115 
00116   if (r_pos.first != NULL)
00117     {
00118       r_p_value =& r_pos.first->m_value;
00119 
00120       return;
00121     }
00122 
00123   for (++r_pos.second; r_pos.second < m_num_e_p; ++r_pos.second)
00124     if (m_a_p_entries[r_pos.second] != NULL)
00125       {
00126     r_pos.first = m_a_p_entries[r_pos.second];
00127 
00128     r_p_value =& r_pos.first->m_value;
00129 
00130     return;
00131       }
00132 
00133   r_p_value = NULL;
00134 }
00135 
00136 PB_ASSOC_CLASS_T_DEC
00137 void
00138 PB_ASSOC_CLASS_C_DEC::
00139 get_start_it_state(pointer& r_p_value, std::pair<entry_pointer, size_type>& r_pos) const
00140 {
00141   for (r_pos.second = 0; r_pos.second < m_num_e_p; ++r_pos.second)
00142     if (m_a_p_entries[r_pos.second] != NULL)
00143       {
00144     r_pos.first = m_a_p_entries[r_pos.second];
00145 
00146     r_p_value = (pointer)(r_pos.first);
00147 
00148     return;
00149       }
00150 
00151   r_p_value = NULL;
00152 }
00153 

Generated on Tue Feb 2 16:56:11 2010 for GNU C++ STL by  doxygen 1.4.7