HyperspaceExplorer 0.7.1
|
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 FUNCTIONPARAMETERVALUEBASE_H 00022 #define FUNCTIONPARAMETERVALUEBASE_H 00023 00024 #include "Rotation.h" 00025 00026 #include <stdexcept> 00027 00030 00032 00084 class FunctionParameterValueBase { 00085 public: 00087 struct WrongParameterTypeException: public std::logic_error { 00089 00093 WrongParameterTypeException(const std::string &_class, 00094 const std::string &_function, 00095 const std::string &_type): 00096 std::logic_error("Tried to call default implementation for "+ 00097 _class+"::"+_function+"("+_type+")!") { } 00098 }; 00099 00107 00108 virtual void setValue(const double &) { 00109 throw WrongParameterTypeException("FunctionParameterValueBase", 00110 "setValue", "double"); 00111 } 00113 virtual void setValue(const unsigned &) { 00114 throw WrongParameterTypeException("FunctionParameterValueBase", 00115 "setValue", "unsigned"); 00116 } 00118 virtual void setValue(const int &) { 00119 throw WrongParameterTypeException("FunctionParameterValueBase", 00120 "setValue", "int"); 00121 } 00123 virtual void setValue(const std::string &) { 00124 throw WrongParameterTypeException("FunctionParameterValueBase", 00125 "setValue", "std::string"); 00126 } 00128 00131 virtual void setValue(const VecMath::Rotation<5> &) { 00132 throw WrongParameterTypeException("FunctionParameterValueBase", 00133 "setValue", "VecMath::Rotation<5>"); 00134 } 00136 00139 virtual void setValue(const VecMath::Rotation<6> &) { 00140 throw WrongParameterTypeException("FunctionParameterValueBase", 00141 "setValue", "VecMath::Rotation<6>"); 00142 } 00144 00147 virtual void setValue(const VecMath::Rotation<7> &) { 00148 throw WrongParameterTypeException("FunctionParameterValueBase", 00149 "setValue", "VecMath::Rotation<7>"); 00150 } 00152 00155 virtual void setValue(const VecMath::Rotation<8> &) { 00156 throw WrongParameterTypeException("FunctionParameterValueBase", 00157 "setValue", "VecMath::Rotation<8>"); 00158 } 00160 00163 virtual void setValue(const VecMath::Rotation<9> &) { 00164 throw WrongParameterTypeException("FunctionParameterValueBase", 00165 "setValue", "VecMath::Rotation<9>"); 00166 } 00168 00171 virtual void setValue(const VecMath::Rotation<10> &) { 00172 throw WrongParameterTypeException("FunctionParameterValueBase", 00173 "setValue", "VecMath::Rotation<10>"); 00174 } 00175 00177 virtual void setValue(const char *) = 0; 00178 00179 virtual double toDouble() const = 0; 00180 virtual unsigned toUnsigned() const = 0; 00181 virtual int toInt() const = 0; 00182 virtual std::string toString() const = 0; 00183 00184 virtual VecMath::RotationBase toRotationBase() const = 0; 00185 virtual VecMath::Rotation<5> toRotation5() const = 0; 00186 virtual VecMath::Rotation<6> toRotation6() const = 0; 00187 virtual VecMath::Rotation<7> toRotation7() const = 0; 00188 virtual VecMath::Rotation<8> toRotation8() const = 0; 00189 virtual VecMath::Rotation<9> toRotation9() const = 0; 00190 virtual VecMath::Rotation<10> toRotation10() const = 0; 00191 00192 }; 00193 00194 #endif // FUNCTIONPARAMETERVALUEBASE_H