Blame view

src/TimeTableCatalog/AbstractReader.cc 688 Bytes
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
/*
 * 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 */