00001 /*************************************************************************** 00002 * Copyright (C) 2003-2006 by Raphael Langerhorst * 00003 * raphael-langerhorst@gmx.at * 00004 * * 00005 * Permission is hereby granted, free of charge, to any person obtaining * 00006 * a copy of this software and associated documentation files (the * 00007 * "Software"), to deal in the Software without restriction, including * 00008 * without limitation the rights to use, copy, modify, merge, publish, * 00009 * distribute, sublicense, and/or sell copies of the Software, and to * 00010 * permit persons to whom the Software is furnished to do so, subject to * 00011 * the following conditions: * 00012 * * 00013 * The above copyright notice and this permission notice shall be * 00014 * included in all copies or substantial portions of the Software. * 00015 * * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * 00017 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 00018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.* 00019 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * 00020 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * 00021 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * 00022 * OTHER DEALINGS IN THE SOFTWARE. * 00023 ***************************************************************************/ 00024 00025 00026 #ifndef GENERGYH 00027 #define GENERGYH 00028 00029 #include <qmutex.h> 00030 00031 namespace GCS 00032 { 00033 00069 class GEnergy : public QMutex 00070 { 00071 protected: 00072 00081 double Level; 00082 00088 double Amount; 00089 00101 double Sigma; 00102 00103 00104 public: 00105 00110 GEnergy(); 00111 00115 GEnergy(double level, double amount, double sigma); 00116 00120 GEnergy(const GEnergy& original); 00121 00129 virtual ~GEnergy(); 00130 00134 double level() const; 00135 00139 double amount() const; 00140 00144 double sigma() const; 00145 00149 void set(double level, double amount, double sigma); 00150 00154 void set(const GEnergy original); 00155 00159 void operator = (const GEnergy& original); 00160 00167 bool equals(const GEnergy& other, double epsilon = 0.00001); 00168 00175 GEnergy take(double fraction); 00176 00182 void put(const GEnergy& energy); 00183 }; 00184 00185 00186 } 00187 00188 #endif
1.4.7