FileWriterCDFISTP.hh 2.84 KB
/**
 * FileWriterCDFISTP.hh
 *
 *  Created on: 28 feb. 2022
 *      Author: AKKA
 */

#ifndef FILEWRITERCDFISTP_HH_
#define FILEWRITERCDFISTP_HH_

#include "FileWriterCDF.hh"
#include "ParamMgr.hh"
#include "DataSetMgr.hh"
#include "InstrumentMgr.hh"
#include "MissionMgr.hh"
#include "cdf.h"
#include <map>

#define NB_RECORDS_BUFFER 100000

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

				using namespace AMDA::Info;

				/**
				 * @class FileWriterCDFISTP
				 * @brief Implementation of FileWriter for CDF file format compliant with ISTP.
				 * @details
				 */
				class FileWriterCDFISTP : public FileWriterCDF
				{
				public:

					/*
					* @brief Constructor
					*/
					FileWriterCDFISTP(AMDA::Parameters::ParameterManager& pParameterManager);

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

					/*
					 * @overload FileWriter::addParameter - Add an output parameter in CDF file
					 */
					//virtual bool addParameter(ParamProperties *paramProp, AMDA::Common::ParameterIndexComponentList &indexList,
					//						  FileDataType type, bool isFirstParam, int dim1Size = 1, int dim2Size = 1, bool isTableParam = false);


					bool writeTableParamsInfo(std::map<int, boost::shared_ptr<ParamTable>> &dependTables,std::string currentParamId);
					bool writeAMDAInfo(std::string version, std::string createdby, std::string acknowledgement);
					bool writeRequestInfo(std::string structure, std::string timeFormat,
													 int timeResolution, std::string outputParams, std::string ttName);

					bool writeParamsInfo(ParamPropertiesList &paramPropertiesList, OutputStructure outputStructure,
													std::string currentParamId);

					void addInfoInMap(std::string key, std::string value);

					void writeParamVariableAttributes(ParamInfoSPtr ParamInfo, std::string paramId);

					void writeTimeInfo();

				protected:

					//bool addCDFParameter(std::string outputId, AMDA::Common::ParameterIndexComponentList &indexList,
					//					 FileDataType type, int dim1Size, int dim2Size, bool isTableParam);
					
					//bool writeMissionInfo(MissionInfoSPtr missionInfo, long varNum);

					/*
					 * @brief Write instrument info attributes in the CDF file
					 */
					//bool writeInstrumentInfo(InstrumentInfoSPtr instrumentInfo, long varNum);

					/*
					 * @brief Write dataset info attributes in the CDF file
					 */
					//bool writeDatasetInfo(DataSetInfoSPtr datasetInfo, long varNum);

					/*
					 * @brief Write parameter info attributes in the CDF file
					 */
					//bool writeParameterInfo(ParamInfoSPtr parameterInfo, long varNum);

				private:
					std::vector<std::pair<std::string, std::string>> _infoMap;
				};

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

#endif /* FILEWRITERCDFISTP_HH_ */