Blame view

src/Info/MissionInfo.cc 1.05 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
/*
 * MissionInfo.cc
 *
 *  Created on: Oct 8, 2014
 *      Author: m.mazel
 */

#include "MissionInfo.hh"

namespace AMDA {
namespace Info {

std::ostream& operator<<(std::ostream& out, const MissionInfo& mi){

	out << "[MissionInfo]" << std::endl;
	out << "{"<<std::endl;
	out << "  _id              = " << mi._id << std::endl;
	out << "  _name            = " << mi._name << std::endl;
	out << "  _description     = " << mi._description << std::endl;
	out << "  _url             = " << mi._url << 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>> MissionInfo::getInfoMap()
{
	std::vector<std::pair<std::string,std::string>> infoMap;

	//push all info
	PUSHINFO(infoMap, MISSION_ID, getId());
	PUSHINFO(infoMap, MISSION_NAME, getName());
	PUSHINFO(infoMap, MISSION_DESC, getDescription());
	PUSHINFO(infoMap, MISSION_URL, getUrl());

	return infoMap;
}

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