// -*- 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. // You should have received a copy of the GNU General Public License // along with this library; see the file COPYING3. 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 ds_string_form.hpp * Transforms containers into string form. */ #ifndef PB_DS_DS_STRING_FORM_HPP #define PB_DS_DS_STRING_FORM_HPP #include #include #include #include #include #include #include #include #include #include #include namespace __gnu_pbds { namespace test { namespace detail { template struct ds_string_form; template struct ds_string_form { static std::string name() { return ("cc_hash_" + comb_hash_fn_string_form::name() + resize_policy_string_form::name() + store_hash_string_form::name()); } static std::string desc() { const std::string comb_hash_fn_desc = comb_hash_fn_string_form::desc(); const std::string resize_policy_desc = resize_policy_string_form::desc(); const std::string store_hash_desc = store_hash_string_form::desc(); return (make_xml_tag("type", "value", "cc_hash_table", comb_hash_fn_desc + resize_policy_desc + store_hash_desc)); } }; template struct ds_string_form { static std::string name() { return ("gp_hash_" + comb_hash_fn_string_form::name() + probe_fn_string_form::name() + resize_policy_string_form::name() + store_hash_string_form::name()); } static std::string desc() { const std::string comb_probe_fn_desc = comb_hash_fn_string_form::desc(); const std::string probe_fn_desc = probe_fn_string_form::desc(); const std::string resize_policy_desc = resize_policy_string_form::desc(); const std::string store_hash_desc = store_hash_string_form::desc(); return make_xml_tag("type", "value", "gp_hash_table", comb_probe_fn_desc + probe_fn_desc + resize_policy_desc + store_hash_desc); } }; template struct tree_ds_string_form { static std::string name(const std::string container_category_str) { if (tree_supports_order_statistics::value) return (container_category_str + "ost_"); return container_category_str; } static std::string desc(const std::string container_category_str) { const std::string category_str = make_xml_tag("Tag", "value", container_category_str); const std::string node_update_str = make_xml_tag("Node_Update", "value",(tree_supports_order_statistics::value ? "tree_order_statistics_node_update" : "null_tree_node_update")); return make_xml_tag("type", "value", "tree", category_str + node_update_str); } }; template struct ds_string_form : private tree_ds_string_form { private: typedef tree_ds_string_form< Cntnr> base_type; public: static std::string name() { return base_type::name("rb_tree_"); } static std::string desc() { return base_type::desc("rb_tree_tag"); } }; template struct ds_string_form : private tree_ds_string_form { private: typedef tree_ds_string_form< Cntnr> base_type; public: static std::string name() { return base_type::name("splay_tree_"); } static std::string desc() { return base_type::desc("splay_tree_tag"); } }; template struct ds_string_form : private tree_ds_string_form { private: typedef tree_ds_string_form< Cntnr> base_type; public: static std::string name() { return (base_type::name("ov_tree_")); } static std::string desc() { return (base_type::desc("ov_tree_tag")); } }; template struct ds_string_form { static std::string name() { return ("lu_" + lu_policy_string_form::name()); } static std::string desc() { return make_xml_tag("type", "value", "list_update", lu_policy_string_form::desc()); } }; template struct ds_string_form { static std::string name() { if (trie_supports_order_statistics::value) return ("pat_trie_ost_"); if (trie_supports_prefix_search::value) return ("pat_trie_prs_"); return ("pat_trie_"); } static std::string desc() { std::string category_s = make_xml_tag("Tag", "value", "pat_trie_tag"); const char* s; if (trie_supports_order_statistics::value) s = "trie_order_statistics_node_update"; else if (trie_supports_prefix_search::value) s = "trie_prefix_search_node_update"; else s = "null_trie_node_update"; std::string node_s = make_xml_tag("Node_Update", "value", s); return make_xml_tag("type", "value", "trie", category_s + node_s); } }; } // namespace detail } // namespace test } // namespace __gnu_pbds #endif // #ifndef PB_DS_DS_STRING_FORM_HPP