HyperspaceExplorer 0.7.1
FunctionParameterValue.h
00001 /*
00002 Hyperspace Explorer - visualizing higher-dimensional geometry
00003 Copyright (C) 2010  Lene Preuss <lene.preuss@gmail.com>
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License along
00016 with this program; if not, write to the Free Software Foundation, Inc.,
00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 */
00020 
00021 #ifndef FUNCTIONPARAMETERVALUE_H
00022 #define FUNCTIONPARAMETERVALUE_H
00023 
00024 #include "FunctionParameterValueBase.h"
00025 
00027 
00040 template <typename T> class FunctionParameterValue:
00041         public FunctionParameterValueBase {
00042     public:
00044         FunctionParameterValue<T>(const T &_value): _value(_value) { }
00045 
00047         virtual void setValue(const char *);
00048 
00051         virtual double toDouble() const {
00052             throw WrongParameterTypeException("FunctionParameterValue",
00053                                               "toDouble()", "");
00054             return 0.;
00055         }
00056 
00059         virtual unsigned toUnsigned() const {
00060             throw WrongParameterTypeException("FunctionParameterValue",
00061                                               "operator unsigned ",
00062                                               "did you explicitly cast the operand to unsigned? you should!");
00063             return 0;
00064         }
00065 
00068         virtual int toInt() const {
00069             throw WrongParameterTypeException("FunctionParameterValue",
00070                                               "operator int", "");
00071             return 0;
00072         }
00073 
00075         virtual std::string toString() const {
00076             std::ostringstream o;
00077             o << _value;
00078             return o.str();
00079         }
00080 
00084         virtual VecMath::RotationBase toRotationBase() const {
00085             throw WrongParameterTypeException("FunctionParameterValue",
00086                                               "operator VecMath::RotationBase", "");
00087             return VecMath::Rotation<5>();
00088         }
00089 
00093         virtual VecMath::Rotation<5> toRotation5() const {
00094             throw WrongParameterTypeException("FunctionParameterValue",
00095                                               "operator VecMath::Rotation<5>", "");
00096             return VecMath::Rotation<5>();
00097         }
00098 
00102         virtual VecMath::Rotation<6> toRotation6() const {
00103             throw WrongParameterTypeException("FunctionParameterValue",
00104                                               "operator VecMath::Rotation<6>", "");
00105             return VecMath::Rotation<6>();
00106         }
00107 
00111         virtual VecMath::Rotation<7> toRotation7() const {
00112             throw WrongParameterTypeException("FunctionParameterValue",
00113                                               "operator VecMath::Rotation<7>", "");
00114             return VecMath::Rotation<7>();
00115         }
00116 
00120         virtual VecMath::Rotation<8> toRotation8() const {
00121             throw WrongParameterTypeException("FunctionParameterValue",
00122                                               "operator VecMath::Rotation<8>", "");
00123             return VecMath::Rotation<8>();
00124         }
00125 
00129         virtual VecMath::Rotation<9> toRotation9() const {
00130             throw WrongParameterTypeException("FunctionParameterValue",
00131                                               "operator VecMath::Rotation<9>", "");
00132             return VecMath::Rotation<9>();
00133         }
00134 
00138         virtual VecMath::Rotation<10> toRotation10() const {
00139             throw WrongParameterTypeException("FunctionParameterValue",
00140                                               "operator VecMath::Rotation<10>", "");
00141             return VecMath::Rotation<10>();
00142         }
00143 
00144     private:
00145 
00146       T _value;                
00147 };
00148 
00149 #endif // FUNCTIONPARAMETERVALUE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:14 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo