ParameterDescription.hh 4.28 KB
/*
 * ParameterDescription.hh
 *
 *  Created on: 5 nov 2014
 *      Author: AKKA
 */

#ifndef PARAMETERDESCRIPTION_H_
#define PARAMETERDESCRIPTION_H_

#include <iostream>
#include <string>
#include <vector>

namespace TimeTableCatalog {

/**
 * Catalog definition.
 */
class ParameterDescription {
public:
	enum class ParameterType{
		Unknown = 0,
		Integer,
		Double,
		String
	} ;

	ParameterDescription () :
		_id(""),
		_name(""),
		_size("1"),
		_type(ParameterType::Integer),
		_unit(""),
		_description(""),
		_ucd(""),
		_utype("")
	{
	}

	ParameterDescription (
			const std::string &id,
			const std::string &name,
			const std::string &size,
			ParameterType type,
			const std::string &unit,
			const std::string &description,
			const std::string &ucd,
			const std::string &utype
			) :
			_id(id),
			_name(name),
			_size(size),
			_type(type),
			_unit(unit),
			_description(description),
			_ucd(ucd),
			_utype(utype)
	{
	}

	ParameterDescription (
			const std::string &id,
			const std::string &name,
			const std::string &size,
			const std::string &type,
			const std::string &units,
			const std::string &description,
			const std::string &ucd,
			const std::string &utype
			) :
			_id(id),
			_name(name),
			_size(size),
			_unit(units),
			_description(description),
			_ucd(ucd),
			_utype(utype)
	{
		setTypeAsString(type);
	}

	/**
	 * Parameter id getter
	 */
	const std::string& getId() const {
		return _id;
	}

	/**
	 * Parameter id setter
	 */
	void setId(const std::string& id) {
		_id = id;
	}

	/**
	 * Parameter name getter
	 */
	const std::string& getName() const {
		return _name;
	}

	/**
	 * Parameter name setter
	 */
	void setName(const std::string& name) {
		_name = name;
	}

	/**
	 * Parameter size getter
	 */
	const std::string& getSize() const {
		return _size;
	}

	/**
	 * Parameter size getter
	 */
	int getSizeAsInt();

	/**
	 * Parameter size setter
	 */
	void setSize(const std::string& size) {
		_size = size;
	}

	/**
	 * Parameter type getter
	 */
	ParameterType getType() const {
		return _type;
	}

	/**
	 * Parameter type setter
	 */
	void setType(ParameterType type) {
		_type = type;
	}

	/**
	 * Parameter type (as string) getter
	 */
	std::string getTypeAsString() const {
		if (_type == ParameterType::Integer)
			return ("Integer");
		else if (_type == ParameterType::Double)
			return ("Double");
		else if (_type == ParameterType::String)
			return ("String");
		else
			return ("Unknown");
	}

	/**
	 * Parameter type (as string) setter
	 */
	void setTypeAsString(const std::string & typeAsString) {
		if (typeAsString == "Integer")
			_type = ParameterType::Integer;
		else if (typeAsString == "Double")
			_type = ParameterType::Double;
		else if (typeAsString == "String")
			_type = ParameterType::String;
		else
			_type = ParameterType::Unknown;
	}

	/**
	 * Parameter units getter
	 */
	const std::string& getUnit() const {
		return _unit;
	}

	/**
	 * Parameter units setter
	 */
	void setUnit(const std::string& units) {
		_unit = units;
	}

	/**
	 * Parameter description getter
	 */
	const std::string& getDescription() const {
		return _description;
	}

	/**
	 * Parameter description setter
	 */
	void setDescription(const std::string& description) {
		_description = description;
	}

	/**
	 * Parameter ucd getter
	 */
	const std::string& getUcd() const {
		return _ucd;
	}

	/**
	 * Parameter ucd setter
	 */
	void setUcd(const std::string& ucd) {
		_ucd = ucd;
	}

	/**
	 * Parameter utype getter
	 */
	const std::string& getUtype() const {
		return _utype;
	}

	/**
	 * Parameter utype setter
	 */
	void setUtype(const std::string& utype) {
		_utype = utype;
	}

private:

	/**
	 * Parameter (expected) unique id
	 */
	std::string	_id;

	/**
	 * Parameter name
	 */
	std::string	_name;

	/**
	 * Parameter size ("1"=scalar, "N"=N values array, "NxM"=N x M matrix)
	 */
	std::string	_size;

	/**
	 * Parameter type ("1"=scalar, "2"=vector, "NxM"=N x M matrix)
	 */
	ParameterType	_type;

	/**
	 * Parameter units
	 */
	std::string	_unit;

	/**
	 * Parameter description
	 */
	std::string	_description;

	/**
	 * Parameter unified content descriptor
	 */
	std::string	_ucd;

	/**
	 * Parameter utype (VOTable definition)
	 */
	std::string	_utype;

};

typedef std::vector<ParameterDescription> ParameterDescriptionList;

} /* namespace TimeTableCatalog */
#endif /* PARAMETERDESCRIPTION_H_ */