<commit_before>#pragma once
#include "common.hpp"


namespace rack {


struct ParamQuantity;


struct ParamQuantityFactory {
	virtual ~ParamQuantityFactory() {}
	virtual ParamQuantity *create() = 0;
};


struct ParamInfo {
	// For formatting/displaying the value
	/** Set to 0 for linear, nonzero for exponential */
	std::string label;
	std::string unit;
	float displayBase = 0.f;
	float displayMultiplier = 1.f;
	std::string description;
	ParamQuantityFactory *paramQuantityFactory = NULL;

	~ParamInfo() {
		delete paramQuantityFactory;
	}

	template<class TParamQuantity = ParamQuantity>
	void config(std::string label = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f) {
		this->label = label;
		this->unit = unit;
		this->displayBase = displayBase;
		this->displayMultiplier = displayMultiplier;

		struct TParamQuantityFactory : ParamQuantityFactory {
			ParamQuantity *create() override {return new TParamQuantity;}
		};
		if (paramQuantityFactory)
			delete paramQuantityFactory;
		paramQuantityFactory = new TParamQuantityFactory;
	}
};


} // namespace rack<commit_msg>Don't delete NULL in ParamInfo::~ParamInfo<commit_after>#pragma once
#include "common.hpp"


namespace rack {


struct ParamQuantity;


struct ParamQuantityFactory {
	virtual ~ParamQuantityFactory() {}
	virtual ParamQuantity *create() = 0;
};


struct ParamInfo {
	// For formatting/displaying the value
	/** Set to 0 for linear, nonzero for exponential */
	std::string label;
	std::string unit;
	float displayBase = 0.f;
	float displayMultiplier = 1.f;
	std::string description;
	ParamQuantityFactory *paramQuantityFactory = NULL;

	~ParamInfo() {
		if (paramQuantityFactory)
			delete paramQuantityFactory;
	}

	template<class TParamQuantity = ParamQuantity>
	void config(std::string label = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f) {
		this->label = label;
		this->unit = unit;
		this->displayBase = displayBase;
		this->displayMultiplier = displayMultiplier;

		struct TParamQuantityFactory : ParamQuantityFactory {
			ParamQuantity *create() override {return new TParamQuantity;}
		};
		if (paramQuantityFactory)
			delete paramQuantityFactory;
		paramQuantityFactory = new TParamQuantityFactory;
	}
};


} // namespace rack
{'fraction_non_alphanumeric': 0.10507880910683012, 'fraction_numerical': 0.005253940455341506, 'mean_word_length': 4.889175257731959, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '747843', 'n_tokens_mistral': 740, 'n_tokens_neox': 663, 'n_words': 181}