DataSetInfo.cc 1.97 KB
/*
 * DataSetInfo.cc
 *
 *  Created on: Oct 8, 2014
 *      Author: m.mazel
 */

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

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;
}

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 */