[an error occurred while processing this directive]
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

hugin_base/panodata/PanoramaVariable.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00026 #ifndef _PANODATA_PANORAMAVARIABLE_H
00027 #define _PANODATA_PANORAMAVARIABLE_H
00028 
00029 
00030 #include <hugin_shared.h>
00031 #include <string>
00032 #include <iostream>
00033 #include <vector>
00034 #include <set>
00035 #include <map>
00036 
00037 #include <hugin_utils/stl_utils.h>
00038 
00039 
00040 namespace HuginBase {
00041 
00047 class IMPEX Variable
00048 {
00049     public:
00050         Variable(const std::string & name, double val = 0.0)
00051             : name(name), value(val)
00052         {};
00053         
00054         virtual ~Variable()
00055         {};
00056         
00057 
00059         virtual std::ostream & print(std::ostream & o) const;
00060 
00061         
00062         const std::string & getName() const
00063             { return name; }
00064         
00065         void setValue(double v)
00066             { value = v; }
00067         
00068         double getValue() const
00069             { return value; }
00070 
00071     protected:
00072         std::string name;
00073         double value;
00074 };
00075 
00076 
00077 
00078 // a linked variable (which contains the link target explicitly
00079 class IMPEX LinkedVariable : public Variable
00080 {
00081     
00082     public:
00083         LinkedVariable(const std::string & name, double val = 0.0, int link=-1)
00084         : Variable(name, val), m_link(link)
00085         {}
00086 
00087         bool isLinked() const
00088         { return m_link >= 0; }
00089         
00090         int getLink()  const
00091         { return m_link; }
00092         
00093         void setLink(int link)
00094         { m_link = link; }
00095 
00096     protected:
00097         int m_link;
00098 };
00099 
00100 
00101 
00106 class IMPEX LensVariable : public Variable
00107 {
00108     public:
00109         LensVariable(const std::string & name, double value, bool link=false)
00110             : Variable(name, value), linked(link)
00111         {};
00112         
00113         virtual ~LensVariable()
00114             {};
00115         
00116         
00118         virtual std::ostream& printLink(std::ostream & o, unsigned int link) const;
00119 
00120         
00122         bool isLinked() const
00123             { return linked; }
00125         void setLinked(bool l=true)
00126             { linked = l; }
00127         
00128     private:
00129         bool linked;
00130     
00131 };
00132 
00133 
00134 
00135 
00137 struct PrintVar : public std::unary_function<Variable, void>
00138 {
00139     PrintVar(std::ostream & o)
00140         : os(o)
00141     {};
00142     
00143     void operator()(Variable x) const
00144         { x.print(os) << " "; };
00145     
00146     std::ostream& os;
00147 };
00148 
00149 
00151 typedef std::map<std::string,Variable> VariableMap;
00152 
00154 IMPEX void fillVariableMap(VariableMap & vars);
00155 
00157 IMPEX void printVariableMap(std::ostream & o, const VariableMap & vars);
00158 
00160 typedef std::vector<VariableMap> VariableMapVector;
00161 
00162 
00164 typedef std::map<std::string,LensVariable> LensVarMap;
00165 
00167 IMPEX void fillLensVarMap(LensVarMap & vars);
00168 
00169 
00171 typedef std::vector<std::set<std::string> > OptimizeVector;
00172 
00173 
00174 } // namespace
00175 #endif // _H

Generated on Mon Sep 20 01:01:27 2010 for Hugintrunk by doxygen 1.3.9.1