debug_fn_imps.hpp revision 169691
1136387Sstefanf// -*- C++ -*-
2136387Sstefanf
3136387Sstefanf// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4136387Sstefanf//
5136387Sstefanf// This file is part of the GNU ISO C++ Library.  This library is free
6136387Sstefanf// software; you can redistribute it and/or modify it under the terms
7136387Sstefanf// of the GNU General Public License as published by the Free Software
8136387Sstefanf// Foundation; either version 2, or (at your option) any later
9136387Sstefanf// version.
10136387Sstefanf
11136387Sstefanf// This library is distributed in the hope that it will be useful, but
12136387Sstefanf// WITHOUT ANY WARRANTY; without even the implied warranty of
13136387Sstefanf// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14136387Sstefanf// General Public License for more details.
15136387Sstefanf
16136387Sstefanf// You should have received a copy of the GNU General Public License
17136387Sstefanf// along with this library; see the file COPYING.  If not, write to
18136387Sstefanf// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19136387Sstefanf// MA 02111-1307, USA.
20136387Sstefanf
21136387Sstefanf// As a special exception, you may use this file as part of a free
22136387Sstefanf// software library without restriction.  Specifically, if other files
23136387Sstefanf// instantiate templates or use macros or inline functions from this
24136387Sstefanf// file, or you compile this file and link it with other files to
25136387Sstefanf// produce an executable, this file does not by itself cause the
26136387Sstefanf// resulting executable to be covered by the GNU General Public
27136387Sstefanf// License.  This exception does not however invalidate any other
28136387Sstefanf// reasons why the executable file might be covered by the GNU General
29136387Sstefanf// Public License.
30136387Sstefanf
31136387Sstefanf// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
32136387Sstefanf
33136387Sstefanf// Permission to use, copy, modify, sell, and distribute this software
34136387Sstefanf// is hereby granted without fee, provided that the above copyright
35136387Sstefanf// notice appears in all copies, and that both that copyright notice
36136387Sstefanf// and this permission notice appear in supporting documentation. None
37136387Sstefanf// of the above authors, nor IBM Haifa Research Laboratories, make any
38136387Sstefanf// representation about the suitability of this software for any
39136387Sstefanf// purpose. It is provided "as is" without express or implied
40136387Sstefanf// warranty.
41136387Sstefanf
42136387Sstefanf/**
43136387Sstefanf * @file debug_fn_imps.hpp
44136387Sstefanf * Contains an implementation class for ov_tree_.
45137587Snik */
46136387Sstefanf
47136387Sstefanf#ifdef _GLIBCXX_DEBUG
48136387Sstefanf
49136387SstefanfPB_DS_CLASS_T_DEC
50136387Sstefanfvoid
51136387SstefanfPB_DS_CLASS_C_DEC::
52136387Sstefanfassert_valid() const
53136387Sstefanf{
54136387Sstefanf  std::cout << "av1" << std::endl;
55136387Sstefanf
56137587Snik  if (m_a_values == NULL || m_end_it == NULL || m_size == 0)
57136387Sstefanf    _GLIBCXX_DEBUG_ASSERT(m_a_values == NULL &&  m_end_it == NULL && m_size == 0);
58136387Sstefanf
59136387Sstefanf  std::cout << "av2" << std::endl;
60136387Sstefanf  assert_iterators();
61136387Sstefanf  std::cout << "av3" << std::endl;
62136387Sstefanf}
63136387Sstefanf
64136387SstefanfPB_DS_CLASS_T_DEC
65136387Sstefanfvoid
66136387SstefanfPB_DS_CLASS_C_DEC::
67136387Sstefanfassert_iterators() const
68137587Snik{
69136387Sstefanf  map_debug_base::check_size(m_size);
70136387Sstefanf  size_type iterated_num = 0;
71136387Sstefanf  const_iterator prev_it = end();
72136387Sstefanf  _GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size);
73136387Sstefanf  for (const_iterator it = begin(); it != end(); ++it)
74136387Sstefanf    {
75136387Sstefanf      ++iterated_num;
76136387Sstefanf      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(*it));)
77136387Sstefanf      _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);
78136387Sstefanf      const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
79136387Sstefanf      --upper_bound_it;
80137587Snik      _GLIBCXX_DEBUG_ASSERT(upper_bound_it == it);
81136387Sstefanf      if (prev_it != end())
82136387Sstefanf	_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),
83136387Sstefanf						 PB_DS_V2F(*it)));
84      prev_it = it;
85    }
86  _GLIBCXX_DEBUG_ASSERT(iterated_num == m_size);
87}
88
89#endif
90
91