#ifndef _PARAMETER_H_
#define _PARAMETER_H_
#ifdef __cplusplus
	extern "C" {
#endif

typedef enum ParameterType_TAG {
	TYPE_BOOLEAN,
	TYPE_DOUBLE,
	TYPE_INTEGER
} ParameterType;

typedef struct DoubleRange_TAG {
	double value;
	double min;
	double max;
	double step;
} DoubleRange;

typedef struct IntegerRange_TAG {
	int value;
	int min;
	int max;
	int step;
} IntegerRange;


typedef struct input_tag {
	ParameterType type;
	union Range_Tag {
		DoubleRange drange;
		IntegerRange irange;
	} range;
	char *name;
	int isVisible;
	//char *readable;
	//printFunctor print_string;
} Parameter;

#define DPAR(X) (in[(X)].range.drange.value)
#define IPAR(X) (in[(X)].range.irange.value)

#define FILL_UNION(X, numV, valueV, minV, maxV, stepV) \
	numV.range.X.value = valueV; \
	numV.range.X.min = minV; 	\
	numV.range.X.max = maxV; 	\
	numV.range.X.step = stepV;

#define FILL_COMMON(numV, nameV)  \
	numV.name = nameV;			  \
	numV.isVisible = 1;



#define INIT_D_PARAM(numV, valueV, minV, maxV, stepV, nameV)  \
	numV.type = TYPE_DOUBLE;						\
	FILL_UNION(drange, numV, valueV, minV, maxV, stepV) \
	FILL_COMMON(numV, nameV);

#define INIT_B_PARAM(numV, valueV, minV, maxV, stepV, nameV)  \
	numV.type = TYPE_BOOLEAN;	    \
	FILL_UNION(irange, numV, valueV, minV, maxV, stepV) \
	FILL_COMMON(numV, nameV);

#define INIT_I_PARAM(numV, valueV, minV, maxV, stepV, nameV)  \
	numV.type = TYPE_INTEGER;		  \
	FILL_UNION(irange, numV, valueV, minV, maxV, stepV) \
	FILL_COMMON(numV, nameV);

void printParameter(Parameter *in, char* buffer, int length);
void addToParamter (Parameter *in, int steps);

#ifdef __cplusplus
	} // 	extern "C"
#endif
#endif
