#ifndef FILE_LOADER_STORAGE_CODE_H
#define FILE_LOADER_STORAGE_CODE_H

#include "factory_storage.h"

namespace cbk
{
	namespace factory
	{
		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>::_Storage(const nameType& name, paramType param) : item(name, param)
		{
			usage = 0;
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>& _Storage<itemType, paramType, nameType>::operator++()
		{
			usage++;
			return *this;
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>& _Storage<itemType, paramType, nameType>::operator--()
		{
			usage--;
			return *this;
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>& _Storage<itemType, paramType, nameType>::operator++(int)
		{
			usage++;
			return *this;
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>& _Storage<itemType, paramType, nameType>::operator--(int)
		{
			usage--;
			return *this;			
		}

		template<class itemType, class paramType, class nameType>
		inline itemType& _Storage<itemType, paramType, nameType>::operator*(void)
		{
			return item;
		}

		template<class itemType, class paramType, class nameType>
		inline itemType* _Storage<itemType, paramType, nameType>::operator->(void)
		{
			return (&item);
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>::~_Storage()
		{
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>::operator int()
		{
			return usage;
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>::operator itemType&()
		{
			return item;
		}

		template<class itemType, class paramType, class nameType>
		inline _Storage<itemType, paramType, nameType>::operator itemType*()
		{
			return &item;
		}
	}
}

#endif //FILE_LOADER_STORAGE_CODE_H