~ubuntu-branches/ubuntu/trusty/hugin/trusty-proposed

« back to all changes in this revision

Viewing changes to src/hugin_base/algorithms/assistant_makefile/AssistantMakefilelibExport.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2011-01-06 14:28:24 UTC
  • mfrom: (1.1.9 upstream) (0.1.21 experimental)
  • Revision ID: james.westby@ubuntu.com-20110106142824-zn9lxylg5z44dynn
* Drop Cyril Brulebois from Uploaders. Thank you very much for your work.
* Bump package version. (rc3 was re-released as 2010.4.0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file AssistantMakefilelibExport.h
 
3
 * @brief
 
4
 *  
 
5
 * @author Thomas Modes
 
6
 */
 
7
 
 
8
/*  This is free software; you can redistribute it and/or
 
9
 *  modify it under the terms of the GNU General Public
 
10
 *  License as published by the Free Software Foundation; either
 
11
 *  version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 *  This software is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 *  Lesser General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU General Public
 
19
 *  License along with this software; if not, write to the Free Software
 
20
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
21
 *
 
22
 */
 
23
 
 
24
#ifndef ASSISTANTMAKEFILELIBEXPORT_H_
 
25
#define ASSISTANTMAKEFILELIBEXPORT_H_
 
26
 
 
27
#include <hugin_shared.h>
 
28
#include <algorithm/PanoramaAlgorithm.h>
 
29
#include <panodata/PanoramaData.h>
 
30
#include <iosfwd>
 
31
#include <makefilelib/Manager.h>
 
32
#include <makefilelib/Makefile.h>
 
33
#include <makefilelib/Variable.h>
 
34
#include <makefilelib/Rule.h>
 
35
 
 
36
 
 
37
/**
 
38
 *
 
39
 */
 
40
namespace HuginBase
 
41
{
 
42
 
 
43
class IMPEX AssistantMakefilelibExport : public PanoramaAlgorithm
 
44
{
 
45
public:
 
46
    struct AssistantPrograms
 
47
    {
 
48
        std::string icpfind;
 
49
        std::string celeste;
 
50
        std::string cpclean;
 
51
        std::string autooptimiser;
 
52
        std::string pano_modify;
 
53
        std::string checkpto;
 
54
 
 
55
        AssistantPrograms()
 
56
        {
 
57
            // default programs
 
58
            icpfind="icpfind";
 
59
            celeste="celeste_standalone";
 
60
            cpclean="cpclean";
 
61
            autooptimiser="autooptimiser";
 
62
            pano_modify="pano_modify";
 
63
            checkpto="checkpto";
 
64
        };
 
65
    };
 
66
 
 
67
private:
 
68
        PanoramaData & pano;
 
69
        std::ostream & makefile;
 
70
        const std::string& projectFile;
 
71
    const AssistantPrograms &progs;
 
72
    const bool &runCeleste;
 
73
    const double &celesteThreshold;
 
74
    const bool &celesteSmallRadius;
 
75
    const bool &runCPClean;
 
76
    const double &scale;
 
77
 
 
78
        makefile::Manager mgr;
 
79
        std::ostringstream valuestream;
 
80
 
 
81
        bool createItems();
 
82
    void echoInfo(makefile::Rule& inforule, const std::string& info);
 
83
        bool writeMakefile()
 
84
        {
 
85
                return makefile::Makefile::getSingleton().writeMakefile(makefile) != 0;
 
86
        }
 
87
public:
 
88
        AssistantMakefilelibExport(PanoramaData & pano_,
 
89
            const AssistantPrograms & progs_,
 
90
            const bool &runCeleste_,
 
91
            const double &celesteThreshold_,
 
92
            const bool &celesteSmallRadius_,
 
93
            const bool &runCPClean_,
 
94
            const double &scale_,
 
95
            std::ostream & makefile_,
 
96
            const std::string& projectFile_)
 
97
        : PanoramaAlgorithm(pano_),
 
98
      pano(pano_), progs(progs_), 
 
99
      runCeleste(runCeleste_), celesteThreshold(celesteThreshold_), celesteSmallRadius(celesteSmallRadius_),
 
100
      runCPClean(runCPClean_), scale(scale_), makefile(makefile_), projectFile(projectFile_)
 
101
        {
 
102
        valuestream.imbue(makefile::GetMakefileLocale());
 
103
        }
 
104
 
 
105
        static void createMakefile(PanoramaData & pano_,
 
106
            const AssistantPrograms & progs_,
 
107
            const bool &runCeleste_,
 
108
            const double &celesteThreshold_,
 
109
            const bool &celesteSmallRadius_,
 
110
            const bool &runCPClean_,
 
111
            const double &scale_,
 
112
            std::ostream & makefile_,
 
113
            const std::string& projectFile_)
 
114
        {
 
115
                AssistantMakefilelibExport* instance = new AssistantMakefilelibExport(
 
116
                                pano_, progs_, runCeleste_, celesteThreshold_, celesteSmallRadius_,
 
117
                runCPClean_, scale_, makefile_, projectFile_);
 
118
                instance->createItems();
 
119
                instance->writeMakefile();
 
120
                delete instance;
 
121
        }
 
122
 
 
123
        virtual bool modifiesPanoramaData() const
 
124
        {
 
125
                return false;
 
126
        }
 
127
        bool runAlgorithm()
 
128
        {
 
129
                return createItems() && writeMakefile();
 
130
        }
 
131
 
 
132
        virtual ~AssistantMakefilelibExport()
 
133
        {
 
134
                // TODO Auto-generated destructor stub
 
135
        }
 
136
};
 
137
 
 
138
};
 
139
#endif