DownloadProperties.cc 3.67 KB
/*
 * DownLoadProperties.cc
 *
 *  Created on: Oct 1, 2014
 *      Author: m.mazel
 */

#include "DownloadProperties.hh"

namespace AMDA {
namespace ParamOutputImpl {
namespace Download {

DownloadProperties::DownloadProperties() :
	_timeFormat(FORMAT_OUTPUT_TIME_DOYTIME),
	_fileFormat(ASCII_FILE_FORMAT),
	_fileName(),
	_timeResolution(0),
	_outputStructure(OutputStructure::ONE_FILE_PER_INTERVAL),
	_precision(false),
	_separateInfoFile(false)

{
	// TODO Auto-generated constructor stub
}

DownloadProperties::~DownloadProperties() {
	for (auto paramProperties : _paramPropertiesList) {
		delete paramProperties;
	}
	_paramPropertiesList.clear();
	for (auto tableParamProperties : _tableParamPropertiesList) {
		delete tableParamProperties;
	}
	_tableParamPropertiesList.clear();
}

OutputFileFormat DownloadProperties::getFileFormat() const {
	return _fileFormat;
}

void DownloadProperties::setFileFormat(OutputFileFormat fileFormat) {
	_fileFormat = fileFormat;
}

const std::string& DownloadProperties::getFileName() const {
	return _fileName;
}

void DownloadProperties::setFileName(const std::string& fileName) {
	_fileName = fileName;
}

OutputStructure DownloadProperties::getOutputStructure() const {
	return _outputStructure;
}

void DownloadProperties::setOutputStructure(OutputStructure outputStructure) {
	_outputStructure = outputStructure;
}

OutputFormatTime DownloadProperties::getTimeFormat() const {
	return _timeFormat;
}

void DownloadProperties::setTimeFormat(OutputFormatTime timeFormat) {
	_timeFormat = timeFormat;
}

double DownloadProperties::getTimeResolution() const {
	return _timeResolution;
}

void DownloadProperties::setTimeResolution(double timeResolution) {
	_timeResolution = timeResolution;
}

ParamPropertiesList& DownloadProperties::getParamPropertiesList() {
	return _paramPropertiesList;
}

ParamPropertiesList& DownloadProperties::getTableParamPropertiesList() {
	return _tableParamPropertiesList;
}

ParamPropertiesList DownloadProperties::getAllParamPropertiesList(){
	ParamPropertiesList allParamPropertiesList;
	for (auto paramProperties: _paramPropertiesList){
		allParamPropertiesList.push_back(paramProperties);
	}
	for (auto tableParamProperties: _tableParamPropertiesList){
		allParamPropertiesList.push_back(tableParamProperties);
	}
	return allParamPropertiesList;
}

void DownloadProperties::addParamProperties(ParamProperties *paramProperties) {
	_paramPropertiesList.push_back (paramProperties);
}

void DownloadProperties::addTableParamProperties(ParamProperties *tableParamProperties) {
	_tableParamPropertiesList.push_back (tableParamProperties);
}

ParamProperties* DownloadProperties::getParamPropertiesFromOriginalId(std::string originalId)
{
	for (auto paramProp : _paramPropertiesList)
	{
		if (paramProp->getOriginalId() == originalId)
			return paramProp;
	}
	return NULL;
}

ParamProperties* DownloadProperties::getParamPropertiesFromOutputId(std::string outputId)
{
	for (auto paramProp : _paramPropertiesList)
	{
		if (paramProp->getOutputId() == outputId)
			return paramProp;
	}
	return NULL;
}

ParamProperties* DownloadProperties::getTableParamPropertiesFromOutputId(std::string outputId)
{
	for (auto paramProp : _tableParamPropertiesList)
	{
		if (paramProp->getOutputId() == outputId)
			return paramProp;
	}
	return NULL;
}

bool DownloadProperties::getPrecision(void) const {
	return _precision;
}

void DownloadProperties::setPrecision(bool precision)
{
	_precision = precision;
}


bool DownloadProperties::getSeparateInfoFile(void) const {
        return _separateInfoFile;
}

void DownloadProperties::setSeparateInfoFile(bool separateInfoFile)
{
        _separateInfoFile = separateInfoFile;
}



} // namespace Download
} // namespace ParamOutputImpl
} // namespace AMDA