Open PaperOpt
OpenPaperOpt/BulkParser.h
Go to the documentation of this file.
00001 #ifndef BULKPARSER_H
00002 #define BULKPARSER_H
00003 
00004 #include <vector>
00005 #include <map>
00006 #include <string>
00007 #include <complex>
00008 #include "StructureObject.h"
00009 #include "XMLParser.h"
00010 #include "utilities.h"
00011 
00012 //Bulk includes
00013 #include "Basesheet.h"
00014 #include "Staticsheet.h"
00015 #include "StaticVolume.h"
00016 #include "HomogeneousLayer.h"
00017 
00018 
00019 //Object includes
00020 #include "FiberGenerator.h"
00021 #include "FillerGenerator.h"
00022 #include "PoreGenerator.h"
00023 #include "DistributionConstant.h"
00024 #include "DistributionElliptic.h"
00025 #include "DistributionTable.h"
00026 
00027 using namespace std;
00028 
00029 extern std::string gBinaryDirectory;
00030 
00031 namespace IO{
00032         //Methods for parsing bulk types must conform to this method signature.
00033         typedef StructureObject* (*bulkParsePtr) (XMLParser&, StructureObject*, vector<float>&, float, float);
00034         
00035         //Methods for parsing static bulk types and generating basesheets must use this signature.
00036         typedef void (*bulkGenerateParsePtr) (XMLParser&);
00037 
00047         class BulkParser
00048         {
00049         public:
00054                 BulkParser();
00055 
00059                 ~BulkParser(void);
00060 
00075                 StructureObject* parseBulk(XMLParser& rParser, string bulkType, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00076 
00077 
00085                 void parseBulkGenerate(XMLParser& rParser, string type);
00086 
00087         private:
00088                 map<string, bulkParsePtr> bulks;
00089                 map<string, bulkGenerateParsePtr> generateBulks;
00090 
00097                 bool addBulkType(string type, bulkParsePtr ptr);
00098 
00106                 bool addBulkType(string type, bulkGenerateParsePtr ptr);
00107         
00108                 /*
00109                 * Methods for parsing bulks.
00110                 *
00111                 */
00112                 //This method creates instances of Homogeneous Layer.
00113                 static StructureObject* parseHomogeneousLayer(XMLParser& rParser, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00114                 
00115                 //This method creates instances of Table Look-up layer (incident angle and wavelenght
00116                 // dependent ref and tra.
00117                 static StructureObject* parseTableLookUpLayer(XMLParser& rParser, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00118                 
00119                 //This method creates instances of prefect diffusing layer layer (wavelenght
00120                 // dependent ref)
00121                 static StructureObject* parsePerfectDiffuserLayer(XMLParser& rParser, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00122                 
00123 
00124                 //This method creates instances of thin Film
00125                 static StructureObject* parseThinFilm(XMLParser& rParser, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00126                 
00127 
00128                 //This method creates instances of Basesheet
00129                 static StructureObject* parseBasesheet(XMLParser& rParser, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00130                 
00131                 //This method creates instances of StaticVolume.
00132                 static StructureObject* parseStaticBasesheet(XMLParser& rParser, StructureObject* pPrevStructureObject, vector<float>& rLambda, float xmax, float ymax);
00133         
00134 
00135                 /*
00136                 * Methods for parsing bulks and generating static basesheets which are then saved to file.
00137                 */
00138                 static void parseStaticFixed(XMLParser& rParser);
00139 
00140                 /*
00141                 * Object element parsers should go here.
00142                 *
00143                 */
00144 
00145                 //This method creates instances of FiberGenerator.
00146                 static FiberGenerator* parseFiber(XMLParser& rParser, vector<float>& rLambda);
00147 
00148                 //This method creates instances of FillerGenerator.
00149                 static FillerGenerator* parseFiller(XMLParser& rParser, vector<float>& rLambda);
00150 
00161                 static PoreGenerator* parsePore(XMLParser& rParser, vector<float>& rLambda, Distribution** pSize, Distribution** pEllip, float* pPoreContactReduction);
00162         };
00163 }
00164 #endif //BulkParser