<commit_before>// -------------------------------------------------------------------------
//    @FileName         :    NFMemoryCounter.hpp
//    @Author           :    LvSheng.Huang
//    @Date             :    2016-11-08
//    @Module           :    NFMemoryCounter
//
// -------------------------------------------------------------------------

#ifndef NF_COUNTER_MEMORY_HPP
#define NF_COUNTER_MEMORY_HPP

#include <iostream>
#include <string>
#include <map>
#include "NFComm/NFPluginModule/NFPlatform.h"

class NFMemoryCounter
{
public:
	virtual ~NFMemoryCounter() {}

    void AddInstance(const std::string& strClassName)
    {
        std::map<std::string, int>::iterator it = mxCounter.find(strClassName);
        if(it != mxCounter.end())
        {
            it->second++;
        }
        else
        {
            mxCounter.insert(std::map<std::string, int>::value_type(strClassName, 1));
        }
    }

	void RemInstance(const std::string& strClassName)
	{
		std::map<std::string, int>::iterator it = mxCounter.find(strClassName);
		if (it != mxCounter.end())
		{
			mxCounter.erase(it);
		}
	}

	const std::map<std::string, int>& GetCounter()
	{
		return mxCounter;
	}

private:
    static std::map<std::string, int> mxCounter;
};

#endif<commit_msg>fixed counter's bug<commit_after>// -------------------------------------------------------------------------
//    @FileName         :    NFMemoryCounter.hpp
//    @Author           :    LvSheng.Huang
//    @Date             :    2016-11-08
//    @Module           :    NFMemoryCounter
//
// -------------------------------------------------------------------------

#ifndef NF_COUNTER_MEMORY_HPP
#define NF_COUNTER_MEMORY_HPP

#include <iostream>
#include <string>
#include <map>
#include "NFComm/NFPluginModule/NFPlatform.h"

class NFMemoryCounter
{
public:
	virtual ~NFMemoryCounter() {}

    void AddInstance(const std::string& strClassName)
    {
        std::map<std::string, int>::iterator it = mxCounter.find(strClassName);
        if(it != mxCounter.end())
        {
            it->second++;
        }
        else
        {
            mxCounter.insert(std::map<std::string, int>::value_type(strClassName, 1));
        }
    }

	void RemInstance(const std::string& strClassName)
	{
		std::map<std::string, int>::iterator it = mxCounter.find(strClassName);
		if (it != mxCounter.end())
		{
			it->second--;
		}
	}

	const std::map<std::string, int>& GetCounter()
	{
		return mxCounter;
	}

protected:
    static std::map<std::string, int> mxCounter;
};

#endif
{'fraction_non_alphanumeric': 0.24557260920897284, 'fraction_numerical': 0.0070838252656434475, 'mean_word_length': 1.7660500544069642, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7298923', 'n_tokens_mistral': 813, 'n_tokens_neox': 761, 'n_words': 131}