Diana
0.8.3
|
00001 /* ----------------------------------------------------------------------------- 00002 * Diana process modelling, simulation and analysis software 00003 * Copyright (c) 2005, Michael Krasnyk 00004 * All rights reserved. 00005 * 00006 * This file is a part of Diana process modelling, simulation and analysis software 00007 * 00008 * Diana is free software; you can redistribute it and/or modify it 00009 * under the terms of the GNU General Public License as published 00010 * by the Free Software Foundation (see accompanying file LICENSE) 00011 * ----------------------------------------------------------------------------- 00012 * $Id: CapeParameter.hpp 8160 2009-03-16 18:36:30Z miha $ 00013 * ----------------------------------------------------------------------------- 00014 * Description: 00015 */ 00016 00017 #ifndef CAPE_PARAMETER_HPP 00018 #define CAPE_PARAMETER_HPP 00019 00020 #include "CapeTypes.hpp" 00021 #include "CapeBasic.hpp" 00022 #include "DianaArray.hpp" 00023 00024 namespace Common{ 00025 00031 namespace Parameter{ 00032 00034 typedef enum eCapeParamType{ 00035 CAPE_NONE, 00036 CAPE_REAL, 00037 CAPE_INT, 00038 CAPE_OPTION, 00039 CAPE_BOOLEAN, 00040 CAPE_ARRAY, 00041 CAPE_ARRAY_STRING, 00042 CAPE_POINTER, 00043 DIANA_ARRAY_PARAMETERS, 00044 DIANA_ARRAY_REAL, 00045 } CapeParamType; 00046 00048 typedef enum eCapeParamMode{ 00049 CAPE_INPUT, 00050 CAPE_OUTPUT, 00051 CAPE_INPUT_OUTPUT 00053 } CapeParamMode; 00054 00055 00056 class ICapeParameter; 00057 class ICapeParameterSpec; 00058 00060 typedef std::vector<ICapeParameter*> CapeArrayParameter; 00061 typedef std::vector<ICapeParameterSpec*> CapeArrayParameterSpec; 00062 00066 class ICapeParameterSpec : public Identification::ICapeIdentification{ 00067 public: 00071 virtual CapeParamType Type() const 00072 throw(Common::Error::ECapeUnknown) = 0; 00073 00079 virtual Common::Types::CapeVariant Dimensionality() const 00080 throw (Common::Error::ECapeUnknown, Common::Error::ECapeNoImpl) = 0; 00081 }; 00082 00083 00088 class ICapeRealParameterSpec : public ICapeParameterSpec{ 00089 #ifndef SWIG 00090 00091 friend std::ostream& operator<<(std::ostream& os, const ICapeRealParameterSpec& pspec); 00092 #endif 00093 public: 00095 virtual Common::Types::CapeDouble DefaultValue() const 00096 throw (Common::Error::ECapeUnknown) = 0; 00097 00099 virtual Common::Types::CapeDouble LowerBound() const 00100 throw (Common::Error::ECapeUnknown) = 0; 00101 00103 virtual Common::Types::CapeDouble UpperBound() const 00104 throw (Common::Error::ECapeUnknown) = 0; 00105 00113 virtual Common::Types::CapeBoolean Validate(Common::Types::CapeDouble value, 00114 Common::Types::CapeString& message) 00115 throw (Common::Error::ECapeUnknown, 00116 Common::Error::ECapeInvalidArgument, 00117 Common::Error::ECapeNoImpl) = 0; 00118 }; 00119 00120 00125 class ICapeIntegerParameterSpec : public ICapeParameterSpec{ 00126 #ifndef SWIG 00127 00128 friend std::ostream& operator<<(std::ostream& os, const ICapeIntegerParameterSpec& pspec); 00129 #endif 00130 public: 00132 virtual Common::Types::CapeLong DefaultValue() const 00133 throw (Common::Error::ECapeUnknown) = 0; 00134 00136 virtual Common::Types::CapeLong LowerBound() const 00137 throw (Common::Error::ECapeUnknown) = 0; 00138 00140 virtual Common::Types::CapeLong UpperBound() const 00141 throw (Common::Error::ECapeUnknown) = 0; 00142 00150 virtual Common::Types::CapeBoolean Validate(Common::Types::CapeLong value, 00151 Common::Types::CapeString& message) 00152 throw (Common::Error::ECapeUnknown, 00153 Common::Error::ECapeInvalidArgument, 00154 Common::Error::ECapeNoImpl) = 0; 00155 }; 00156 00157 00162 class ICapeBooleanParameterSpec : public ICapeParameterSpec{ 00163 #ifndef SWIG 00164 00165 friend std::ostream& operator<<(std::ostream& os, const ICapeBooleanParameterSpec& pspec); 00166 #endif 00167 public: 00169 virtual Common::Types::CapeBoolean DefaultValue() const 00170 throw (Common::Error::ECapeUnknown) = 0; 00171 00179 virtual Common::Types::CapeBoolean Validate(Common::Types::CapeBoolean value, 00180 Common::Types::CapeString& message) 00181 throw (Common::Error::ECapeUnknown, 00182 Common::Error::ECapeInvalidArgument, 00183 Common::Error::ECapeNoImpl) = 0; 00184 }; 00185 00186 class ICapePointerParameterSpec : public ICapeParameterSpec{ 00187 #ifndef SWIG 00188 00189 friend std::ostream& operator<<(std::ostream& os, const ICapePointerParameterSpec& pspec); 00190 #endif 00191 public: 00193 virtual Common::Types::CapePointer DefaultValue() const 00194 throw (Common::Error::ECapeUnknown) = 0; 00195 00203 virtual Common::Types::CapeBoolean Validate(Common::Types::CapePointer value, 00204 Common::Types::CapeString& message) 00205 throw (Common::Error::ECapeUnknown, 00206 Common::Error::ECapeInvalidArgument, 00207 Common::Error::ECapeNoImpl) = 0; 00208 }; 00209 00214 class ICapeOptionParameterSpec : public ICapeParameterSpec{ 00215 #ifndef SWIG 00216 00217 friend std::ostream& operator<<(std::ostream& os, const ICapeOptionParameterSpec& pspec); 00218 #endif 00219 public: 00223 virtual const Common::Types::CapeString& DefaultValue() const 00224 throw (Common::Error::ECapeUnknown) = 0; 00225 00229 virtual const Common::Types::CapeArrayString& OptionList() const 00230 throw (Common::Error::ECapeUnknown) = 0; 00231 00234 virtual Common::Types::CapeBoolean RestrictedToList() const 00235 throw (Common::Error::ECapeUnknown) = 0; 00236 00244 virtual Common::Types::CapeBoolean Validate(Common::Types::CapeString value, Common::Types::CapeString& message) 00245 throw (Common::Error::ECapeUnknown, 00246 Common::Error::ECapeInvalidArgument, 00247 Common::Error::ECapeNoImpl) = 0; 00248 }; 00249 00253 class ICapeParameter : public Identification::ICapeIdentification { 00254 #ifndef SWIG 00255 00256 friend std::ostream& operator<<(std::ostream& os, ICapeParameter& param); 00257 #endif 00258 public: 00261 virtual Common::Types::CapeVariant GetValue() 00262 throw (Common::Error::ECapeUnknown) = 0; 00263 00268 virtual void SetValue(const Common::Types::CapeVariant& _value) 00269 throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument) = 0; 00270 00280 virtual Common::Types::CapeValidationStatus ValStatus() const 00281 throw (Common::Error::ECapeUnknown, Common::Error::ECapeNoImpl) = 0; 00282 00291 virtual CapeParamMode GetMode() const 00292 throw (Common::Error::ECapeUnknown) = 0; 00293 00304 virtual void SetMode(CapeParamMode _mode) 00305 throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument) = 0; 00306 00310 virtual ICapeParameterSpec* Specification() const 00311 throw (Common::Error::ECapeUnknown) = 0; 00312 00316 virtual Common::Types::CapeBoolean Validate(Common::Types::CapeString& message) 00317 throw (Common::Error::ECapeUnknown, 00318 Common::Error::ECapeNoImpl) = 0; 00319 00321 virtual void Reset() 00322 throw (Common::Error::ECapeUnknown) = 0; 00323 }; 00324 }; 00325 }; 00326 00327 #endif // CAPE_PARAMETER_HPP