InternalXMLReader.hh 2.14 KB
/*
 * InternalXMLReader.hh
 *
 *  Created on: 6 août 2013
 *      Author: CS
 */

#ifndef INTERNALXMLREADER_HH_
#define INTERNALXMLREADER_HH_

#include "XMLReader.hh"

namespace TimeTableCatalog {

/**
 * Reads a TimeTable from an InternalXML formated file.
 * Something like :
 *  <?xml version="1.0" encoding="UTF-8"?>
 *  <timetable>
 *    <name>FTE_c3</name>
 *    <created>2013-07-14T09:09:32</created>
 *    <description>Uploaded Time Table
 *    Time Table generated by AMDA @ CDPP;Description: FTE list from Cluster 3 data. From \"A new multivariate time series data analysis technique: Automated detection of flux transfer events using Cluster data\" by Karimabadi et al., JOURNAL OF GEOPHYSICAL RESEARCH, VOL. 114, A06216, doi:10.1029/2009JA014202, 2009 http://www.agu.org/journals/ja/ja0906/2009JA014202/The list is available as Auxiliary material \"Data Set S3\"Transformation into AMDA Time Table by V. Genot, CESR, Toulouse, France 29/06/2009 : - millisec have been omitted - the original event corresponds to the StartTime of the Time Table - if StopTime-StartTime = 1 sec then the event is a magnetosheath FTE - if StopTime-StartTime = 2 sec then the event is a magnetospheric FTE;Source: Upload Time Table;Creation Date :  2009-07-01 17:16:46 shared by Vincent Genot on 2009-11-24 18:52:50;</description>
 *    <history>created from another TT</history>
 *    <nbIntervals>738</nbIntervals>
 *    <intervals>
 *      <start>2001-02-02T16:27:12</start>
 *      <stop>2001-02-02T16:27:13</stop>
 *    </intervals>
 *    <!--[...]-->
 *  </timetable>
 *
 */
class InternalXMLReader: public TimeTableCatalog::XMLReader {
public:

	static const std::string FORMAT;

	InternalXMLReader(const std::string& pPath);
	virtual ~InternalXMLReader();

	/**
	 * Creates an instance of this.
	 */
	std::unique_ptr<AbstractReader> createInstance(const std::string& pPath);

	/**
	 * Gets the first xml node of the tt in this XML format.
	 */
	std::string getFirstNode();

private:

	/**
	 * Processes each interested node of an XMl file.
	 */
	void processNode(TimeTable& pTT, xmlTextReaderPtr reader, int &crtIndex);

};

} /* namespace TimeTableCatalog */
#endif /* INTERNALXMLREADER_HH_ */