<commit_before>// $Id: embeddable.C,v 1.7 2001/05/17 01:30:49 oliver Exp $

#include <BALL/CONCEPT/embeddable.h>

using namespace std;

namespace BALL
{
	Embeddable::Embeddable(const String& identifier)
		throw()
		:	identifier_(identifier)
	{
	}
	
	Embeddable::Embeddable(const Embeddable& embeddable)
		throw()
		:	identifier_(embeddable.identifier_)
	{
	}
	
	Embeddable::~Embeddable()
		throw()
	{
		// make sure destructed instances are securely unregistered
		unregisterInstance_(this);
		identifier_ = "<destructed>";
	}

	const String& Embeddable::getIdentifier() const
		throw()
	{
		return identifier_;
	}

	void Embeddable::setIdentifier(const String& identifier)
		throw()
	{
		identifier_ = identifier;
	}

	void Embeddable::registerThis() 
		throw()
	{
	}

	void Embeddable::unregisterThis() 
		throw()
	{
		Embeddable::unregisterInstance_(this);
	}

	// protected:

	void Embeddable::registerInstance_(const type_info& type, Embeddable* instance) 
		throw()
	{
		// retrieve the class name
		const char* class_id_string = type.name();

		if (!instance_to_type_map_.has(instance))
		{
			// this is fact a new registration
			if (!instance_lists_.has(class_id_string))
			{
				// create a new list for instances of this type
				instance_lists_.insert(class_id_string, EmbeddableList());
			}
			// store the pointer to the instance in the instance list...
			instance_lists_[class_id_string].push_back(instance);
			
			// ...and in the hash map for fast retrieval of the class id string
			instance_to_type_map_.insert(pair<Embeddable*, string>(instance, class_id_string));
		}
		else 
		{
			Log.warn() << "Embeddable::registerInstance_: trying to register an already registered instance at " 
								 << instance << " (type = " << class_id_string << ")" << endl;
		}<commit_msg>cosmetic changes<commit_after>// $Id: embeddable.C,v 1.8 2001/06/05 15:49:20 anker Exp $

#include <BALL/CONCEPT/embeddable.h>

using namespace std;

namespace BALL
{
	Embeddable::Embeddable(const String& identifier)
		throw()
		:	identifier_(identifier)
	{
	}
	
	Embeddable::Embeddable(const Embeddable& embeddable)
		throw()
		:	identifier_(embeddable.identifier_)
	{
	}
	
	Embeddable::~Embeddable()
		throw()
	{
		// make sure destructed instances are securely unregistered
		unregisterInstance_(this);
		identifier_ = "<destructed>";
	}

	const String& Embeddable::getIdentifier() const
		throw()
	{
		return identifier_;
	}

	void Embeddable::setIdentifier(const String& identifier)
		throw()
	{
		identifier_ = identifier;
	}

	void Embeddable::registerThis() 
		throw()
	{
	}

	void Embeddable::unregisterThis() 
		throw()
	{
		Embeddable::unregisterInstance_(this);
	}

	// protected:

	void Embeddable::registerInstance_(const type_info& type,
			Embeddable* instance) 
		throw()
	{
		// retrieve the class name
		const char* class_id_string = type.name();

		if (!instance_to_type_map_.has(instance))
		{
			// this is fact a new registration
			if (!instance_lists_.has(class_id_string))
			{
				// create a new list for instances of this type
				instance_lists_.insert(class_id_string, EmbeddableList());
			}
			// store the pointer to the instance in the instance list...
			instance_lists_[class_id_string].push_back(instance);
			
			// ...and in the hash map for fast retrieval of the class id string
			instance_to_type_map_.insert(pair<Embeddable*, string>(instance, class_id_string));
		}
		else 
		{
			Log.warn() << "Embeddable::registerInstance_: "
				<< "trying to register an already registered instance at " 
				<< instance << " (type = " << class_id_string << ")" << endl;
		}
{'fraction_non_alphanumeric': 0.12042175360710322, 'fraction_numerical': 0.008879023307436182, 'mean_word_length': 3.9930747922437675, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 9, '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': '1332914', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1180, 'n_words': 275}