ElectricCharge.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2002 - 2009, Bernd Speiser */
00008 /* This file is part of Quantities.
00009 
00010 PhysicalQuantities is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 PhysicalQuantities is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019   
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00023 02111-1307, USA.
00024 */
00025 
00026 #ifndef _ElectricCharge_h
00027 #define _ElectricCharge_h
00028 
00029 // Quantity includes
00030 #include "Quantity/Variable.h"
00031 #include "Quantity/Constant.h"
00032 #include "Quantity/QuantityCluster.h"
00033 
00034 namespace quantity {
00035   namespace electricCharge {
00036 
00038 class Class;
00039 
00041 class Unit;
00042 
00043 /* declaration of ElectricCharge units */
00044 class CoulombUnits;
00045 class FranklinUnit;
00046 class EmuUnit;
00047 class ProtonChargeUnit;
00048 
00050 typedef unit::Prefixable<Unit, CoulombUnits> Coulombs;
00051 
00053 typedef unit::Prefixed<Coulombs> Coulomb;
00054 
00056 typedef unit::Prefixed<Coulombs, unit::Milli> MilliCoulomb;
00057 
00059 typedef unit::NonPrefixable<Unit, FranklinUnit> Franklin;
00060 
00062 typedef unit::NonPrefixable<Unit, EmuUnit> Emu;
00063 
00065 typedef unit::NonPrefixable<Unit, ProtonChargeUnit> ProtonCharge;
00066 
00068 typedef Loki::TL::Append<Coulombs::Units,
00069             LOKI_TYPELIST_3(Franklin, Emu, ProtonCharge)>::Result Units;
00070 
00071 /* declare some abbreviated ElectricCharge units */
00072 typedef Coulomb C;
00073 
00074 /* ElectricCharge quantity */
00075 
00076 typedef Quantity<Class> Quantity;
00077 
00078 class DerivedElectricCharge;
00079 
00080   } // end namespace electricCharge
00081 
00083 
00085   template<typename ST>
00086     struct Standard<electricCharge::Coulombs, ST>
00087     {
00088       static const ST ratio;
00089       static const bool exact;
00090     };
00091 
00093 template<typename ST> const ST Standard<electricCharge::Coulombs, ST>::ratio = 1.0;
00094 
00096 template<typename ST> const bool Standard<electricCharge::Coulombs, ST>::exact = true;
00097 
00099 
00101   template<typename ST>
00102     struct Standard<electricCharge::Franklin, ST>
00103     {
00104       static const ST ratio;
00105       static const bool exact;
00106     };
00107 
00109 template<typename ST> const ST Standard<electricCharge::Franklin, ST>::ratio = 3.33564e-10;
00110 
00112 template<typename ST> const bool Standard<electricCharge::Franklin, ST>::exact = false;
00113 
00115 
00117   template<typename ST>
00118     struct Standard<electricCharge::Emu, ST>
00119     {
00120       static const ST ratio;
00121       static const bool exact;
00122     };
00123 
00125 template<typename ST> const ST Standard<electricCharge::Emu, ST>::ratio = 10.0;
00126 
00128 template<typename ST> const bool Standard<electricCharge::Emu, ST>::exact = true;
00129 
00131 
00133   template<typename ST>
00134     struct Standard<electricCharge::ProtonCharge, ST>
00135     {
00136       static const ST ratio;
00137       static const bool exact;
00138     };
00139 
00141 template<typename ST> const ST Standard<electricCharge::ProtonCharge, ST>::ratio = 1.60218e-19;
00142 
00144 template<typename ST> const bool Standard<electricCharge::ProtonCharge, ST>::exact = false;
00145 
00147 template<>
00148   struct QuantityTraits<electricCharge::Class>
00149   {
00150     typedef
00151       dimension::Dimension<BSUtilities::Rational<0>,
00152         BSUtilities::Rational<0>, BSUtilities::Rational<1>,
00153           BSUtilities::Rational<1>, BSUtilities::Rational<0>,
00154             BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00155     typedef electricCharge::Unit UnitType;
00156     typedef electricCharge::Units UnitList;
00157     typedef electricCharge::Coulomb DefaultUnit;
00158 
00159     typedef electricCharge::DerivedElectricCharge DefaultDerivedQuantityType;
00160 
00161     static const std::string NameString;
00162     static const std::string SymbolString;
00163 
00164   };
00165 
00166 // the derived quantity traits template for Coulomb ElectricCharge
00167 template<>
00168   struct DerivedQuantityTraits<electricCharge::Class, electricCharge::DerivedElectricCharge>
00169   {
00170     static const bool OverwriteName = false;
00171     static const bool OverwriteSymbol = false;
00172 
00173     static const std::string NameString;
00174     static const std::string SymbolString;
00175 
00176   };
00177 
00178 
00180 typedef Variable<electricCharge::Quantity> ElectricCharge;
00181 
00183 typedef Constant<electricCharge::Quantity> ElectricChargeConstant;
00184 
00186 typedef QuantityVector<Variable, electricCharge::Quantity> 
00187                                                    ElectricChargeVector;
00188 
00189 }
00190 
00191 #endif /* _ElectricCharge_h */

Generated on Mon Jul 27 15:55:44 2009 for Quantities by  doxygen 1.5.3