iterator_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   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   const_pointer p_value;
00081   size_type pos;
00082 
00083   get_start_it_state(p_value, pos);
00084 
00085   return (const_iterator(p_value, pos, this));
00086 }
00087 
00088 PB_ASSOC_CLASS_T_DEC
00089 inline typename PB_ASSOC_CLASS_C_DEC::const_iterator
00090 PB_ASSOC_CLASS_C_DEC::
00091 end() const
00092 {
00093   return (s_const_end_it);
00094 }
00095 
00096 #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
00097 PB_ASSOC_CLASS_T_DEC
00098 void
00099 PB_ASSOC_CLASS_C_DEC::
00100 inc_it_state(pointer& r_p_value, size_type& r_pos) const
00101 {
00102   PB_ASSOC_DBG_ASSERT(r_p_value != NULL);
00103 
00104   for (++r_pos; r_pos < m_num_e; ++r_pos)
00105     {
00106       const_entry_pointer p_e =& m_a_entries[r_pos];
00107 
00108       if (p_e->m_stat == VALID_ENTRY_STATUS)
00109     {
00110       r_p_value = static_cast<const_pointer>(&p_e->m_value);
00111 
00112       return;
00113     }
00114     }
00115 
00116   r_p_value = NULL;
00117 }
00118 #endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
00119 
00120 PB_ASSOC_CLASS_T_DEC
00121 void
00122 PB_ASSOC_CLASS_C_DEC::
00123 inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
00124 {
00125   PB_ASSOC_DBG_ASSERT(r_p_value != NULL);
00126 
00127   for (++r_pos; r_pos < m_num_e; ++r_pos)
00128     {
00129       const_entry_pointer p_e =& m_a_entries[r_pos];
00130 
00131       if (p_e->m_stat == VALID_ENTRY_STATUS)
00132     {
00133       r_p_value = static_cast<const_pointer>(&p_e->m_value);
00134 
00135       return;
00136     }
00137     }
00138 
00139   r_p_value = NULL;
00140 }
00141 
00142 PB_ASSOC_CLASS_T_DEC
00143 void
00144 PB_ASSOC_CLASS_C_DEC::
00145 get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const
00146 {
00147   for (r_pos = 0; r_pos < m_num_e; ++r_pos)
00148     {
00149       const_entry_pointer p_e =& m_a_entries[r_pos];
00150 
00151       if (p_e->m_stat == VALID_ENTRY_STATUS)
00152     {
00153       r_p_value =& p_e->m_value;
00154 
00155       return;
00156     }
00157     }
00158 
00159   r_p_value = NULL;
00160 }
00161 
00162 PB_ASSOC_CLASS_T_DEC
00163 void
00164 PB_ASSOC_CLASS_C_DEC::
00165 get_start_it_state(pointer& r_p_value, size_type& r_pos)
00166 {
00167   for (r_pos = 0; r_pos < m_num_e; ++r_pos)
00168     {
00169       entry_pointer p_e =& m_a_entries[r_pos];
00170 
00171       if (p_e->m_stat == VALID_ENTRY_STATUS)
00172     {
00173       r_p_value = const_cast<pointer>(&p_e->m_value);
00174 
00175       return;
00176     }
00177     }
00178 
00179   r_p_value = NULL;
00180 }
00181 

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