Open PaperOpt
OpenPaperOpt/DetectorParser.h
Go to the documentation of this file.
00001 #ifndef DETECTORPARSER_H
00002 #define DETECTORPARSER_H
00003 
00004 #include <vector>
00005 #include <map>
00006 #include <string>
00007 #include <iostream> //for error output
00008 
00009 #include "StructureObject.h"
00010 
00011 //Detector includes.
00012 #include "Detector.h"
00013 #include "DetectorArs.h"
00014 #include "DetectorArsGlobe.h"
00015 #include "DetectorOCT.h"
00016 #include "DetectorElrepho.h"
00017 #include "DetectorImage.h"
00018 #include "DetectorWp.h"
00019 
00020 #include "XMLParser.h"
00021 
00022 namespace IO{
00023         typedef Detector* (*detParserPtr) (XMLParser&, vector<float>&, Detector*, float xmax, float ymax);
00024 
00033         class DetectorParser
00034         {
00035         public:
00036                 
00040                 DetectorParser(void);
00041 
00045                 ~DetectorParser(void);
00046         
00059                 Detector* parse(XMLParser& rParser, std::string type, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00060 
00061         private:
00062                 //This is used to associate a type of detector with a method to parse it.
00063                 map<string,detParserPtr> mDetectors;
00064                 
00065                 //This method registers a method detParserPtr to handle
00066                 //the detector with type type.
00067                 bool regDetParser(std::string type, detParserPtr);
00068 
00069                 //Detector parsing functions.
00070                 
00071                 //Creates instances of DetectorElrepho
00072                 static Detector* parseElrepho(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00073                 
00074                 static Detector* parseARSGlobe(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00075                 static Detector* parseImage(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00076                 static Detector* parseARS(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00077                 static Detector* parsePLR(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00078                 static Detector* parseWP(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00079                 static Detector* parseSCATEVENT(XMLParser& rParser, vector<float>& rLambdas, Detector* pPrevDetector, float xmax, float ymax);
00080 
00081         };
00082 }
00083 
00084 #endif