Open PaperOpt
OpenPaperOpt/LightSourceParser.h
Go to the documentation of this file.
00001 #ifndef LIGHTSOURCEPARSER_H
00002 #define LIGHTSOURCEPARSER_H
00003 
00004 #include <vector>
00005 #include <map>
00006 #include <string>
00007 #include "LightSource.h"
00008 #include "DistributionElrepho.h"
00009 #include "DistributionV3Constant.h"
00010 #include "DistributionLambert.h"
00011 #include "DistributionDisk.h"
00012 #include "DistributionSquare.h"
00013 
00014 #include "XMLParser.h"
00015 
00016 
00017 namespace IO{
00018         typedef LightSource* (*lsParserPtr) (XMLParser&, float, float);
00019 
00026         class LightSourceParser
00027         {
00028         public:
00029                 /*
00030                 * Parses lightsources
00031                 *
00032                 */
00033                 LightSourceParser(void);
00034                 ~LightSourceParser(void);
00035 
00046                 LightSource* parse(XMLParser& rParser, std::string type, float xmax, float ymax);
00047 
00048         private:
00049                 map<string,lsParserPtr> lightsources;
00050                 
00051                 bool addLightSourceType(std::string type, lsParserPtr);
00052 
00053                 //use one function for all types.
00054                 static LightSource* parseLightSource(XMLParser& rParser, float xmax, float ymax);
00055         };
00056 }
00057 
00058 #endif