Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

Generic.h

Go to the documentation of this file.
00001 
00005 /* Copyright (C) 2002 - 2004, Bernd Speiser */
00006 /* This file is part of Quantity.
00007 
00008 Quantity is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either version 2
00011 of the License, or (at your option) any later version.
00012 
00013 Quantity is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017   
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00021 02111-1307, USA.
00022 */
00023 
00024 #ifndef _Generic_h
00025 #define _Generic_h
00026 
00027 #include "Quantity/Unit.h"
00028 #include "Quantity/Quantity.h"
00029 
00030 namespace Quantities {
00031 
00032 /* the Generic quantity */
00033 
00035 
00041 template<class GT> 
00042   struct GenericClass 
00043   {
00045 
00048     typedef typename GT::DimTL DimTL;
00049   };
00050 
00051 }
00052 
00053 namespace Units {
00054 
00056 class GenericUnit;
00057 
00059 //
00060 //  the Generic Unit
00061 //
00063 
00065 
00071 template<class GT, class ST> 
00072   class NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, ST> 
00073                             : public Unit<Quantities::GenericClass<GT> >
00074   {
00075     public:
00076       static const bool is_SI;
00077 
00078       static const bool is_exact;
00079 
00080       static ST Standard (const ST &value);
00081 
00082       ST standard (const ST &value) {return Standard (value);}
00083 
00084       static ST Reverse (const ST &value);
00085 
00086       ST reverse (const ST &value) {return Reverse (value);}
00087 
00088       static const std::string Namestring;
00089 
00090       static std::string Name (void) {return Namestring;}
00091 
00092       const std::string name (void) {return Name ();}
00093 
00094       static const std::string Symbolstring;
00095 
00096       static std::string Symbol (void) {return Symbolstring;}
00097 
00098       const std::string symbol (void) {return Symbol ();}
00099   };
00100 
00101 template<class GT, class ST> inline ST 
00102   NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, ST>::Standard
00103                                        (const ST &value) {return value;}
00104 
00105 template<class GT, class ST> inline ST 
00106   NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, ST>::Reverse 
00107                                        (const ST &value) {return value;}
00108 
00109 template<class GT, class ST> const bool 
00110   NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, 
00111                                                    ST>::is_exact = true;
00112 
00113 template<class GT, class ST> const bool 
00114   NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, 
00115                                                      ST>::is_SI = false;
00116 
00117 template<class GT, class ST> const 
00118   std::string 
00119     NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, 
00120                                                    ST>::Namestring = "";
00121 
00122 template<class GT, class ST> const 
00123   std::string 
00124     NonPrefixable<Quantities::GenericClass<GT>, GenericUnit, 
00125                                    ST>::Symbolstring = "(unknown unit)";
00126 }
00127 
00128 namespace Quantities {
00129 
00131 //
00132 //  the Generic Quantity
00133 //
00135 
00137 template<class GT, class Head, class Tail, class DU, class ST>
00138   struct Name<Quantity<GenericClass<GT>, Loki::Typelist<Head, Tail>, 
00139                                                                DU, ST> >
00140   {
00142     static const std::string String;
00143   };
00144 
00145 template<class GT, class Head, class Tail, class DU, class ST>
00146   const std::string 
00147     Name<Quantity<GenericClass<GT>, Loki::Typelist<Head, Tail>, DU, ST> 
00148                                                          >::String = "";
00149 
00151 template<class GT, class Head, class Tail, class DU, class ST>
00152   struct Symbol<Quantity<GenericClass<GT>, Loki::Typelist<Head, Tail>, 
00153                                                                DU, ST> >
00154   {
00156     static const std::string String;
00157   };
00158 
00159 template<class GT, class Head, class Tail, class DU, class ST>
00160   const std::string 
00161     Symbol<Quantity<GenericClass<GT>, Loki::Typelist<Head, Tail>, DU, 
00162                                                      ST> >::String = "";
00163 }
00164 
00165 #endif /* _Generic_h */

Generated on Sun Jan 15 13:57:59 2006 for Quantity by doxygen 1.3.6