<commit_before>/**
 * FILE : general/refhandle.hpp
 * 
 * Simple intrusive smart pointer template for classes derived from
 * cmzn::RefCounted, supporting access/deaccess methods.
 */
/* OpenCMISS-Zinc Library
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#if !defined (CMZN_GENERAL_REFHANDLE_HPP)
#define CMZN_GENERAL_REFHANDLE_HPP

#include "general/refcounted.hpp"

namespace cmzn
{

template <typename T> class RefHandle
{
	template<typename T>
		friend T* GetImpl(const RefHandle<T>& refHandle);

private:
	T* object;

public:
	RefHandle() :
		object(0)
	{
	}

	// take ownership of reference; assumes created with access count of 1
	explicit RefHandle(T* objectIn) :
		object(objectIn)
	{
	}

	RefHandle(const RefHandle<T>& refHandleIn) :
		object(cmzn::Access(refHandleIn.object))
	{
	}

	~RefHandle()
	{
		cmzn::Deaccess(this->object);
	}

	RefHandle<T>& operator=(const RefHandle<T>& refHandleIn)
	{
		cmzn::Reaccess(this->object, refHandleIn.object);
		return *this;
	}

	T& operator*()
	{
		return *this->object;
	}

	T* operator->()
	{
		return this->object;
	}

	operator bool()
	{
		return (this->object != 0);
	}
};

template<typename T> inline T* GetImpl(const RefHandle<T>& refHandle)
{
	return refHandle.object;
}

}

#endif /* !defined (CMZN_GENERAL_REFHANDLE_HPP) */
<commit_msg>Remove shadowing of template parameter in friend declaration for smart pointer GetImpl function. https://tracker.physiomeproject.org/show_bug.cgi?id=1496<commit_after>/**
 * FILE : general/refhandle.hpp
 * 
 * Simple intrusive smart pointer template for classes derived from
 * cmzn::RefCounted, supporting access/deaccess methods.
 */
/* OpenCMISS-Zinc Library
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#if !defined (CMZN_GENERAL_REFHANDLE_HPP)
#define CMZN_GENERAL_REFHANDLE_HPP

#include "general/refcounted.hpp"

namespace cmzn
{

template <typename T> class RefHandle
{
	template<typename POINTEE>
		friend POINTEE* GetImpl(const RefHandle<POINTEE>& refHandle);

private:
	T* object;

public:
	RefHandle() :
		object(0)
	{
	}

	// take ownership of reference; assumes created with access count of 1
	explicit RefHandle(T* objectIn) :
		object(objectIn)
	{
	}

	RefHandle(const RefHandle<T>& refHandleIn) :
		object(cmzn::Access(refHandleIn.object))
	{
	}

	~RefHandle()
	{
		cmzn::Deaccess(this->object);
	}

	RefHandle<T>& operator=(const RefHandle<T>& refHandleIn)
	{
		cmzn::Reaccess(this->object, refHandleIn.object);
		return *this;
	}

	T& operator*()
	{
		return *this->object;
	}

	T* operator->()
	{
		return this->object;
	}

	operator bool()
	{
		return (this->object != 0);
	}
};

template<typename POINTEE> inline POINTEE* GetImpl(const RefHandle<POINTEE>& refHandle)
{
	return refHandle.object;
}

}

#endif /* !defined (CMZN_GENERAL_REFHANDLE_HPP) */

{'fraction_non_alphanumeric': 0.12677878395860284, 'fraction_numerical': 0.005821474773609315, 'mean_word_length': 4.341968911917099, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 31, 'https://': 1, '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': '5303863', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1087, 'n_words': 279}