From 1a2238d1bddc823df06f67312d96ccf9de2893cc Mon Sep 17 00:00:00 2001 From: root Date: Sat, 19 Dec 2015 13:13:57 +0000 Subject: CFE from danitool [without hostTools dir]: https://mega.nz/#!mwZyFK7a!CPT3BKC8dEw29kubtdYxhB91G9vIIismTkgzQ3iUy3k --- .../detail/trie_policy/node_metadata_selector.hpp | 116 ++++++++++ .../detail/trie_policy/null_node_update_imp.hpp | 50 +++++ .../detail/trie_policy/order_statistics_imp.hpp | 183 +++++++++++++++ .../trie_policy/prefix_search_node_update_imp.hpp | 151 +++++++++++++ .../trie_policy/sample_trie_e_access_traits.hpp | 89 ++++++++ .../detail/trie_policy/sample_trie_node_update.hpp | 72 ++++++ .../string_trie_e_access_traits_imp.hpp | 99 ++++++++ .../pb_ds/detail/trie_policy/trie_policy_base.hpp | 249 +++++++++++++++++++++ 8 files changed, 1009 insertions(+) create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp (limited to 'uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy') diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp new file mode 100644 index 0000000..b4de31f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp @@ -0,0 +1,116 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file node_metadata_selector.hpp + * Contains an implementation class for tries. + */ + +#ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP +#define PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP + +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + + template + struct trie_metadata_helper + { + typedef typename Node_Update::metadata_type type; + }; + + template + struct trie_metadata_helper< + Node_Update, + true> + { + typedef null_node_metadata type; + }; + + template + class Node_Update, + class Allocator> + struct trie_node_metadata_selector + { + private: + typedef + dumconst_node_iterator< + Key, + Data, + Allocator> + dumconst_node_it; + + enum + { + null_update = + is_same< + Node_Update< + dumconst_node_it, + dumconst_node_it, + Cmp_Fn, + Allocator>, + null_trie_node_update< + dumconst_node_it, + dumconst_node_it, + Cmp_Fn, + Allocator> >::value + }; + + public: + typedef + typename trie_metadata_helper< + Node_Update< + dumconst_node_it, + dumconst_node_it, + Cmp_Fn, + Allocator>, + null_update>::type + type; + }; + + } // namespace detail +} // namespace __gnu_pbds + +#endif // #ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp new file mode 100644 index 0000000..65245e9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp @@ -0,0 +1,50 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file null_node_update_imp.hpp + * Contains an implementation of null_node_update. + */ + +PB_DS_CLASS_T_DEC +template +inline void +PB_DS_CLASS_C_DEC:: +swap(null_trie_node_update< Const_Node_Iterator_, Node_Iterator_, E_Access_Traits_, Allocator_>& /*other*/) +{ } + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp new file mode 100644 index 0000000..4e27ac2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp @@ -0,0 +1,183 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file order_statistics_imp.hpp + * Contains forward declarations for order_statistics_key + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +find_by_order(size_type order) +{ + if (empty()) + return (end()); + + ++order; + + node_iterator nd_it = node_begin(); + + node_iterator end_nd_it = node_end(); + + while (true) + { + if (order > nd_it.get_metadata()) + return (++base_type::rightmost_it(nd_it)); + + const size_type num_children = nd_it.num_children(); + + if (num_children == 0) + return (*nd_it); + + for (size_type i = 0; i < num_children; ++i) + { + node_iterator child_nd_it = nd_it.get_child(i); + + if (order <= child_nd_it.get_metadata()) + { + i = num_children; + + nd_it = child_nd_it; + } + else + order -= child_nd_it.get_metadata(); + } + } +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +find_by_order(size_type order) const +{ + return (const_cast(this)->find_by_order(order)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +order_of_key(const_key_reference r_key) const +{ + const E_Access_Traits& r_traits = + const_cast(this)->get_e_access_traits(); + + return (order_of_prefix( + r_traits.begin(r_key), + r_traits.end(r_key))); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +order_of_prefix(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const +{ + if (empty()) + return (0); + + const E_Access_Traits& r_traits = + const_cast(this)->get_e_access_traits(); + + const_node_iterator nd_it = node_begin(); + + const_node_iterator end_nd_it = node_end(); + + size_type ord = 0; + + while (true) + { + const size_type num_children = nd_it.num_children(); + + if (num_children == 0) + { + const_key_reference r_key = + base_type::extract_key(*(*nd_it)); + + typename e_access_traits::const_iterator key_b = + r_traits.begin(r_key); + + typename e_access_traits::const_iterator key_e = + r_traits.end(r_key); + + return ((base_type::less( key_b, key_e, b, e, r_traits))? + ord + 1 : + ord); + } + + const_node_iterator next_nd_it = end_nd_it; + + size_type i = num_children - 1; + + do + { + const_node_iterator child_nd_it = nd_it.get_child(i); + + if (next_nd_it != end_nd_it) + ord += child_nd_it.get_metadata(); + else if (!base_type::less( + b, e, + child_nd_it.valid_prefix().first, + child_nd_it.valid_prefix().second, + r_traits)) + next_nd_it = child_nd_it; + } + while (i-- > 0); + + if (next_nd_it == end_nd_it) + return (ord); + + nd_it = next_nd_it; + } +} + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +operator()(node_iterator nd_it, const_node_iterator /*end_nd_it*/) const +{ + const size_type num_children = nd_it.num_children(); + + size_type children_rank = 0; + + for (size_type i = 0; i < num_children; ++i) + children_rank += nd_it.get_child(i).get_metadata(); + + const_cast(nd_it.get_metadata()) =(num_children == 0)? 1 : children_rank; +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +~trie_order_statistics_node_update() +{ } diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp new file mode 100644 index 0000000..cdd8989 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp @@ -0,0 +1,151 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file prefix_search_node_update_imp.hpp + * Contains an implementation of prefix_search_node_update. + */ + +PB_DS_CLASS_T_DEC +std::pair< + typename PB_DS_CLASS_C_DEC::const_iterator, + typename PB_DS_CLASS_C_DEC::const_iterator> +PB_DS_CLASS_C_DEC:: +prefix_range(const_key_reference r_key) const +{ + const e_access_traits& r_traits = get_e_access_traits(); + + return (prefix_range( + r_traits.begin(r_key), + r_traits.end(r_key))); +} + +PB_DS_CLASS_T_DEC +std::pair< + typename PB_DS_CLASS_C_DEC::iterator, + typename PB_DS_CLASS_C_DEC::iterator> +PB_DS_CLASS_C_DEC:: +prefix_range(const_key_reference r_key) +{ + return (prefix_range( + get_e_access_traits().begin(r_key), + get_e_access_traits().end(r_key))); +} + +PB_DS_CLASS_T_DEC +std::pair< + typename PB_DS_CLASS_C_DEC::const_iterator, + typename PB_DS_CLASS_C_DEC::const_iterator> +PB_DS_CLASS_C_DEC:: +prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const +{ + const std::pair non_const_ret = + const_cast(this)->prefix_range(b, e); + + return (std::make_pair( + const_iterator(non_const_ret.first), + const_iterator(non_const_ret.second))); +} + +PB_DS_CLASS_T_DEC +std::pair< + typename PB_DS_CLASS_C_DEC::iterator, + typename PB_DS_CLASS_C_DEC::iterator> +PB_DS_CLASS_C_DEC:: +prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) +{ + Node_Iterator nd_it = node_begin(); + Node_Iterator end_nd_it = node_end(); + + const e_access_traits& r_traits = + get_e_access_traits(); + + const size_type given_range_length = std::distance(b, e); + + while (true) + { + if (nd_it == end_nd_it) + return (std::make_pair(end(), end())); + + const size_type common_range_length = + PB_DS_BASE_C_DEC::common_prefix_len(nd_it, b, e, r_traits); + + if (common_range_length >= given_range_length) + { + iterator ret_b = leftmost_it(nd_it); + + iterator ret_e = rightmost_it(nd_it); + + return (std::make_pair(ret_b, ++ret_e)); + } + + nd_it = next_child(nd_it, b, e, end_nd_it, r_traits); + } +} + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::node_iterator +PB_DS_CLASS_C_DEC:: +next_child(node_iterator nd_it, typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e, node_iterator end_nd_it, const e_access_traits& r_traits) +{ + const size_type num_children = nd_it.num_children(); + + node_iterator ret = end_nd_it; + + size_type max_length = 0; + + for (size_type i = 0; i < num_children; ++i) + { + node_iterator pot = nd_it.get_child(i); + + const size_type common_range_length = + PB_DS_BASE_C_DEC::common_prefix_len( pot, b, e, r_traits); + + if (common_range_length > max_length) + { + ret = pot; + + max_length = common_range_length; + } + } + + return (ret); +} + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +operator()(node_iterator /*nd_it*/, const_node_iterator /*end_nd_it*/) const +{ } diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp new file mode 100644 index 0000000..34fbe0c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp @@ -0,0 +1,89 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_trie_e_access_traits.hpp + * Contains a sample probe policy. + */ + +#ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP +#define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP + +// A sample trie element-access traits. +class sample_trie_e_access_traits +{ + +public: + + // Size type. + typedef size_t size_type; + + // Key type. + typedef std::string key_type; + + // Const key reference type. + typedef + typename Allocator::template rebind< + key_type>::other::const_reference + const_key_reference; + + // Element const iterator type. + typedef std::string::const_iterator const_iterator; + + // Element type. + typedef char e_type; + + enum + { + max_size = 4 + }; + +public: + + // Returns a const_iterator to the first element of r_key. + inline static const_iterator + begin(const_key_reference r_key); + + // Returns a const_iterator to the after-last element of r_key. + inline static const_iterator + end(const_key_reference r_key); + + // Maps an element to a position. + inline static size_type + e_pos(e_type e); + +}; + +#endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp new file mode 100644 index 0000000..55fd997 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp @@ -0,0 +1,72 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_trie_node_update.hpp + * Contains a samle node update functor. + */ + +#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP +#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP + +// A sample node updator. +template +class sample_trie_node_update +{ + +public: + + // Metadata type. + typedef size_t metadata_type; + +protected: + + // Default constructor. + sample_trie_node_update(); + + // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator. + inline void + operator()(node_iterator node_it, const_node_iterator end_nd_it) const; + +}; + +#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp new file mode 100644 index 0000000..228a4a5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp @@ -0,0 +1,99 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file string_trie_e_access_traits_imp.hpp + * Contains a policy for extracting character positions from + * a string for a vector-based PATRICIA tree + */ + +PB_DS_CLASS_T_DEC +detail::integral_constant PB_DS_CLASS_C_DEC::s_rev_ind; + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +e_pos(e_type e) +{ + return (static_cast(e - min_e_val)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin(const_key_reference r_key) +{ + return (begin_imp(r_key, s_rev_ind)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end(const_key_reference r_key) +{ + return (end_imp(r_key, s_rev_ind)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin_imp(const_key_reference r_key, detail::false_type) +{ + return (r_key.begin()); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin_imp(const_key_reference r_key, detail::true_type) +{ + return (r_key.rbegin()); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end_imp(const_key_reference r_key, detail::false_type) +{ + return (r_key.end()); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end_imp(const_key_reference r_key, detail::true_type) +{ + return (r_key.rend()); +} diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp new file mode 100644 index 0000000..db912a0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp @@ -0,0 +1,249 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file trie_policy_base.hpp + * Contains an implementation of trie_policy_base. + */ + +#ifndef PB_DS_TRIE_POLICY_BASE_HPP +#define PB_DS_TRIE_POLICY_BASE_HPP + +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#define PB_DS_CLASS_T_DEC \ + template< \ + class Const_Node_Iterator, \ + class Node_Iterator, \ + class E_Access_Traits, \ + typename Allocator> + +#define PB_DS_CLASS_C_DEC \ + trie_policy_base< \ + Const_Node_Iterator, \ + Node_Iterator, \ + E_Access_Traits, \ + Allocator> + +#define PB_DS_BASE_C_DEC \ + basic_tree_policy_base< \ + Const_Node_Iterator, \ + Node_Iterator, \ + Allocator> + + template + class trie_policy_base : public PB_DS_BASE_C_DEC + { + + public: + + typedef E_Access_Traits e_access_traits; + + typedef Allocator allocator_type; + + typedef typename allocator_type::size_type size_type; + + typedef null_node_metadata metadata_type; + + typedef Const_Node_Iterator const_node_iterator; + + typedef Node_Iterator node_iterator; + + typedef typename const_node_iterator::value_type const_iterator; + + typedef typename node_iterator::value_type iterator; + + public: + + typedef typename PB_DS_BASE_C_DEC::key_type key_type; + + typedef + typename PB_DS_BASE_C_DEC::const_key_reference + const_key_reference; + + protected: + + virtual const_iterator + end() const = 0; + + virtual iterator + end() = 0; + + virtual const_node_iterator + node_begin() const = 0; + + virtual node_iterator + node_begin() = 0; + + virtual const_node_iterator + node_end() const = 0; + + virtual node_iterator + node_end() = 0; + + virtual const e_access_traits& + get_e_access_traits() const = 0; + + private: + typedef + std::pair< + typename e_access_traits::const_iterator, + typename e_access_traits::const_iterator> + prefix_range_t; + + typedef PB_DS_BASE_C_DEC base_type; + + protected: + static size_type + common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits); + + static iterator + leftmost_it(node_iterator nd_it); + + static iterator + rightmost_it(node_iterator nd_it); + + static bool + less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits); + }; + + PB_DS_CLASS_T_DEC + typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits) + { + prefix_range_t pref_range = nd_it.valid_prefix(); + + typename e_access_traits::const_iterator b_l = pref_range.first; + typename e_access_traits::const_iterator e_l = pref_range.second; + + const size_type range_length_l = + std::distance(b_l, e_l); + + const size_type range_length_r = + std::distance(b_r, e_r); + + if (range_length_r < range_length_l) + { + std::swap(b_l, b_r); + + std::swap(e_l, e_r); + } + + size_type ret = 0; + + while (b_l != e_l) + { + if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r)) + return (ret); + + ++ret; + + ++b_l; + + ++b_r; + } + + return (ret); + } + + PB_DS_CLASS_T_DEC + typename PB_DS_CLASS_C_DEC::iterator + PB_DS_CLASS_C_DEC:: + leftmost_it(node_iterator nd_it) + { + if (nd_it.num_children() == 0) + return (*nd_it); + + return (leftmost_it(nd_it.get_child(0))); + } + + PB_DS_CLASS_T_DEC + typename PB_DS_CLASS_C_DEC::iterator + PB_DS_CLASS_C_DEC:: + rightmost_it(node_iterator nd_it) + { + const size_type num_children = nd_it.num_children(); + + if (num_children == 0) + return (*nd_it); + + return (rightmost_it(nd_it.get_child(num_children - 1))); + } + + PB_DS_CLASS_T_DEC + bool + PB_DS_CLASS_C_DEC:: + less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits) + { + while (b_l != e_l) + { + if (b_r == e_r) + return (false); + + size_type l_pos = + r_traits.e_pos(*b_l); + size_type r_pos = + r_traits.e_pos(*b_r); + + if (l_pos != r_pos) + return (l_pos < r_pos); + + ++b_l; + ++b_r; + } + + return (b_r != e_r); + } + +#undef PB_DS_CLASS_T_DEC + +#undef PB_DS_CLASS_C_DEC + +#undef PB_DS_BASE_C_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP + -- cgit v1.2.3