1169691Skan// -*- C++ -*-
2169691Skan
3169691Skan// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4169691Skan//
5169691Skan// This file is part of the GNU ISO C++ Library.  This library is free
6169691Skan// software; you can redistribute it and/or modify it under the terms
7169691Skan// of the GNU General Public License as published by the Free Software
8169691Skan// Foundation; either version 2, or (at your option) any later
9169691Skan// version.
10169691Skan
11169691Skan// This library is distributed in the hope that it will be useful, but
12169691Skan// WITHOUT ANY WARRANTY; without even the implied warranty of
13169691Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14169691Skan// General Public License for more details.
15169691Skan
16169691Skan// You should have received a copy of the GNU General Public License
17169691Skan// along with this library; see the file COPYING.  If not, write to
18169691Skan// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19169691Skan// MA 02111-1307, USA.
20169691Skan
21169691Skan// As a special exception, you may use this file as part of a free
22169691Skan// software library without restriction.  Specifically, if other files
23169691Skan// instantiate templates or use macros or inline functions from this
24169691Skan// file, or you compile this file and link it with other files to
25169691Skan// produce an executable, this file does not by itself cause the
26169691Skan// resulting executable to be covered by the GNU General Public
27169691Skan// License.  This exception does not however invalidate any other
28169691Skan// reasons why the executable file might be covered by the GNU General
29169691Skan// Public License.
30169691Skan
31169691Skan// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
32169691Skan
33169691Skan// Permission to use, copy, modify, sell, and distribute this software
34169691Skan// is hereby granted without fee, provided that the above copyright
35169691Skan// notice appears in all copies, and that both that copyright notice
36169691Skan// and this permission notice appear in supporting documentation. None
37169691Skan// of the above authors, nor IBM Haifa Research Laboratories, make any
38169691Skan// representation about the suitability of this software for any
39169691Skan// purpose. It is provided "as is" without express or implied
40169691Skan// warranty.
41169691Skan
42169691Skan/**
43169691Skan * @file traits.hpp
44169691Skan * Contains an implementation class for pat_trie_.
45169691Skan */
46169691Skan
47169691Skan#ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
48169691Skan#define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
49169691Skan
50169691Skan#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
51169691Skan#include <ext/pb_ds/detail/pat_trie_/head.hpp>
52169691Skan#include <ext/pb_ds/detail/pat_trie_/leaf.hpp>
53169691Skan#include <ext/pb_ds/detail/pat_trie_/internal_node.hpp>
54169691Skan#include <ext/pb_ds/detail/pat_trie_/point_iterators.hpp>
55169691Skan#include <ext/pb_ds/detail/pat_trie_/node_iterators.hpp>
56169691Skan#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
57169691Skan
58169691Skannamespace pb_ds
59169691Skan{
60169691Skan  namespace detail
61169691Skan  {
62169691Skan
63169691Skan    template<typename Key,
64169691Skan	     typename Mapped,
65169691Skan	     class E_Access_Traits,
66169691Skan	     template<typename Const_Node_Iterator,
67169691Skan		      class Node_Iterator,
68169691Skan		      class Cmp_Fn_,
69169691Skan		      class Allocator_>
70169691Skan    class Node_Update,
71169691Skan	     class Allocator>
72169691Skan    struct trie_traits<
73169691Skan      Key,
74169691Skan      Mapped,
75169691Skan      E_Access_Traits,
76169691Skan      Node_Update,
77169691Skan      pat_trie_tag,
78169691Skan      Allocator>
79169691Skan    {
80169691Skan    private:
81169691Skan      typedef types_traits< Key, Mapped, Allocator, false> type_traits;
82169691Skan
83169691Skan    public:
84169691Skan      typedef
85169691Skan      typename trie_node_metadata_selector<
86169691Skan      Key,
87169691Skan      Mapped,
88169691Skan      E_Access_Traits,
89169691Skan      Node_Update,
90169691Skan      Allocator>::type
91169691Skan      metadata_type;
92169691Skan
93169691Skan      typedef E_Access_Traits e_access_traits;
94169691Skan
95169691Skan      typedef
96169691Skan      synth_e_access_traits<
97169691Skan	type_traits,
98169691Skan	false,
99169691Skan	e_access_traits>
100169691Skan      synth_e_access_traits;
101169691Skan
102169691Skan      typedef
103169691Skan      pat_trie_node_base<
104169691Skan	type_traits,
105169691Skan	synth_e_access_traits,
106169691Skan	metadata_type,
107169691Skan	Allocator>
108169691Skan      node;
109169691Skan
110169691Skan      typedef
111169691Skan      pat_trie_leaf<
112169691Skan	type_traits,
113169691Skan	synth_e_access_traits,
114169691Skan	metadata_type,
115169691Skan	Allocator>
116169691Skan      leaf;
117169691Skan
118169691Skan      typedef
119169691Skan      pat_trie_head<
120169691Skan	type_traits,
121169691Skan	synth_e_access_traits,
122169691Skan	metadata_type,
123169691Skan	Allocator>
124169691Skan      head;
125169691Skan
126169691Skan      typedef
127169691Skan      pat_trie_internal_node<
128169691Skan	type_traits,
129169691Skan	synth_e_access_traits,
130169691Skan	metadata_type,
131169691Skan	Allocator>
132169691Skan      internal_node;
133169691Skan
134169691Skan      typedef
135169691Skan      pat_trie_const_it_<
136169691Skan	type_traits,
137169691Skan	node,
138169691Skan	leaf,
139169691Skan	head,
140169691Skan	internal_node,
141169691Skan	true,
142169691Skan	Allocator>
143169691Skan      const_iterator;
144169691Skan
145169691Skan      typedef
146169691Skan      pat_trie_it_<
147169691Skan	type_traits,
148169691Skan	node,
149169691Skan	leaf,
150169691Skan	head,
151169691Skan	internal_node,
152169691Skan	true,
153169691Skan	Allocator>
154169691Skan      iterator;
155169691Skan
156169691Skan      typedef
157169691Skan      pat_trie_const_it_<
158169691Skan	type_traits,
159169691Skan	node,
160169691Skan	leaf,
161169691Skan	head,
162169691Skan	internal_node,
163169691Skan	false,
164169691Skan	Allocator>
165169691Skan      const_reverse_iterator;
166169691Skan
167169691Skan      typedef
168169691Skan      pat_trie_it_<
169169691Skan	type_traits,
170169691Skan	node,
171169691Skan	leaf,
172169691Skan	head,
173169691Skan	internal_node,
174169691Skan	false,
175169691Skan	Allocator>
176169691Skan      reverse_iterator;
177169691Skan
178169691Skan      typedef
179169691Skan      pat_trie_const_node_it_<
180169691Skan	node,
181169691Skan	leaf,
182169691Skan	head,
183169691Skan	internal_node,
184169691Skan	const_iterator,
185169691Skan	iterator,
186169691Skan	synth_e_access_traits,
187169691Skan	Allocator>
188169691Skan      const_node_iterator;
189169691Skan
190169691Skan      typedef
191169691Skan      pat_trie_node_it_<
192169691Skan	node,
193169691Skan	leaf,
194169691Skan	head,
195169691Skan	internal_node,
196169691Skan	const_iterator,
197169691Skan	iterator,
198169691Skan	synth_e_access_traits,
199169691Skan	Allocator>
200169691Skan      node_iterator;
201169691Skan
202169691Skan      typedef
203169691Skan      Node_Update<
204169691Skan	const_node_iterator,
205169691Skan	node_iterator,
206169691Skan	E_Access_Traits,
207169691Skan	Allocator>
208169691Skan      node_update;
209169691Skan
210169691Skan      typedef
211169691Skan      pb_ds::null_trie_node_update<
212169691Skan	const_node_iterator,
213169691Skan	node_iterator,
214169691Skan	E_Access_Traits,
215169691Skan	Allocator>*
216169691Skan      null_node_update_pointer;
217169691Skan    };
218169691Skan
219169691Skan    template<typename Key,
220169691Skan	     class E_Access_Traits,
221169691Skan	     template<typename Const_Node_Iterator,
222169691Skan		      class Node_Iterator,
223169691Skan		      class Cmp_Fn_,
224169691Skan		      class Allocator_>
225169691Skan    class Node_Update,
226169691Skan	     class Allocator>
227169691Skan    struct trie_traits<
228169691Skan      Key,
229169691Skan      null_mapped_type,
230169691Skan      E_Access_Traits,
231169691Skan      Node_Update,
232169691Skan      pat_trie_tag,
233169691Skan      Allocator>
234169691Skan    {
235169691Skan    private:
236169691Skan      typedef
237169691Skan      types_traits<
238169691Skan      Key,
239169691Skan      null_mapped_type,
240169691Skan      Allocator,
241169691Skan      false>
242169691Skan      type_traits;
243169691Skan
244169691Skan    public:
245169691Skan      typedef
246169691Skan      typename trie_node_metadata_selector<
247169691Skan      Key,
248169691Skan      null_mapped_type,
249169691Skan      E_Access_Traits,
250169691Skan      Node_Update,
251169691Skan      Allocator>::type
252169691Skan      metadata_type;
253169691Skan
254169691Skan      typedef E_Access_Traits e_access_traits;
255169691Skan
256169691Skan      typedef
257169691Skan      synth_e_access_traits<
258169691Skan	type_traits,
259169691Skan	true,
260169691Skan	e_access_traits>
261169691Skan      synth_e_access_traits;
262169691Skan
263169691Skan      typedef
264169691Skan      pat_trie_node_base<
265169691Skan	type_traits,
266169691Skan	synth_e_access_traits,
267169691Skan	metadata_type,
268169691Skan	Allocator>
269169691Skan      node;
270169691Skan
271169691Skan      typedef
272169691Skan      pat_trie_leaf<
273169691Skan	type_traits,
274169691Skan	synth_e_access_traits,
275169691Skan	metadata_type,
276169691Skan	Allocator>
277169691Skan      leaf;
278169691Skan
279169691Skan      typedef
280169691Skan      pat_trie_head<
281169691Skan	type_traits,
282169691Skan	synth_e_access_traits,
283169691Skan	metadata_type,
284169691Skan	Allocator>
285169691Skan      head;
286169691Skan
287169691Skan      typedef
288169691Skan      pat_trie_internal_node<
289169691Skan	type_traits,
290169691Skan	synth_e_access_traits,
291169691Skan	metadata_type,
292169691Skan	Allocator>
293169691Skan      internal_node;
294169691Skan
295169691Skan      typedef
296169691Skan      pat_trie_const_it_<
297169691Skan	type_traits,
298169691Skan	node,
299169691Skan	leaf,
300169691Skan	head,
301169691Skan	internal_node,
302169691Skan	true,
303169691Skan	Allocator>
304169691Skan      const_iterator;
305169691Skan
306169691Skan      typedef const_iterator iterator;
307169691Skan
308169691Skan      typedef
309169691Skan      pat_trie_const_it_<
310169691Skan	type_traits,
311169691Skan	node,
312169691Skan	leaf,
313169691Skan	head,
314169691Skan	internal_node,
315169691Skan	false,
316169691Skan	Allocator>
317169691Skan      const_reverse_iterator;
318169691Skan
319169691Skan      typedef const_reverse_iterator reverse_iterator;
320169691Skan
321169691Skan      typedef
322169691Skan      pat_trie_const_node_it_<
323169691Skan	node,
324169691Skan	leaf,
325169691Skan	head,
326169691Skan	internal_node,
327169691Skan	const_iterator,
328169691Skan	iterator,
329169691Skan	synth_e_access_traits,
330169691Skan	Allocator>
331169691Skan      const_node_iterator;
332169691Skan
333169691Skan      typedef const_node_iterator node_iterator;
334169691Skan
335169691Skan      typedef
336169691Skan      Node_Update<
337169691Skan	const_node_iterator,
338169691Skan	node_iterator,
339169691Skan	E_Access_Traits,
340169691Skan	Allocator>
341169691Skan      node_update;
342169691Skan
343169691Skan      typedef
344169691Skan      pb_ds::null_trie_node_update<
345169691Skan	const_node_iterator,
346169691Skan	const_node_iterator,
347169691Skan	E_Access_Traits,
348169691Skan	Allocator>*
349169691Skan      null_node_update_pointer;
350169691Skan    };
351169691Skan
352169691Skan  } // namespace detail
353169691Skan} // namespace pb_ds
354169691Skan
355169691Skan#endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
356169691Skan
357