Frequency.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2002 - 2009, Bernd Speiser */
00008 
00009 /* This file is part of Quantities.
00010 
00011 PhysicalQuantities is free software; you can redistribute it and/or
00012 modify it under the terms of the GNU General Public License
00013 as published by the Free Software Foundation; either version 2
00014 of the License, or (at your option) any later version.
00015 
00016 PhysicalQuantities is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 GNU General Public License for more details.
00020   
00021 You should have received a copy of the GNU General Public License
00022 along with this program; if not, write to the Free Software
00023 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00024 02111-1307, USA.
00025 */
00026 
00027 #ifndef _Frequency_h
00028 #define _Frequency_h
00029 
00030 // Quantity includes
00031 #include "Quantity/Variable.h"
00032 #include "Quantity/Constant.h"
00033 #include "Quantity/QuantityCluster.h"
00034 
00035 namespace quantity {
00036   namespace frequency {
00037 
00039 class Class;
00040 
00042 class Unit;
00043 
00044 /* declaration of Frequency units */
00045 class HertzUnits;
00046 
00048 typedef unit::Prefixable<Unit, HertzUnits> Hertzs;
00049 
00051 typedef unit::Prefixed<Hertzs> Hertz;
00052 
00054 typedef unit::Prefixed<Hertzs, unit::Milli> MilliHertz;
00055 
00057 typedef unit::Prefixed<Hertzs, unit::Kilo> KiloHertz;
00058 
00060 typedef unit::Prefixed<Hertzs, unit::Mega> MegaHertz;
00061 
00063 typedef unit::Prefixed<Hertzs, unit::Giga> GigaHertz;
00064 
00066 typedef Hertzs::Units Units;
00067 
00068 /* declare some abbreviated time units */
00069 typedef Hertz Hz;
00070 typedef MilliHertz mHz;
00071 typedef MegaHertz MHz;
00072 typedef GigaHertz GHz;
00073 
00074 /* Frequency Quantity */
00075 
00076 typedef Quantity<Class> Quantity;
00077 
00078 class DerivedFrequency;
00079 
00080   } // end namespace frequency
00081 
00083 
00085   template<typename ST>
00086     struct Standard<frequency::Hertzs, ST>
00087     {
00088       static const ST ratio;
00089       static const bool exact;
00090     };
00091 
00093 template<typename ST> const ST Standard<frequency::Hertzs, ST>::ratio = 1.0;
00094 
00096 template<typename ST> const bool Standard<frequency::Hertzs, ST>::exact = true;
00097 
00099 template<>
00100   struct QuantityTraits<frequency::Class>
00101   {
00102     typedef
00103       dimension::Dimension<BSUtilities::Rational<0>,
00104         BSUtilities::Rational<0>, BSUtilities::Rational<-1>,
00105           BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00106             BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00107     typedef frequency::Unit UnitType;
00108     typedef frequency::Units UnitList;
00109     typedef frequency::Hertz DefaultUnit;
00110 
00111     typedef frequency::DerivedFrequency DefaultDerivedQuantityType;
00112 
00113     static const std::string NameString;
00114     static const std::string SymbolString;
00115 
00116 
00117   };
00118 
00119 // the derived quantity traits template for Hertz Frequency
00120 template<>
00121   struct DerivedQuantityTraits<frequency::Class, frequency::DerivedFrequency>
00122   {
00123     static const bool OverwriteName = false;
00124     static const bool OverwriteSymbol = false;
00125 
00126     static const std::string NameString;
00127     static const std::string SymbolString;
00128 
00129   };
00130 
00132 typedef Variable<frequency::Quantity> Frequency;
00133 
00135 typedef Constant<frequency::Quantity> FrequencyConstant;
00136 
00138 typedef QuantityVector<Variable, frequency::Quantity> FrequencyVector;
00139 
00140 }
00141 
00142 #endif /* _Frequency_h */

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