<commit_before>// This file is part of AXL (R) Library
// Tibbo Technology Inc (C) 2004-2014. All rights reserved
// Author: <NAME>

#pragma once

#define _AXL_RTL_HASHTABLE_H

#include "axl_rtl_Array.h"
#include "axl_rtl_List.h"
#include "axl_rtl_Func.h"

namespace axl {
namespace rtl {

//.............................................................................

template <typename T>
class HashTableEntryBase: public rtl::ListLink
{
public:
	class BucketLink
	{
	public:
		rtl::ListLink*
		operator () (T* entry)
		{
			return &entry->m_bucketLink;
		}
	};

	typedef rtl::AuxList <T, BucketLink> Bucket;

	rtl::ListLink m_bucketLink;
	Bucket* m_bucket;
};

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <typename Key>
class HashTableEntry: public HashTableEntryBase <HashTableEntry <Key> >
{
public:
	Key m_key;
};

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <
	typename Key,
	typename Value
	>
class HashTableMapEntry: public HashTableEntryBase <HashTableMapEntry <Key, Value> >
{
public:
	Key m_key;
	Value m_value;
};

//.............................................................................

// too bad there are no templated typedefs in C++
// another solution would be:
//
//	template <
//		typename TKey,
//		typename TValue
//		>
//	class CHashTableMapIteratorT
//	{
//	public:
//		typedef CIteratorT <CHashTableMapEntryT <TKey, TValue> > T;
//	};
//
// but then it's too easy to forget to write ::T type suffix

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <typename Key>
class HashTableIterator: public Iterator <HashTableEntry <Key> >
{
public:
	HashTableIterator ()
	{
	}

	HashTableIterator (const Iterator <HashTableEntry <Key> >& src)
	{
		this->m_p = src.getEntry ();
	}

	HashTableIterator (Entry* p)
	{
		this->m_p = p;
	}
};

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <
	typename Key,
	typename Value
	>
class HashTableMapIterator: public Iterator <HashTableMapEntry <Key, Value> >
{
public:
	HashTableMapIterator ()
	{
	}

	HashTableMapIterator (const Iterator <HashTableMapEntry <Key, Value> >& src)
	{
		this->m_p = src.getEntry ();
	}

	HashTableMapIterator (Entry* p)
	{
		this->m_p = p;
	}
};
<commit_msg>[axl.rtl] make gcc happy about names from base template type<commit_after>// This file is part of AXL (R) Library
// Tibbo Technology Inc (C) 2004-2014. All rights reserved
// Author: <NAME>

#pragma once

#define _AXL_RTL_HASHTABLE_H

#include "axl_rtl_Array.h"
#include "axl_rtl_List.h"
#include "axl_rtl_Func.h"

namespace axl {
namespace rtl {

//.............................................................................

template <typename T>
class HashTableEntryBase: public rtl::ListLink
{
public:
	class BucketLink
	{
	public:
		rtl::ListLink*
		operator () (T* entry)
		{
			return &entry->m_bucketLink;
		}
	};

	typedef rtl::AuxList <T, BucketLink> Bucket;

	rtl::ListLink m_bucketLink;
	Bucket* m_bucket;
};

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <typename Key>
class HashTableEntry: public HashTableEntryBase <HashTableEntry <Key> >
{
public:
	Key m_key;
};

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <
	typename Key,
	typename Value
	>
class HashTableMapEntry: public HashTableEntryBase <HashTableMapEntry <Key, Value> >
{
public:
	Key m_key;
	Value m_value;
};

//.............................................................................

// too bad there are no templated typedefs in C++
// another solution would be:
//
//	template <
//		typename TKey,
//		typename TValue
//		>
//	class CHashTableMapIteratorT
//	{
//	public:
//		typedef CIteratorT <CHashTableMapEntryT <TKey, TValue> > T;
//	};
//
// but then it's too easy to forget to write ::T type suffix

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <typename Key>
class HashTableIterator: public Iterator <HashTableEntry <Key> >
{
public:
	HashTableIterator ()
	{
	}

	HashTableIterator (const Iterator <HashTableEntry <Key> >& src)
	{
		this->m_p = src.getEntry ();
	}

	HashTableIterator (HashTableEntry <Key>* p)
	{
		this->m_p = p;
	}
};

//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

template <
	typename Key,
	typename Value
	>
class HashTableMapIterator: public Iterator <HashTableMapEntry <Key, Value> >
{
public:
	HashTableMapIterator ()
	{
	}

	HashTableMapIterator (const Iterator <HashTableMapEntry <Key, Value> >& src)
	{
		this->m_p = src.getEntry ();
	}

	HashTableMapIterator (HashTableMapEntry <Key, Value>* p)
	{
		this->m_p = p;
	}
};

{'fraction_non_alphanumeric': 0.23383189382768063, 'fraction_numerical': 0.0033705498209395408, 'mean_word_length': 1.7636786961583237, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 48, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1524375', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1742, 'n_words': 370}