AssistantMakefilelibExport.h

Go to the documentation of this file.
00001 
00008 /*  This is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU General Public
00010  *  License as published by the Free Software Foundation; either
00011  *  version 2 of the License, or (at your option) any later version.
00012  *
00013  *  This software is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  *  Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public
00019  *  License along with this software; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 #ifndef ASSISTANTMAKEFILELIBEXPORT_H_
00025 #define ASSISTANTMAKEFILELIBEXPORT_H_
00026 
00027 #include <hugin_shared.h>
00028 #include <algorithms/PanoramaAlgorithm.h>
00029 #include <panodata/PanoramaData.h>
00030 #include <iosfwd>
00031 #include <makefilelib/Manager.h>
00032 #include <makefilelib/Makefile.h>
00033 #include <makefilelib/Variable.h>
00034 #include <makefilelib/Rule.h>
00035 
00036 
00040 namespace HuginBase
00041 {
00042 
00043 class IMPEX AssistantMakefilelibExport : public PanoramaAlgorithm
00044 {
00045 public:
00046     struct AssistantPrograms
00047     {
00048         std::string icpfind;
00049         std::string celeste;
00050         std::string cpclean;
00051         std::string autooptimiser;
00052         std::string pano_modify;
00053         std::string checkpto;
00054         std::string linefind;
00055 
00056         AssistantPrograms()
00057         {
00058             // default programs
00059             icpfind="icpfind";
00060             celeste="celeste_standalone";
00061             cpclean="cpclean";
00062             autooptimiser="autooptimiser";
00063             pano_modify="pano_modify";
00064             checkpto="checkpto";
00065             linefind="linefind";
00066         };
00067     };
00068 
00069 private:
00070         PanoramaData & pano;
00071         std::ostream & makefile;
00072         const std::string& projectFile;
00073     const AssistantPrograms &progs;
00074     const bool &runLinefind;
00075     const bool &runCeleste;
00076     const double &celesteThreshold;
00077     const bool &celesteSmallRadius;
00078     const bool &runCPClean;
00079     const double &scale;
00080 
00081         makefile::Manager mgr;
00082         std::ostringstream valuestream;
00083 
00084         bool createItems();
00085     void echoInfo(makefile::Rule& inforule, const std::string& info);
00086         bool writeMakefile()
00087         {
00088                 return makefile::Makefile::getSingleton().writeMakefile(makefile) != 0;
00089         }
00090 public:
00091         AssistantMakefilelibExport(PanoramaData & pano_,
00092             const AssistantPrograms & progs_,
00093             const bool &runLinefind_,
00094             const bool &runCeleste_,
00095             const double &celesteThreshold_,
00096             const bool &celesteSmallRadius_,
00097             const bool &runCPClean_,
00098             const double &scale_,
00099             std::ostream & makefile_,
00100             const std::string& projectFile_)
00101         : PanoramaAlgorithm(pano_),
00102       pano(pano_), progs(progs_), runLinefind(runLinefind_),
00103       runCeleste(runCeleste_), celesteThreshold(celesteThreshold_), celesteSmallRadius(celesteSmallRadius_),
00104       runCPClean(runCPClean_), scale(scale_), makefile(makefile_), projectFile(projectFile_)
00105         {
00106         valuestream.imbue(makefile::GetMakefileLocale());
00107         }
00108 
00109         static void createMakefile(PanoramaData & pano_,
00110             const AssistantPrograms & progs_,
00111             const bool &runLinefind_,
00112             const bool &runCeleste_,
00113             const double &celesteThreshold_,
00114             const bool &celesteSmallRadius_,
00115             const bool &runCPClean_,
00116             const double &scale_,
00117             std::ostream & makefile_,
00118             const std::string& projectFile_)
00119         {
00120                 AssistantMakefilelibExport* instance = new AssistantMakefilelibExport(
00121                                 pano_, progs_, runLinefind_, runCeleste_, celesteThreshold_, celesteSmallRadius_,
00122                 runCPClean_, scale_, makefile_, projectFile_);
00123                 instance->createItems();
00124                 instance->writeMakefile();
00125                 delete instance;
00126         }
00127 
00128         virtual bool modifiesPanoramaData() const
00129         {
00130                 return false;
00131         }
00132         bool runAlgorithm()
00133         {
00134                 return createItems() && writeMakefile();
00135         }
00136 
00137         virtual ~AssistantMakefilelibExport()
00138         {
00139                 // TODO Auto-generated destructor stub
00140         }
00141 };
00142 
00143 };
00144 #endif

Generated on Fri Aug 29 01:25:41 2014 for Hugintrunk by  doxygen 1.3.9.1