iterators_fn_imps.hpp revision 169692
1356290Sjkim// -*- C++ -*-
2110010Smarkm
3110010Smarkm// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4142429Snectar//
5110010Smarkm// This file is part of the GNU ISO C++ Library.  This library is free
6110010Smarkm// software; you can redistribute it and/or modify it under the terms
7110010Smarkm// of the GNU General Public License as published by the Free Software
8110010Smarkm// Foundation; either version 2, or (at your option) any later
9110010Smarkm// version.
10110010Smarkm
11110010Smarkm// This library is distributed in the hope that it will be useful, but
12110010Smarkm// WITHOUT ANY WARRANTY; without even the implied warranty of
13110010Smarkm// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14110010Smarkm// General Public License for more details.
15110010Smarkm
16110010Smarkm// You should have received a copy of the GNU General Public License
17110010Smarkm// along with this library; see the file COPYING.  If not, write to
18110010Smarkm// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19110010Smarkm// MA 02111-1307, USA.
20215698Ssimon
21215698Ssimon// As a special exception, you may use this file as part of a free
22215698Ssimon// software library without restriction.  Specifically, if other files
23215698Ssimon// instantiate templates or use macros or inline functions from this
24215698Ssimon// file, or you compile this file and link it with other files to
25110010Smarkm// produce an executable, this file does not by itself cause the
26110010Smarkm// resulting executable to be covered by the GNU General Public
27110010Smarkm// License.  This exception does not however invalidate any other
28110010Smarkm// reasons why the executable file might be covered by the GNU General
29110010Smarkm// Public License.
30110010Smarkm
31110010Smarkm// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
32110010Smarkm
33110010Smarkm// Permission to use, copy, modify, sell, and distribute this software
34110010Smarkm// is hereby granted without fee, provided that the above copyright
35110010Smarkm// notice appears in all copies, and that both that copyright notice
36110010Smarkm// and this permission notice appear in supporting documentation. None
37110010Smarkm// of the above authors, nor IBM Haifa Research Laboratories, make any
38110010Smarkm// representation about the suitability of this software for any
39110010Smarkm// purpose. It is provided "as is" without express or implied
40110010Smarkm// warranty.
41276861Sjkim
42276861Sjkim/**
43110010Smarkm * @file iterators_fn_imps.hpp
44110010Smarkm * Contains an implementation class for ov_tree_.
45215698Ssimon */
46215698Ssimon
47215698SsimonPB_DS_CLASS_T_DEC
48215698Ssimoninline typename PB_DS_CLASS_C_DEC::const_node_iterator
49312826SjkimPB_DS_CLASS_C_DEC::
50215698Ssimonnode_begin() const
51142429Snectar{ return PB_DS_node_begin_imp(); }
52142429Snectar
53276861SjkimPB_DS_CLASS_T_DEC
54276861Sjkiminline typename PB_DS_CLASS_C_DEC::const_node_iterator
55276861SjkimPB_DS_CLASS_C_DEC::
56110010Smarkmnode_end() const
57344604Sjkim{ return PB_DS_node_end_imp(); }
58344604Sjkim
59344604SjkimPB_DS_CLASS_T_DEC
60344604Sjkiminline typename PB_DS_CLASS_C_DEC::node_iterator
61344604SjkimPB_DS_CLASS_C_DEC::
62344604Sjkimnode_begin()
63215698Ssimon{ return PB_DS_node_begin_imp(); }
64344604Sjkim
65344604SjkimPB_DS_CLASS_T_DEC
66344604Sjkiminline typename PB_DS_CLASS_C_DEC::node_iterator
67344604SjkimPB_DS_CLASS_C_DEC::
68276861Sjkimnode_end()
69215698Ssimon{ return PB_DS_node_end_imp(); }
70344604Sjkim
71110010SmarkmPB_DS_CLASS_T_DEC
72110010Smarkminline typename PB_DS_CLASS_C_DEC::const_node_iterator
73110010SmarkmPB_DS_CLASS_C_DEC::
74110010SmarkmPB_DS_node_begin_imp() const
75110010Smarkm{
76110010Smarkm  return const_node_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
77110010Smarkm			      const_cast<pointer>(begin()),
78110010Smarkm			      const_cast<pointer>(end()),(m_a_metadata == NULL)?
79110010Smarkm			      NULL :
80110010Smarkm			      mid_pointer(m_a_metadata, m_a_metadata + m_size));
81110010Smarkm}
82110010Smarkm
83110010SmarkmPB_DS_CLASS_T_DEC
84110010Smarkminline typename PB_DS_CLASS_C_DEC::const_node_iterator
85110010SmarkmPB_DS_CLASS_C_DEC::
86110010SmarkmPB_DS_node_end_imp() const
87110010Smarkm{
88110010Smarkm  return const_node_iterator(end(), end(), end(),
89110010Smarkm		     (m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);
90110010Smarkm}
91110010Smarkm
92110010SmarkmPB_DS_CLASS_T_DEC
93110010Smarkminline typename PB_DS_CLASS_C_DEC::node_iterator
94110010SmarkmPB_DS_CLASS_C_DEC::
95110010SmarkmPB_DS_node_begin_imp()
96110010Smarkm{
97110010Smarkm  return node_iterator(mid_pointer(begin(), end()), begin(), end(),
98110010Smarkm		       (m_a_metadata == NULL) ? NULL : mid_pointer(m_a_metadata, m_a_metadata + m_size));
99110010Smarkm}
100110010Smarkm
101110010SmarkmPB_DS_CLASS_T_DEC
102110010Smarkminline typename PB_DS_CLASS_C_DEC::node_iterator
103110010SmarkmPB_DS_CLASS_C_DEC::
104110010SmarkmPB_DS_node_end_imp()
105110010Smarkm{
106110010Smarkm  return node_iterator(end(), end(),
107110010Smarkm		  end(),(m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);
108110010Smarkm}
109110010Smarkm
110110010Smarkm