Blame view

src/Info/InstrumentInfo.cc 1.48 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * 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 */