/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016 Raytrix GmbH. All rights reserved.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "Pimpl.h"
#include "Parameters.h"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// namespace: Rx.LFR
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rx
{
	namespace LFR
	{
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>
		/// 	A base of all classes that need to get or set parameters.
		/// </summary>
		///
		/// <typeparam name="TPimpl"> PIMPL. </typeparam>
		/// <typeparam name="TEnum">  The enum type that describes the parameter ID. </typeparam>
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		template<class TImpl, class TEnum, class TEnumInterface>
		class RX_API CParametersPimpl : public CPimpl<TImpl, TEnumInterface>
		{
		public:

			/// <summary> The type of the parameter enum. Is used by managed wrapper classes. </summary>
			typedef TEnum EnumType;
			typedef TEnumInterface EnumInterfaceType;

			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>
			/// 	Default constructor.
			/// </summary>
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			CParametersPimpl();

			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>
			/// 	Move constructor.
			/// </summary>
			///
			/// <param name="xParameterPimpl"> [in,out] The parameter pimpl. </param>
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			CParametersPimpl(CParametersPimpl&& xParameterPimpl);

			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>
			/// 	Constructor. Only for internal purposes.
			/// </summary>
			///
			/// <param name="pxImpl">		 [out] The implementation class. </param>
			/// <param name="bFreeOnDelete"> (Optional) True to free the memory of the given implementation class on deleting this object. </param>
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			CParametersPimpl(TImpl* pxImpl, bool bFreeOnDelete = true);

			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>
			/// 	Protected destructor.
			/// </summary>
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			~CParametersPimpl()
			{
			}

			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>
			/// 	Move assignment operator.
			/// </summary>
			///
			/// <param name="xParameterPimpl"> [in,out] The pimpl to move. Gets invalid after this call. </param>
			///
			/// <returns> This instance. </returns>
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			CParametersPimpl& operator=(CParametersPimpl<TImpl, TEnum, TEnumInterface>&& xParameterPimpl);

			CParameters<TEnum>& GetParams();
			const CParameters<TEnum>& GetParams() const;

		private:

			CParameters<TEnum> m_xParameters;
		};
	}
}
