STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
safe_unordered_base.h
Go to the documentation of this file.
1 // Safe container/iterator base implementation -*- C++ -*-
2 
3 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
29 #ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H
30 #define _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H 1
31 
32 #include <debug/safe_base.h>
33 
34 namespace __gnu_debug
35 {
36  class _Safe_unordered_container_base;
37 
51  {
52  protected:
55  { }
56 
64  _Safe_local_iterator_base(const _Safe_sequence_base* __seq, bool __constant)
65  { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); }
66 
71  bool __constant)
72  { this->_M_attach(__x._M_sequence, __constant); }
73 
76 
77  explicit
79 
81 
83  _M_get_container() const _GLIBCXX_NOEXCEPT;
84 
85  public:
91  void _M_attach(_Safe_sequence_base* __seq, bool __constant);
92 
94  void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ();
95 
99  void _M_detach();
100 
102  void _M_detach_single() throw ();
103  };
104 
124  {
125  typedef _Safe_sequence_base _Base;
126  public:
129 
132 
133  protected:
134  // Initialize with a version number of 1 and no iterators
136  : _M_local_iterators(nullptr), _M_const_local_iterators(nullptr)
137  { }
138 
139  // Initialize with a version number of 1 and no iterators
141  noexcept
143 
145  noexcept
147  { this->_M_swap(__x); }
148 
152  { this->_M_detach_all(); }
153 
155  void
156  _M_detach_all();
157 
163  void
164  _M_swap(_Safe_unordered_container_base& __x);
165 
166  public:
168  void
169  _M_attach_local(_Safe_iterator_base* __it, bool __constant);
170 
172  void
173  _M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw ();
174 
176  void
177  _M_detach_local(_Safe_iterator_base* __it);
178 
180  void
181  _M_detach_local_single(_Safe_iterator_base* __it) throw ();
182  };
183 } // namespace __gnu_debug
184 
185 #endif
_Safe_local_iterator_base & operator=(const _Safe_local_iterator_base &)
~_Safe_local_iterator_base()
Definition: safe_unordered_base.h:80
_Safe_local_iterator_base(const _Safe_sequence_base *__seq, bool __constant)
Definition: safe_unordered_base.h:64
_Safe_sequence_base * _M_sequence
Definition: safe_base.h:55
_Safe_iterator_base * _M_const_local_iterators
The list of constant local iterators that reference this container.
Definition: safe_unordered_base.h:131
_Safe_local_iterator_base(const _Safe_local_iterator_base &__x, bool __constant)
Definition: safe_unordered_base.h:70
void _M_attach(_Safe_sequence_base *__seq, bool __constant)
_Safe_unordered_container_base(const _Safe_unordered_container_base &) noexcept
Definition: safe_unordered_base.h:140
_Safe_iterator_base * _M_local_iterators
The list of mutable local iterators that reference this container.
Definition: safe_unordered_base.h:128
_Safe_unordered_container_base(_Safe_unordered_container_base &&__x) noexcept
Definition: safe_unordered_base.h:144
_Safe_sequence_base _Base
Definition: safe_unordered_base.h:125
_Safe_local_iterator_base()
Definition: safe_unordered_base.h:54
_Safe_unordered_container_base()
Definition: safe_unordered_base.h:135
Basic functionality for a safe iterator.
Definition: safe_unordered_base.h:50
Basic functionality for a safe iterator.
Definition: safe_base.h:50
Base class that supports tracking of iterators that reference a sequence.
Definition: safe_base.h:177
void _M_attach_single(_Safe_sequence_base *__seq, bool __constant)
Base class that supports tracking of local iterators that reference an unordered container.
Definition: safe_unordered_base.h:123
_Safe_unordered_container_base * _M_get_container() const _GLIBCXX_NOEXCEPT
~_Safe_unordered_container_base()
Definition: safe_unordered_base.h:151