AbstractReader.cc 688 Bytes
/*
 * AbstractReader.cpp
 *
 *  Created on: 5 août 2013
 *      Author: CS
 */

#include "AbstractReader.hh"
#include <stdio.h>

namespace TimeTableCatalog {

log4cxx::LoggerPtr AbstractReader::_logger(
		log4cxx::Logger::getLogger("AMDA-Kernel.TimeTableReader"));

AbstractReader::AbstractReader(const std::string& pPath) :
		_downloadedPath(), _path(pPath) {
}

AbstractReader::~AbstractReader() {
	if (getLocalPath() != _path) {
		// delete local file
		remove(getLocalPath().c_str());
	}

}

std::string AbstractReader::getLocalPath() {
	if (_downloadedPath.empty()) {
		_downloadedPath = TimeTable::download(_path);
	}
	return _downloadedPath;
}

} /* namespace TimeTableCatalog */