/** 
* @file MultipleKernelData.cpp
* @brief caching some kernel data
* @author Erik Rodner
* @date 01/19/2010

*/
#include <iostream>

#include "MultipleKernelData.h"

using namespace std;
using namespace NICE;
using namespace OBJREC;

MultipleKernelData::MultipleKernelData ( const MultipleKernelData & src )
	: KernelData ( src )
{
	for ( vector<KernelData *>::const_iterator i = src.multipleKernelData.begin();
		i != src.multipleKernelData.end(); i++ )
		multipleKernelData.push_back ( (*i)->clone() );
}

MultipleKernelData::MultipleKernelData( const Config *conf, const Matrix & kernelMatrix, const string & section ) 
	: KernelData( conf, kernelMatrix, section )
{
}

MultipleKernelData::MultipleKernelData( const Config *conf, const string & section )
	: KernelData ( conf, section )
{
}

MultipleKernelData::~MultipleKernelData()
{
}
	
void MultipleKernelData::destroy (void)
{
	for ( vector<KernelData *>::const_iterator i = multipleKernelData.begin();
		i != multipleKernelData.end(); i++ )
		delete (*i);
	multipleKernelData.clear();
}

const KernelData* MultipleKernelData::getSingleKernelData( uint i ) const
{
	vector<KernelData *>::const_iterator it = multipleKernelData.begin();
	advance ( it, i );
	if ( it == multipleKernelData.end() )
		fthrow(Exception, "Kernel data with this index is unavailable");

	return *it;
}

MultipleKernelData *MultipleKernelData::clone(void) const
{
	MultipleKernelData *dst = new MultipleKernelData (*this);
	return dst;
}
