Blame view

src/TimeTableCatalog/AbstractReader.hh 1.17 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
/*
 * AbstractReader.h
 *
 *  Created on: 5 août 2013
 *      Author: CS
 */

#ifndef ABSTRACTREADER_H_
#define ABSTRACTREADER_H_

#include <string>
#include "TimeTable.hh"
#include "log4cxx/logger.h"
#include <memory>

namespace TimeTableCatalog {

/**
 * TimeTable reader Interface.
 */
class AbstractReader {
public:
	AbstractReader(const std::string& pPath);
	virtual ~AbstractReader();

	/**
	 * Reads a TT from a file.
	 */
	virtual void read(TimeTable& pTT) = 0;

	/**
	 * Checks the TT format to know if the reader is the good one.
	 */
	virtual bool canRead(const std::string& pPath) = 0;

	/**
	 * Creates an instance of this.
	 */
	virtual std::unique_ptr<AbstractReader> createInstance(
			const std::string& pPath) = 0;

68c29629   Benjamin Renard   Fix in TT/Catalog...
42
43
	virtual ParameterDescription::ParameterType getTypeFromString(std::string type) = 0;

fbe3c2bb   Benjamin Renard   First commit
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
protected:

	/**
	 * Logger
	 */
	static log4cxx::LoggerPtr _logger;

	std::string getLocalPath();

	const std::string& getPath() const {return _path;}

private:

	/**
	 * TT local file if _path is url as http://
	 */
	std::string _downloadedPath;
	/**
	 * TT file system path.
	 */
	std::string _path;

};

} /* namespace TimeTableCatalog */
#endif /* ABSTRACTREADER_H_ */