/*!\file DatasetInput.c
 * \brief: implementation of the datasetinput object
 */
/*Headers{{{1*/
#ifdef HAVE_CONFIG_H
	#include <config.h>
#else
#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
#endif

#include <stdio.h>
#include <string.h>
#include "../objects.h"
#include "../../EnumDefinitions/EnumDefinitions.h"
#include "../../shared/shared.h"
#include "../../Container/Container.h"
#include "../../include/include.h"
/*}}}*/

/*DatasetInput constructors and destructor*/
/*FUNCTION DatasetInput::DatasetInput(){{{1*/
DatasetInput::DatasetInput(){
	enum_type=UNDEF;
	inputs=NULL;
}
/*}}}*/
/*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{1*/
DatasetInput::DatasetInput(int in_enum_type){

	enum_type  = in_enum_type;
	inputs     = new Inputs();
}
/*}}}*/
/*FUNCTION DatasetInput::~DatasetInput(){{{1*/
DatasetInput::~DatasetInput(){
	delete inputs;
}
/*}}}*/

/*Object virtual functions definitions:*/
		/*FUNCTION DatasetInput::Echo {{{1*/
void DatasetInput::Echo(void){
	this->DeepEcho();
}
/*}}}*/
/*FUNCTION DatasetInput::DeepEcho{{{1*/
void DatasetInput::DeepEcho(void){

	printf("DatasetInput:\n");
	printf("   enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));
	printf("---inputs: \n"); inputs->Echo();
}
/*}}}*/
/*FUNCTION DatasetInput::Id{{{1*/
int    DatasetInput::Id(void){ return -1; }
/*}}}*/
/*FUNCTION DatasetInput::MyRank{{{1*/
int    DatasetInput::MyRank(void){ 
	extern int my_rank;
	return my_rank; 
}
/*}}}*/
/*FUNCTION DatasetInput::ObjectEnum{{{1*/
int DatasetInput::ObjectEnum(void){

	return DatasetInputEnum;

}
/*}}}*/
/*FUNCTION DatasetInput::copy{{{1*/
Object* DatasetInput::copy() {
	
	DatasetInput* output=NULL;

	output = new DatasetInput();
	output->enum_type=this->enum_type;
	output->inputs=(Inputs*)this->inputs->Copy();

	return output;
}
/*}}}*/
/*FUNCTION DatasetInput::SpawnTriaInput{{{1*/
Input* DatasetInput::SpawnTriaInput(int* indices){

	/*output*/
	DatasetInput* outinput=NULL;

	/*Create new Datasetinput (copy of current input)*/
	outinput=new DatasetInput();
	outinput->enum_type=this->enum_type;
	outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);

	/*Assign output*/
	return outinput;
}
/*}}}*/
	
/*DatasetInput management*/
/*FUNCTION DatasetInput::InstanceEnum{{{1*/
int DatasetInput::InstanceEnum(void){

	return this->enum_type;

}
/*}}}*/

/*Object functions*/
/*FUNCTION DatasetInput::Configure{{{1*/
void DatasetInput::Configure(Parameters* parameters){
	/*do nothing: */
}
/*}}}*/
/*FUNCTION DatasetInput::GetInputValue(double* pvalue,GaussTria* gauss,int index){{{1*/
void DatasetInput::GetInputValue(double* pvalue,GaussTria* gauss,int index){

	/*Get requested input within dataset*/
	if(index<0 || index > inputs->Size()-1) _error_("index requested (%i) exceeds dataset size (%i)",index,inputs->Size());
	Input* input=(Input*)this->inputs->GetObjectByOffset(index);
	
	input->GetInputValue(pvalue,gauss);
}
/*}}}*/
