Blame view

src/Info/DataSetInfo.cc 1.97 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
49
50
51
52
53
54
55
56
57
58
/*
 * DataSetInfo.cc
 *
 *  Created on: Oct 8, 2014
 *      Author: m.mazel
 */

#include "DataSetInfo.hh"

namespace AMDA {
namespace Info {

std::ostream& operator<<(std::ostream& out, const DataSetInfo& dsi){

	out << "[DataSetInfo]" << std::endl;
	out << "{"<<std::endl;
	out << "  _id              = " << dsi._id << std::endl;
	out << "  _name            = " << dsi._name << std::endl;
	out << "  _description     = " << dsi._description << std::endl;
	out << "  _source          = " << dsi._source << std::endl;
	out << "  _globalStart     = " << dsi._globalStart << std::endl;
	out << "  _globalStop      = " << dsi._globalStop << std::endl;
	out << "  _minSampling     = " << dsi._minSampling << std::endl;
	out << "  _maxSampling     = " << dsi._maxSampling << std::endl;
	out << "  _caveats         = " << dsi._caveats << std::endl;
	out << "  _acknowledgement = " << dsi._acknowledgement << std::endl;
	out << "  _instrumentId    = " << dsi._instrumentId << 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>> DataSetInfo::getInfoMap()
{
	std::vector<std::pair<std::string,std::string>> infoMap;

	//push all info
	PUSHINFO(infoMap, DATASET_ID, getId());
	PUSHINFO(infoMap, DATASET_NAME, getName());
	PUSHINFO(infoMap, DATASET_DESC, getDescription());
	PUSHINFO(infoMap, DATASET_SOURCE, getSource());
	PUSHINFO(infoMap, DATASET_START, getGlobalStart());
	PUSHINFO(infoMap, DATASET_STOP, getGlobalStop());
	std::stringstream minSampling;
	minSampling << getMinSampling();
	PUSHINFO(infoMap, DATASET_MIN_SAMP, minSampling.str());
	std::stringstream maxSampling;
	maxSampling << getMaxSampling();
	PUSHINFO(infoMap, DATASET_MAX_SAMP, maxSampling.str());
	PUSHINFO(infoMap, DATASET_CAVEATS, getCaveats());
	PUSHINFO(infoMap, DATASET_ACKNOWLEDGEMENT, getAcknowledgement());

	return infoMap;
}

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