PTScriptParsing.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00025 #ifndef _PANODATA_PTSCRIPTPARSING_H
00026 #define _PANODATA_PTSCRIPTPARSING_H
00027 
00028 #include <hugin_shared.h>
00029 #include <string>
00030 #include <vigra/diff2d.hxx>
00031 
00032 #include <panodata/PanoramaVariable.h>
00033 
00034 
00035 
00036 namespace HuginBase {
00037 namespace PTScriptParsing {
00038 
00039         
00041     IMPEX bool getPTParam(std::string & output, const std::string & line, const std::string & parameter);
00042 
00043 //  template <class T>
00044 //  bool getParam(T & value, const std::string & line, const std::string & name);
00045 
00047     template <class T>
00048     bool getIntParam(T & value, const std::string & line, const std::string & name);
00049     
00050 
00051     bool readVar(Variable & var, int & link, const std::string & line);
00052 /*
00053     bool getPTStringParam(std::string & output, const std::string & line,
00054                           const std::string & parameter);
00055 
00056     bool getPTStringParamColon(std::string & output, const std::string & line, const std::string & parameter);
00057 */
00058 
00059     bool getDoubleParam(double & d, const std::string & line, const std::string & name);
00060 
00061     bool getPTDoubleParam(double & value, int & link,
00062                           const std::string & line, const std::string & var);
00064     struct ImgInfo
00065     {        
00066         std::string filename;
00067         std::string flatfieldname;
00068         std::map<std::string, double> vars;
00069         std::map<std::string, int> links;
00070         int f;
00071         // int blend_radius;
00072         int width, height;
00073         int vigcorrMode;
00074         int responseType;
00075         vigra::Rect2D crop;
00076         bool autoCenterCrop;
00077         double cropFactor;
00078         bool enabled;
00079 
00080 
00081     public:
00082         ImgInfo()
00083         {
00084             init();
00085         }
00086 
00087         ImgInfo(const std::string & line)
00088         {
00089             init();
00090             this->parse(line);
00091         }
00092 
00093     protected:
00094         void init();
00095 
00096     public:
00097         void parse(const std::string & line);
00098 
00099     public:
00100         static const char *varnames[];
00101         static double defaultValues[];
00102 
00103     };
00104 
00105 
00106 //==============================================================================
00107 // template implementation
00108     
00109     
00110 #if 0
00111     template <class T>
00112     bool getParam(T & value, const std::string & line, const std::string & name)
00113     {
00114             std::string s;
00115             if (!getPTParam(s, line, name)) {
00116                 return false;
00117             }
00118             std::istringstream is(s);
00119             is >> value;
00120             return true;
00121     }
00122 #endif
00123     
00124     template <class T>
00125     bool getIntParam(T & value, const std::string & line, const std::string & name)
00126     {
00127             std::string s;
00128             if (!getPTParam(s, line, name)) {
00129                 return false;
00130             }
00131             std::istringstream is(s);
00132             is >> value;
00133             return true;
00134     }
00135     
00136 } // namespace
00137 } // namespace
00138 #endif //_H

Generated on Thu Aug 21 01:25:40 2014 for Hugintrunk by  doxygen 1.3.9.1