InstrumentInfo.cc 1.48 KB
/*
 * InstrumentInfo.cc
 *
 *  Created on: Oct 8, 2014
 *      Author: m.mazel
 */

#include "InstrumentInfo.hh"

namespace AMDA {
namespace Info {

std::ostream& operator<<(std::ostream& out, const InstrumentInfo& ii){

	out << "[InstrumentInfo]" << std::endl;
	out << "{"<<std::endl;
	out << "  _id              = " << ii._id << std::endl;
	out << "  _name            = " << ii._name << std::endl;
	out << "  _description     = " << ii._description << std::endl;
	out << "  _url             = " << ii._url << std::endl;
	out << "  _measurement     = " << ii._measurement << std::endl;
	out << "  _pi              = " << ii._pi << std::endl;
	out << "  _instrument_type = " << ii._instrument_type << std::endl;
	out << "  _missionId       = " << ii._missionId << std::endl;
	out << "}" << std::endl;
	return out;
}

#define PUSHINFO(infoMap, key, value) if(!value.empty())infoMap.push_back(std::pair<std::string,std::string>(key,value))

std::vector<std::pair<std::string,std::string>> InstrumentInfo::getInfoMap()
{
	std::vector<std::pair<std::string,std::string>> infoMap;

	//push all info
	PUSHINFO(infoMap, INSTRUMENT_ID, getId());
	PUSHINFO(infoMap, INSTRUMENT_NAME, getName());
	PUSHINFO(infoMap, INSTRUMENT_DESC, getDescription());
	PUSHINFO(infoMap, INSTRUMENT_URL, getUrl());
	PUSHINFO(infoMap, INSTRUMENT_MEAS, getMeasurement());
	PUSHINFO(infoMap, INSTRUMENT_PI, getPi());
	PUSHINFO(infoMap, INSTRUMENT_TYPE, getInstrumentType());

	return infoMap;
}

} /* namespace Info */
} /* namespace AMDA */