00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _Generic_h
00025 #define _Generic_h
00026
00027 #include "Quantity/Unit.h"
00028 #include "Quantity/Quantity.h"
00029
00030 namespace quantity {
00031
00032
00033
00035
00040 template<class DIM> struct GenericClass {};
00041
00042 }
00043
00044 namespace unit {
00045
00047 class GenericUnit;
00048
00050
00051
00052
00054
00056
00062 template<class DIM>
00063 class NonPrefixable<quantity::GenericClass<DIM>, GenericUnit>
00064 : public Unit<quantity::GenericClass<DIM> >
00065 {
00066 private:
00067 static const bool SI;
00068
00069 public:
00070 static const bool IsSI (void) {return SI;}
00071
00072 const bool isSI (void) const {return IsSI ();}
00073
00074 static const std::string Namestring;
00075
00076 static std::string Name (void) {return Namestring;}
00077
00078 const std::string name (void) const {return Name ();}
00079
00080 static const std::string Symbolstring;
00081
00082 static std::string Symbol (void) {return Symbolstring;}
00083
00084 const std::string symbol (void) const {return Symbol ();}
00085
00086 void save (BSUtilities::xmlw::XmlStream &os) const
00087 {
00088 os << BSUtilities::xmlw::tag (Units::TAG)
00089 << BSUtilities::xmlw::attr (Units::TYPETAG) << TYPE
00090
00091 << BSUtilities::xmlw::endtag (Units::TAG);
00092 }
00093
00095
00097 static const std::string TYPE;
00098
00099 };
00100
00101 template<class DIM> const bool
00102 NonPrefixable<quantity::GenericClass<DIM>, GenericUnit>::SI = false;
00103
00104 template<class DIM> const
00105 std::string
00106 NonPrefixable<quantity::GenericClass<DIM>, GenericUnit>
00107 ::Namestring = "";
00108
00109 template<class DIM> const
00110 std::string
00111 NonPrefixable<quantity::GenericClass<DIM>, GenericUnit>
00112 ::Symbolstring = "(unknown unit)";
00113
00115 template<class DIM>
00116 const std::string NonPrefixable<quantity::GenericClass<DIM>,
00117 GenericUnit>::TYPE = "generic";
00118
00119 }
00120
00121 namespace quantity {
00122
00124
00125
00126
00128
00130 template<class DIM, class UL, class DU, class ST>
00131 struct Name<Quantity<DIM, GenericClass<DIM>, UL, DU, ST> >
00132 {
00134 static const std::string String;
00135 };
00136
00137 template<class DIM, class UL, class DU, class ST>
00138 const std::string
00139 Name<Quantity<DIM, GenericClass<DIM>, UL, DU, ST> >::String = "";
00140
00142 template<class DIM, class UL, class DU, class ST>
00143 struct Symbol<Quantity<DIM, GenericClass<DIM>, UL, DU, ST> >
00144 {
00146 static const std::string String;
00147 };
00148
00150 template<class DIM, class UL, class DU, class ST>
00151 const std::string
00152 Symbol<Quantity<DIM, GenericClass<DIM>, UL, DU, ST> >::String = "";
00153
00155 template<class DIM, class ST>
00156 struct Standard<unit::NonPrefixable<GenericClass<DIM>,
00157 unit::GenericUnit>, ST>
00158 {
00159 static const ST ratio;
00160 static const bool exact;
00161 };
00162
00164 template<class DIM, class ST>
00165 const ST
00166 Standard<unit::NonPrefixable<GenericClass<DIM>,
00167 unit::GenericUnit>, ST>::ratio = ST(1.0);
00168
00170 template<class DIM, class ST>
00171 const bool
00172 Standard<unit::NonPrefixable<GenericClass<DIM>,
00173 unit::GenericUnit>, ST>::exact = true;
00174
00175 }
00176
00177 #endif