FileWriterASCIIJson.hh 4.64 KB
/**
 * FileWriterASCIIJson.hh
 *
 *  Created on: 21 oct. 2014
 *      Author: AKKA
 */

#ifndef FILEWRITERASCIIJSON_HH_
#define FILEWRITERASCIIJSON_HH_

#include "FileWriterASCIIAbstract.hh"

namespace AMDA {
namespace ParamOutputImpl {
namespace Download {
namespace FileWriter {

using namespace AMDA::Info;

/**
 * @class FileWriterASCIIJson
 * @brief Implementation of FileWriterASCIIAbstract for JSON file format.
 * @details
 */
class FileWriterASCIIJson : public FileWriterASCIIAbstract
{
public:
	/*
	 * @brief Constructor
	 */
	FileWriterASCIIJson(AMDA::Parameters::ParameterManager& pParameterManager);

	/*
	 * @brief Destructor
	 */
	virtual ~FileWriterASCIIJson(void);

	/*
	 * @overload FileWriterASCIIAbstract::getExtension - Method to get file format extension for json format
	 */
	virtual std::string getExtension(void);

	/*
	 * @overload  FileWriterASCIIAbstract::getDataFillCharacter Method to get fill character to use for json format
	 */
	virtual std::string getDataFillCharacter(void);

	/*
	 * @overload FileWriterASCIIAbstract::getDataFillCharacter Method to get string representation of a Not A Number
	 */
	virtual std::string getNanString(void);

	/*
	 * @overload  FileWriterASCIIAbstract::writeBeginFile method to write begin file tag for json format
	 */
	virtual void writeBeginFile(void);

	/*
	 * @overload  FileWriterASCIIAbstract::writeEndFile method to write end file tag for json format
	 */
	virtual void writeEndFile(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeBeginGeneralDescription method to write begin description tag for json format
	 */
	virtual void writeBeginGeneralDescription(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeEndGeneralDescription method to write end description tag for json format
	 */
	virtual void writeEndGeneralDescription(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeErrorInfo method to write an error message for json format
	 */
	virtual void writeErrorInfo(std::string msg);

	/*
	 * @overload FileWriterASCIIAbstract::writeBeginInfoGroup method to write begin info group tag with a title for json format
	 */
	virtual void writeBeginInfoGroup(std::string title, int level);

	/*
	 * @overload FileWriterASCIIAbstract::writeEndInfoGroup method to write end info group tag with a title for json format
	 */
	virtual void writeEndInfoGroup(int level);

	/*
	 * @overload FileWriterASCIIAbstract::writeSingleInfo method to write an info designated by a key and a value for json format
	 */
	virtual void writeSingleInfo(std::string key, std::string value, int level);

	/*
	 * @overload FileWriterASCIIAbstract::writeBeginInfoList method to write begin info list tag with a title for json format
	 */
	virtual void writeBeginInfoList(std::string title, int level);

	/*
	 * @overload FileWriterASCIIAbstract::writeEndInfoList method to write end info list tag with a title for json format
	 */
	virtual void writeEndInfoList(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeBeginFieldsDescription method to write begin info fields description tag for json format
	 */
	virtual void writeBeginFieldsDescription(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeEndFieldsDescription method to write end info fields description tag for json format
	 */
	virtual void writeEndFieldsDescription(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeFieldDescription method to write a field description by parameter id for json format
	 */
	virtual void writeFieldDescription(std::string paramId);

	/*
	 * @overload FileWriterASCIIAbstract::writeBeginData method to write begin data tag for json format
	 */
	virtual void writeBeginData(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeEndData method to write end data tag for json format
	 */
	virtual void writeEndData(void);

	/*
	 * @overload FileWriterASCIIAbstract::writeDataRecord method to write a data record for json format
	 */
	virtual void writeDataRecord(std::string record);

	/*
	 * @overload FileWriterASCIIAbstract::getDataStartTag method to get data start tag for json format
	 */
	virtual std::string getDataStartTag(bool isTimeData);

	/*
	 * @overload FileWriterASCIIAbstract::getDataStopTag method to get data stop tag for json format
	 */
	virtual std::string getDataStopTag(void);

	/*
	 * @overload FileWriterASCIIAbstract::getDataValueSeparator method to get data value separator for json format
	 */
	virtual std::string getDataValueSeparator(void);

private:
	/*
	 * @brief List of boolean to know if a first element is already write in a group for json format
	 */
	std::list<bool> isFirstInfo;
};

} /* namespace FileWriter */
} /* namespace Download */
} /* namespace ParamOutputImpl */
} /* namespace AMDA */

#endif /* FILEWRITERASCIIJSON_HH_ */