AbstractWriter.hh 1.12 KB
/*
 * 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_ */