00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _Digital_h
00028 #define _Digital_h
00029
00030
00031 #include "Quantity/Variable.h"
00032 #include "Quantity/Constant.h"
00033
00034 namespace quantity {
00036 namespace digital {
00037
00039 class Class;
00040
00042 class Unit;
00043
00044
00045 class DigitalUnit;
00046
00048 typedef unit::NonPrefixable<Unit, DigitalUnit> Unity;
00049
00051 typedef LOKI_TYPELIST_1(Unity) Units;
00052
00053
00054
00055 typedef quantity::Quantity<Class, bool> Quantity;
00056
00057 class DerivedDigital;
00058
00059 }
00060
00062
00063
00064
00065
00066
00068
00070
00071
00072
00073
00075
00077
00082 template<template<typename, typename> class Q1, typename QT1, typename SU1,
00083 template<typename, typename> class Q2, typename QT2, typename SU2, typename ST>
00084 struct GenerateVariable
00085 <Q1<Quantity<QT1, bool>, SU1>, Q2<Quantity<QT2, ST>, SU2> >
00086 {
00087 private:
00088 typedef typename QuantityTraits<QT1>::Dimension Dim1;
00089 typedef typename QuantityTraits<QT2>::Dimension Dim2;
00090
00092 typedef typename Dim1::template Add<Dim2> AddT;
00093 typedef Quantity<GenericClass<typename AddT::Res>, ST> AddNewQ;
00094
00096 typedef typename Dim1::template Sub<Dim2> SubT;
00097 typedef Quantity<GenericClass<typename SubT::Res>, ST> SubNewQ;
00098
00099 public:
00101
00103 typedef Variable<AddNewQ> Add;
00104
00106
00108 typedef Variable<SubNewQ> Sub;
00109 };
00110
00112
00113
00114
00116
00118
00120 template<>
00121 struct Standard<digital::Unity, bool>
00122 {
00123 static const bool ratio;
00124 static const bool exact;
00125 };
00126
00128 template<>
00129 struct QuantityTraits<digital::Class>
00130 {
00131 typedef
00132 dimension::Dimension<BSUtilities::Rational<0>,
00133 BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00134 BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00135 BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00136 typedef digital::Unit UnitType;
00137 typedef digital::Units UnitList;
00138 typedef digital::Unity DefaultUnit;
00139
00140 typedef digital::DerivedDigital DefaultDerivedQuantityType;
00141
00142 static const std::string NameString;
00143 static const std::string SymbolString;
00144
00145 };
00146
00147
00148 template<>
00149 struct DerivedQuantityTraits<digital::Class, digital::DerivedDigital>
00150 {
00151 static const bool OverwriteName = false;
00152 static const bool OverwriteSymbol = false;
00153
00154 static const std::string NameString;
00155 static const std::string SymbolString;
00156
00157 };
00158
00159
00161 typedef Variable<digital::Quantity> Digital;
00162
00164 typedef Constant<digital::Quantity> DigitalConstant;
00165
00166 namespace digital{
00168 extern const quantity::DigitalConstant On;
00170 extern const quantity::DigitalConstant Off;
00171 }
00172
00173 }
00174
00175 #endif