Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

UnitsExtension.h

Go to the documentation of this file.
00001 #if !defined(UNITSEXTENSION_INCLUDED)
00002    #define UNITSEXTENSION_INCLUDED
00003 
00004 // Include files
00005 #include <string>
00006 #include <vector>
00007 #include "GaudiKernel/StatusCode.h"
00008 
00009 //
00010 // ClassName:   Units-Extension for PropertyCompiler
00011 //  
00012 // Description: This class is extending the property-compiler by introducing the capability
00013 //              of handling units. The units are defined in an own units-definition file.
00014 //              From the definintion file the calculation algorithm for the internal 
00015 //              representation of the unit is calculated. If the compiler detects an unit
00016 //              it is calculating the internal representation and assigns already the internal
00017 //              value to the property.
00018 //
00019 // Author:      Stefan Probst
00020 //
00021 
00022 class UnitsObject {
00023   private:
00024     std::string m_unitName;         // name of unit (e.g. cm, m, dm,...)
00025     double m_factor;           // value which is multiplied with unit to get internal representation
00026 
00027   public:
00028     UnitsObject(std::string name, double factor) {
00029       m_unitName = name;
00030       m_factor = factor;
00031     }
00032 
00033     ~UnitsObject() {
00034     }
00035 
00036     void setName(std::string name) {
00037       m_unitName = name;
00038     }
00039 
00040     std::string getName() {
00041       return m_unitName;
00042     }
00043 
00044     void setFactor(double factor) {
00045       m_factor = factor;
00046     }
00047 
00048     double getFactor() {
00049       return m_factor;
00050     }
00051 };
00052 
00053 
00054 class UnitsExtension {
00055   private:
00056     std::vector<UnitsObject> unitVector;
00057     bool addUnit(std::string name, double factor);
00058 
00059   public:
00060     bool existsUnit(std::string name);
00061     double getFactor(std::string name);
00062     bool getUnits(std::string definitionFile);
00063 };
00064 
00065 
00066 #endif
00067 

Generated at Wed Nov 21 12:22:31 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000