// -*- c-basic-offset: 4 -*- /** @file PTScriptParsing.h * * @author Pablo d'Angelo * * $Id$ * !! Panorama.h 1947 * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _PANODATA_PTSCRIPTPARSING_H #define _PANODATA_PTSCRIPTPARSING_H #include #include #include #include namespace HuginBase { namespace PTScriptParsing { /// helper functions for parsing a script line IMPEX bool getPTParam(std::string & output, const std::string & line, const std::string & parameter); // template // bool getParam(T & value, const std::string & line, const std::string & name); /// template bool getIntParam(T & value, const std::string & line, const std::string & name); bool readVar(Variable & var, int & link, const std::string & line); /* bool getPTStringParam(std::string & output, const std::string & line, const std::string & parameter); bool getPTStringParamColon(std::string & output, const std::string & line, const std::string & parameter); */ bool getDoubleParam(double & d, const std::string & line, const std::string & name); bool getPTDoubleParam(double & value, int & link, const std::string & line, const std::string & var); /// struct ImgInfo { std::string filename; std::string flatfieldname; std::map vars; std::map links; int f; // int blend_radius; int width, height; int vigcorrMode; int responseType; vigra::Rect2D crop; bool autoCenterCrop; double cropFactor; bool enabled; public: ImgInfo() { init(); } ImgInfo(const std::string & line) { init(); this->parse(line); } protected: void init(); public: void parse(const std::string & line); public: static const char *varnames[]; static double defaultValues[]; }; //============================================================================== // template implementation #if 0 template bool getParam(T & value, const std::string & line, const std::string & name) { std::string s; if (!getPTParam(s, line, name)) { return false; } std::istringstream is(s); is >> value; return true; } #endif template bool getIntParam(T & value, const std::string & line, const std::string & name) { std::string s; if (!getPTParam(s, line, name)) { return false; } std::istringstream is(s); is >> value; return true; } } // namespace } // namespace #endif //_H