<commit_before>// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SURGSIM_PHYSICS_PHYSICSMANAGER_INL_H
#define SURGSIM_PHYSICS_PHYSICSMANAGER_INL_H

template<class T>
std::shared_ptr<T> PhysicsManager::doAddComponent(std::shared_ptr<SurgSim::Framework::Component> component, std::vector<std::shared_ptr<T>>* container)
{
	std::shared_ptr<T> typedComponent = std::dynamic_pointer_cast<T>(component);
	if (typedComponent != nullptr)
	{
		auto found = std::find(container->cbegin(), container->cend(), typedComponent);
		if (found == container->cend())
		{
			container->push_back(typedComponent);
		}
		else
		{
			SURGSIM_LOG_INFO(m_logger) << __FUNCTION__ << " component " << component->getName() << 
				"already added to " << getName();
			typedComponent = nullptr;
		}
	}
	return typedComponent;
};

template<class T>
bool PhysicsManager::doRemoveComponent(std::shared_ptr<SurgSim::Framework::Component> component, std::vector<std::shared_ptr<T>>* container)
{
	bool result = false;
	std::shared_ptr<T> typedComponent = std::dynamic_pointer_cast<T>(component);
	if (typedComponent != nullptr && container->size() != 0)
	{
		auto found = std::find(container->begin(), container->end(), typedComponent);
		if (found != container->end())
		{
			container->erase(found);
			SURGSIM_LOG_DEBUG(m_logger) << __FUNCTION__ << " Removed component " << typedComponent->getName();
			result = true;
		}
		else
		{
			SURGSIM_LOG_INFO(m_logger) << __FUNCTION__ << " Unable to remove component " << typedComponent->getName()
				<< ". Not found.";
		}
	}
	return result;
};

#endif

<commit_msg>Add space after component name when logging a duplicate in PhysicsManager.<commit_after>// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SURGSIM_PHYSICS_PHYSICSMANAGER_INL_H
#define SURGSIM_PHYSICS_PHYSICSMANAGER_INL_H

template<class T>
std::shared_ptr<T> PhysicsManager::doAddComponent(std::shared_ptr<SurgSim::Framework::Component> component, std::vector<std::shared_ptr<T>>* container)
{
	std::shared_ptr<T> typedComponent = std::dynamic_pointer_cast<T>(component);
	if (typedComponent != nullptr)
	{
		auto found = std::find(container->cbegin(), container->cend(), typedComponent);
		if (found == container->cend())
		{
			container->push_back(typedComponent);
		}
		else
		{
			SURGSIM_LOG_INFO(m_logger) << __FUNCTION__ << " component " << component->getName() << 
				" already added to " << getName();
			typedComponent = nullptr;
		}
	}
	return typedComponent;
};

template<class T>
bool PhysicsManager::doRemoveComponent(std::shared_ptr<SurgSim::Framework::Component> component, std::vector<std::shared_ptr<T>>* container)
{
	bool result = false;
	std::shared_ptr<T> typedComponent = std::dynamic_pointer_cast<T>(component);
	if (typedComponent != nullptr && container->size() != 0)
	{
		auto found = std::find(container->begin(), container->end(), typedComponent);
		if (found != container->end())
		{
			container->erase(found);
			SURGSIM_LOG_DEBUG(m_logger) << __FUNCTION__ << " Removed component " << typedComponent->getName();
			result = true;
		}
		else
		{
			SURGSIM_LOG_INFO(m_logger) << __FUNCTION__ << " Unable to remove component " << typedComponent->getName()
				<< ". Not found.";
		}
	}
	return result;
};

#endif


{'fraction_non_alphanumeric': 0.13325842696629214, 'fraction_numerical': 0.004044943820224719, 'mean_word_length': 4.833551769331586, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7231399', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1348, 'n_words': 368}