/*
* VOTableReader.hh
*
* Created on: 7 août 2013
* Author: CS
*/
#ifndef VOTABLEREADER_HH_
#define VOTABLEREADER_HH_
#include "XMLReader.hh"
namespace TimeTableCatalog {
/**
* Reads a TimeTable from an InternalXML formated file.
* Something like :
*
*
* Time Table generated by AMDA @ CDPP;
Conditions: Solar Proton Events Affecting the Earth Environment from http://www.swpc.noaa.gov/ftpdir/indices/SPE.txt
January 1976 - July 2007
PARTICLE EVENT
Start - Maximum;
Source: Upload Time Table;
Creation Date : 2009-04-07 12:26:52;
AMDA @ CDPP
time tag for beginning of interval
time tag for end of interval
1976-04-30T21:20:00 |
1976-05-01T17:00:00 |
1977-09-19T14:30:00 |
1977-09-19T21:30:00 |
*
*/
class VOTableReader: public TimeTableCatalog::XMLReader {
public:
static const std::string FORMAT;
VOTableReader(const std::string& pPath);
virtual ~VOTableReader();
/**
* Creates an instance of this.
*/
std::unique_ptr createInstance(const std::string& pPath);
/**
* Gets the first xml node of the tt in this XML format.
*/
std::string getFirstNode();
ParameterDescription::ParameterType getTypeFromString(std::string type);
private:
/**
* Processes each interested node of an XMl file.
*/
void processNode(TimeTable& pTT, xmlTextReaderPtr reader, int &crtIndex);
/**
* Read DESCRIPTION tags
*/
void readDescription(TimeTable& pTT, xmlTextReaderPtr reader);
/**
* Read FIELD tags
*/
void readField(TimeTable& pTT, xmlTextReaderPtr reader);
/**
* Read TR/TD tags
*/
void readInterval (TimeTable& pTT, xmlTextReaderPtr reader, int pcrtIndex);
/**
* Extracts metadata from a tag text.
*/
void readMetadata(const std::string& pDescription, TimeTable& pTimeTable);
bool _readingVOTable;
bool _readingResource;
bool _readingTable;
/**
* Flag indicating we are currently reading a FIELD TAG
*/
bool _readingField;
/**
* Flag indicating we are currently reading a DESCRITPTION TAG
*/
bool _readingDescription;
/**
* Flag indicating we are currently reading a TR TAG
*/
bool _readingTr;
/**
* Flag indicating we are currently reading a TD TAG
*/
bool _readingTd;
/**
* Current TD TAG count
*/
int _tdCount;
/**
* Current FIELD TAG count
*/
int _fieldCount;
};
} /* namespace TimeTableCatalog */
#endif /* VOTABLEREADER_HH_ */