unit_converter.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007 SCHUNK GmbH & Co. KG
00003  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *   http://www.apache.org/licenses/LICENSE-2.0
00010 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 //======================================================================
00045 //======================================================================
00046 
00047 //----------------------------------------------------------------------
00048 // System Includes - include with <>
00049 //----------------------------------------------------------------------
00050 
00051 #include <vector>
00052 
00053 //----------------------------------------------------------------------
00054 // Project Includes - include with ""
00055 //----------------------------------------------------------------------
00056 
00057 #include "simplevector.h"
00058 #include "sdhlibrary_settings.h"
00059 
00060 //----------------------------------------------------------------------
00061 // Defines, enums, unions, structs,
00062 //----------------------------------------------------------------------
00063 
00064 NAMESPACE_SDH_START
00065 
00066 
00067 //----------------------------------------------------------------------
00068 // Global variables
00069 //----------------------------------------------------------------------
00070 
00071 
00072 //----------------------------------------------------------------------
00073 // Function declarations
00074 //----------------------------------------------------------------------
00075 
00076 
00077 //----------------------------------------------------------------------
00078 // Class declarations
00079 //----------------------------------------------------------------------
00080 
00081 
00092 class VCC_EXPORT cUnitConverter
00093 {
00094 public:
00113   cUnitConverter(char const* _kind, char const* _name, char const* _symbol, double _factor = 1.0, double _offset = 0.0, int _decimal_places = 1);
00114 
00115   //----------------------------------------------------------------------
00120   double ToExternal(double internal) const;
00121 
00122   //----------------------------------------------------------------------
00131   cSimpleVector ToExternal(cSimpleVector& internal) const;
00132 
00133 
00134   //----------------------------------------------------------------------
00141   std::vector<double> ToExternal(std::vector<double> const& internal) const;
00142 
00143 
00144   //----------------------------------------------------------------------
00149   double ToInternal(double external) const;
00150 
00151   //----------------------------------------------------------------------
00160   cSimpleVector ToInternal(cSimpleVector& external) const;
00161 
00162 
00163   //----------------------------------------------------------------------
00170   std::vector<double> ToInternal(std::vector<double> const& external) const;
00171 
00172   //----------------------------------------------------------------------
00174   char const* GetKind(void) const;
00175 
00176   //----------------------------------------------------------------------
00178   char const* GetName(void) const;
00179 
00180   //----------------------------------------------------------------------
00182   char const* GetSymbol(void) const;
00183 
00184   //----------------------------------------------------------------------
00185 
00187   double GetFactor(void) const;
00188 
00189   //----------------------------------------------------------------------
00191   double GetOffset(void) const;
00192 
00193   //----------------------------------------------------------------------
00195   int GetDecimalPlaces(void) const;
00196 
00197 
00198 protected:
00200   char const* kind;
00201 
00203   char const* name;
00204 
00206   char const* symbol;
00207 
00209   double factor;
00210 
00212   double offset;
00213 
00215   int decimal_places;
00216 
00217 }; // cUnitConverter
00218 //======================================================================
00219 
00220 
00222 extern cUnitConverter const uc_identity;
00223 
00224 //----------------------------------------------------------------------
00226 typedef double(cUnitConverter::*pDoubleUnitConverterFunction)(double) const;
00227 
00228 
00230 //typedef std::vector<double> (cUnitConverter::*pDoubleVectorUnitConverterFunction) ( std::vector<double> ) const;
00231 
00232 
00233 //
00234 //#####################################################################
00235 
00236 NAMESPACE_SDH_END
00237 
00238 
00239 //======================================================================
00240 /*
00241   Here are some settings for the emacs/xemacs editor (and can be safely ignored):
00242   (e.g. to explicitely set C++ mode for *.h header files)
00243 
00244   Local Variables:
00245   mode:C++
00246   mode:ELSE
00247   End:
00248 */
00249 //======================================================================


schunk_sdh
Author(s): Mathias Luedtke , Florian Weisshardt
autogenerated on Sat Jun 8 2019 20:25:21