/*
 * inputValue.hpp
 *
 *  Created on: Jul 18, 2017
 *      Author: vadims
 */

#ifndef INPUTVALUE_HPP_
#define INPUTVALUE_HPP_

#include <fstream>
#include "nlohmann/json.hpp"
using json = nlohmann::json;

class InputValue
{
public:
	enum valueType {
		SCALAR = 0,
		TABLE = 1,
		EXPRESSION = 3,
		COMPLEX = 4,
		VECTOR = 5,
		TENSOR = 6,
		STRING = 7,
		BOOLEAN = 8,
		INTEGER = 9

	};
private:

	valueType typeId;
	std::vector<double> value;
	double factor;
	int argumentPos;
	std::string strValue;


	static const std::map<std::string, int> classifiers;		// <key, typeId>
	void addEndValues();

public:
	InputValue() {};
	InputValue(double);
	InputValue(const InputValue&);
	InputValue& operator=( const InputValue& other ) ;
	bool operator==(const InputValue & ) const;

	void readJson(const json);									// reads from json format
	std::string getValue();										// writes value
	double getDoubleValue();
	double getDoubleValue(double);
	void setFloatValue(double);
	std::string getValueWithEnds();
	std::string getDerivativeWithEnds();
	double getMinValue();
	double getMaxValue();
	double getFactor();

	std::vector<double> getValueVector();

	valueType getTypeId();
	int getArgumentPos();
	std::pair<std::string,std::string> getFirstPair();
	bool isBoolean();
	bool isTable();

};



#endif /* INPUTVALUE_HPP_ */
