<commit_before>﻿/* -*- coding: utf-8; mode: c++; tab-width: 3; indent-tabs-mode: nil -*-

Copyright 2015
<NAME>

This file is part of Abaclade.

Abaclade 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 of the
License, or (at your option) any later version.

Abaclade 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 Abaclade. If not, see
<http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------------------------*/

#ifndef _ABACLADE_COLLECTIONS_DETAIL_TRIE_ORDERED_MULTIMAP_HXX
#define _ABACLADE_COLLECTIONS_DETAIL_TRIE_ORDERED_MULTIMAP_HXX

#ifndef _ABACLADE_HXX
   #error "Please #include <abaclade.hxx> before this file"
#endif
#ifdef ABC_CXX_PRAGMA_ONCE
   #pragma once
#endif

#include <abaclade/collections/type_void_adapter.hxx>
#include <abaclade/numeric.hxx>


////////////////////////////////////////////////////////////////////////////////////////////////////

namespace abc { namespace collections { namespace detail {

//! Implementation of abc::collections::trie_ordered_multimap for scalar key types.
class ABACLADE_SYM scalar_keyed_trie_ordered_multimap_impl {
private:
   /*! Determines the compactness of each level of the tree. Packing multiple bits on each level
   results in faster lookups and fewer memory allocations, at the cost of increased slack in each
   tree node. */
   static unsigned const smc_cBitsPerLevel = 4;
   //! Count of children pointers that each tree node needs.
   static unsigned const smc_cBitPermutationsPerLevel = 1 << smc_cBitsPerLevel;
   static unsigned const smc_iTreeAnchorLevel =
      sizeof(std::uintmax_t /*TODO: TKey*/) * 8 /*TODO: CHAR_BIT*/ / smc_cBitsPerLevel - 1;

protected:
   /*! Abstract node. Defined to avoid using void * in code where pointers’ type change depending on
   the level in the tree. */
   class node {
   };

   //! Stores a single value, as well as the doubly-linked list’s links.
   class list_node : public node {
   public:
      //! Constructor.
      list_node() :<commit_msg>Use CHAR_BIT instead of 8<commit_after>﻿/* -*- coding: utf-8; mode: c++; tab-width: 3; indent-tabs-mode: nil -*-

Copyright 2015
<NAME>

This file is part of Abaclade.

Abaclade 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 of the
License, or (at your option) any later version.

Abaclade 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 Abaclade. If not, see
<http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------------------------*/

#ifndef _ABACLADE_COLLECTIONS_DETAIL_TRIE_ORDERED_MULTIMAP_HXX
#define _ABACLADE_COLLECTIONS_DETAIL_TRIE_ORDERED_MULTIMAP_HXX

#ifndef _ABACLADE_HXX
   #error "Please #include <abaclade.hxx> before this file"
#endif
#ifdef ABC_CXX_PRAGMA_ONCE
   #pragma once
#endif

#include <abaclade/collections/type_void_adapter.hxx>
#include <abaclade/numeric.hxx>

#include <climits> // CHAR_BIT


////////////////////////////////////////////////////////////////////////////////////////////////////

namespace abc { namespace collections { namespace detail {

//! Implementation of abc::collections::trie_ordered_multimap for scalar key types.
class ABACLADE_SYM scalar_keyed_trie_ordered_multimap_impl {
private:
   /*! Determines the compactness of each level of the tree. Packing multiple bits on each level
   results in faster lookups and fewer memory allocations, at the cost of increased slack in each
   tree node. */
   static unsigned const smc_cBitsPerLevel = 4;
   //! Count of children pointers that each tree node needs.
   static unsigned const smc_cBitPermutationsPerLevel = 1 << smc_cBitsPerLevel;
   static unsigned const smc_iTreeAnchorLevel =
      sizeof(std::uintmax_t /*TODO: TKey*/) * CHAR_BIT / smc_cBitsPerLevel - 1;

protected:
   /*! Abstract node. Defined to avoid using void * in code where pointers’ type change depending on
   the level in the tree. */
   class node {
   };

   //! Stores a single value, as well as the doubly-linked list’s links.
   class list_node : public node {
   public:
      //! Constructor.
      list_node() :
{'fraction_non_alphanumeric': 0.14765657403566984, 'fraction_numerical': 0.004562422231439237, 'mean_word_length': 2.8522364217252396, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1463355', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1316, 'n_words': 525}