Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

UnitSystem.H

00001 #ifndef UnitSystem_H
00002 #define UnitSystem_H
00003 
00004 #include <map>
00005 
00006 #include <citrus/Quantity.H>
00007 class DimensionGroup ;
00008 
00009 /*
00010 struct eqdgptr
00011 {
00012   bool operator()( const DimensionGroup* g1, const DimensionGroup* g2 ) const
00013   { return  g1 == g2 ; }
00014 } ;
00015 
00016 bool eqhf( const DimensionGroup* g1, const DimensionGroup* g2 )
00017 { return g1 == g2 ; }
00018 */
00019 
00021 class UnitSystem
00022 {
00023 public:
00024   UnitSystem() ;
00025   ~UnitSystem() ;
00026 
00027   void name( const char* ) ;
00028   const char* name() const ;
00029 
00030   void abbr( const char* ) ;
00031   const char* abbr() const ;
00032 
00033   void description( const char* ) ;
00034   const char* description() const ;
00035 
00036   bool addSpec( const DimensionGroup* dg, const char* spec ) ;
00037   bool getSpec( Quantity& result, const DimensionGroup* dg ) ;
00038   bool convert( Quantity& result, const Quantity& source ) ;
00039 
00040   const UnitSystem* next() const ;
00041 
00042 private:
00043   char*                                         m_name ;
00044   char*                                         m_abbr ;
00045   char*                                         m_desc ;
00046   map< const DimensionGroup*, Quantity >        m_specs ;
00047   UnitSystem*                                   m_next ;
00048 
00049   static UnitSystem*                            theUnitSystems ;
00050 } ;
00051 
00052 #endif // UnitSystem_H
Citrus C++ Reference Manual  20010520