Blame view

src/TimeTableCatalog/AbstractWriter.hh 1.12 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * AbstractWriter.h
 *
 *  Created on: 5 août 2013
 *      Author: CS
 */

#ifndef ABSTRACTWRITER_H_
#define ABSTRACTWRITER_H_

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

namespace TimeTableCatalog {

/**
 * TimeTable writer Interface.
 */
class AbstractWriter {
public:
	AbstractWriter(const std::string& ppath, const std::string& pName = "");
	virtual ~AbstractWriter();

	/**
	 * Writes a TimeTable to a file.
	 */
	virtual std::string write(const TimeTable& ptimeTable) = 0;

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

	/**
	 * Gets the tt file expected extension, starting with .
	 */
	virtual const std::string getExtension() const = 0;

protected:

	static log4cxx::LoggerPtr logger;

	/**
	 * Gets the tt file complete path
	 */
	const std::string getFile(const TimeTable& pTT) const;

private:
	/**
	 * TT file system path.
	 */
	std::string _path;

	/**
	 * TT file name
	 */
	std::string _name;

};

} /* namespace TimeTableCatalog */
#endif /* ABSTRACTWRITER_H_ */