<commit_before>#ifndef ATOMS_H
#define ATOMS_H
#include<string>
#include<iostream>
#include<map>
#include<boost/shared_ptr.hpp>
#include"heaps.hpp"

class Atom {
protected:
	Atom(){};
	Atom(Atom&){};
public:
	virtual ~Atom(){};
};

class Globals;

class GlobalAtom : public Atom {
private:
	std::string utf8string;
	Generic* value;
public:
	GlobalAtom(std::string& s) : utf8string(s), value(NULL){};
	virtual ~GlobalAtom(){};
	void emit(void) const {
		std::cout << utf8string;
	};
	friend class Globals;
};

/*from (uniq)*/
class LocalAtom : public Atom {
public:
	virtual ~LocalAtom(){};
};

class Globals : public Heap {
private:
	std::map< std::string, boost::shared_ptr<Atom> > string_to_atom;
	/*insert mutex here*/
	/*The mutex must be locked for the following cases:
	1. Setting of global variables
	2. Garbage collection.  1 & 2 will probably need to be done
	   right after one another.
	3. Actual reading of variable (if variable is not in cache)
	*/
public:
	virtual void get_root_set(std::stack<Generic**>&);
	boost::shared_ptr<Atom> lookup(std::string& s){
		/*insert locking of string_to_atom table here*/
		std::map< std::string, boost::shared_ptr<Atom> >::iterator i;
		i = string_to_atom.find(s);
		if(i != string_to_atom.end()){
			std::map< std::string,
				boost::shared_ptr<Atom> >::value_type v = *i;
			return v.second;
		} else {
			boost::shared_ptr<Atom> tmp(new GlobalAtom(s));
			string_to_atom[s].swap(tmp);
			return string_to_atom[s];
		}
	}
	boost::shared_ptr<Atom> lookup(char const * s){
		std::string ss(s);
		return lookup(ss);
	}
};

#endif //ATOMS_H
<commit_msg>Added virtual destructors for heaps<commit_after>#ifndef ATOMS_H
#define ATOMS_H
#include<string>
#include<iostream>
#include<map>
#include<boost/shared_ptr.hpp>
#include"heaps.hpp"

class Atom {
protected:
	Atom(){};
	Atom(Atom&){};
public:
	virtual ~Atom(){};
};

class Globals;

class GlobalAtom : public Atom {
private:
	std::string utf8string;
	Generic* value;
public:
	GlobalAtom(std::string& s) : utf8string(s), value(NULL){};
	virtual ~GlobalAtom(){};
	void emit(void) const {
		std::cout << utf8string;
	};
	friend class Globals;
};

/*from (uniq)*/
class LocalAtom : public Atom {
public:
	virtual ~LocalAtom(){};
};

class Globals : public Heap {
private:
	std::map< std::string, boost::shared_ptr<Atom> > string_to_atom;
	/*insert mutex here*/
	/*The mutex must be locked for the following cases:
	1. Setting of global variables
	2. Garbage collection.  1 & 2 will probably need to be done
	   right after one another.
	3. Actual reading of variable (if variable is not in cache)
	*/
protected:
	virtual void get_root_set(std::stack<Generic**>&);
public:
	boost::shared_ptr<Atom> lookup(std::string& s){
		/*insert locking of string_to_atom table here*/
		std::map< std::string, boost::shared_ptr<Atom> >::iterator i;
		i = string_to_atom.find(s);
		if(i != string_to_atom.end()){
			std::map< std::string,
				boost::shared_ptr<Atom> >::value_type v = *i;
			return v.second;
		} else {
			boost::shared_ptr<Atom> tmp(new GlobalAtom(s));
			string_to_atom[s].swap(tmp);
			return string_to_atom[s];
		}
	}
	boost::shared_ptr<Atom> lookup(char const * s){
		std::string ss(s);
		return lookup(ss);
	}
	virtual ~Globals(){};
};

#endif //ATOMS_H

{'fraction_non_alphanumeric': 0.15623081645181092, 'fraction_numerical': 0.004910988336402701, 'mean_word_length': 4.91470054446461, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 31, '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': '5672939', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1222, 'n_words': 309}