FileReaderAbstract.hh 1.71 KB
/*
 * FileReaderAbstract.hh
 *
 *  Created on: Nov 24, 2014
 *  Author: AKKA
 */

#ifndef FILEREADERABSTRACT_HH_
#define FILEREADERABSTRACT_HH_

#include "LocalParamData.hh"

#include <string>

namespace AMDA {
namespace LocalFileInterface {

/*
 * @brief Status for getParamPacketData function
 */
typedef enum
{
	//more data is needed (ie. the paket is full and must be proceed before to continue)
	FRS_MORE,
	//end of file
	FRS_EOF,
	//stop time is reached
	FRS_FINISH,
	//error detected
	FRS_ERROR
} FileReaderStatus;

/*
 * @brief Abstract class to define a FileReader
 */
class FileReaderAbstract
{
public:
	/*
	 * @brief Constructor
	 */
	FileReaderAbstract();

	/*
	 * @brief Destructor
	 */
	virtual ~FileReaderAbstract();

	/*
	 * @brief Open the file
	 */
	virtual bool open(std::string filePath) = 0;

	/*
	 * @brief Close the file
	 */
	virtual bool close(void) = 0;

	/*
	 * @brief Test if a file is currently opened
	 */
	virtual bool isOpened(void) = 0;

	/*
	 * @brief Get the id of the time param to use
	 */
	virtual std::string getTimeParamId(void) = 0;

	/*
	 * @brief Get a param type and a param size
	 */
	virtual bool getParamInfo(std::string& paramId, LocalParamType& paramType, int& dim1Size, int& dim2Size) = 0;

	/*
	 * @brief Get the index of the nearest record of time (the higher one)
	 */
	virtual int getRecordIndex(std::string& timeId, double time) = 0;

	/*
	 * @brief Get a param packet
	 */
	virtual FileReaderStatus getParamPacketData(std::string& timeId, std::string& paramId,
		int recordIndex, double stopTime, LocalParamDataPacket *packet) = 0;

	/*
	 * @brief Get an information
	 */
	virtual bool getInfo(const char* pInfoName, std::vector<double>& res) = 0;
};

} /* LocalFileInterface */
} /* AMDA */

#endif