Salome HOME
NRI : Merge from V1_2.
[modules/med.git] / src / MEDMEM / MEDMEM_Unit.hxx
1 //  MED MEDMEM : MED files in memory
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : MEDMEM_Unit.hxx
25 //  Module : MED
26
27 /*
28  File Unit.hxx
29  $Header$
30 */
31
32 #ifndef UNIT_HXX
33 #define UNIT_HXX
34
35 #include <string>
36
37 #include "utilities.h"
38 #include "MEDMEM_Exception.hxx"
39 #include "MEDMEM_define.hxx"
40 //using namespace MED_EN;
41
42 class UNIT { 
43 protected:
44   string _name ;
45   string _description ;
46
47   int    _masse ; // kilogram (kg)
48   int    _length ; // meter (m)
49   int    _time ; // second (s)
50   int    _temperature ; // Kelvin (K)
51   int    _matterQuantity ; // mole (mol)
52   int    _currentStrength ; // ampere (A)
53   int    _lightIntensity ; // candela (cd)
54
55   // Unit in IS !
56   // Example : 
57   //   J = kg.m^2.s^(-2) 
58   //   so : Name="Joule",Masse=1,Length=2 and Time=-2, other are null 
59
60 public:
61   UNIT();
62   UNIT(string Name, string Description);
63   ~UNIT();
64   UNIT & operator=(const UNIT &unit);
65
66   inline void setName(string Name) ;
67   inline void setDescription(string Description) ;
68   inline void setMasse(int Masse) ;
69   inline void setLength(int Length) ;
70   inline void setTime(int Time) ;
71   inline void setTemperature(int Temperature) ;
72   inline void setMatterQuantity(int MatterQuantity) ;
73   inline void setCurrentStrength(int CurrentStrength) ;
74   inline void setLightIntensity(int LightIntensity) ;
75
76   inline string getName() const ;
77   inline string getDescription() const ;
78   inline int    getMasse() const ;
79   inline int    getLength() const ;
80   inline int    getTime() const ;
81   inline int    getTemperature() const ;
82   inline int    getMatterQuantity() const ;
83   inline int    getCurrentStrength() const ;
84   inline int    getLightIntensity() const ;
85
86 } ;
87
88 // inline method :
89
90 inline void UNIT::setName(string Name) {
91   _name = Name ;
92 };
93 inline void UNIT::setDescription(string Description) {
94   _description = Description ;
95 };
96 inline void UNIT::setMasse(int Masse) {
97   _masse=Masse ;
98 };
99 inline void UNIT::setLength(int Length) {
100   _length=Length ;
101 };
102 inline void UNIT::setTime(int Time) {
103   _time=Time ;
104 };
105 inline void UNIT::setTemperature(int Temperature) {
106   _temperature=Temperature ;
107 };
108 inline void UNIT::setMatterQuantity(int MatterQuantity) {
109   _matterQuantity=MatterQuantity ;
110 };
111 inline void UNIT::setCurrentStrength(int CurrentStrength) {
112   _currentStrength=CurrentStrength ;
113 };
114 inline void UNIT::setLightIntensity(int LightIntensity) {
115   _lightIntensity=LightIntensity ;
116 };
117
118 inline string UNIT::getName() const            { return _name ; } ;
119 inline string UNIT::getDescription() const     { return _description ; } ;
120 inline int    UNIT::getMasse() const           { return _masse ; } ;
121 inline int    UNIT::getLength() const          { return _length ; } ;
122 inline int    UNIT::getTime() const            { return _time ; } ;
123 inline int    UNIT::getTemperature() const     { return _temperature ; } ;
124 inline int    UNIT::getMatterQuantity() const  { return _matterQuantity ; } ;
125 inline int    UNIT::getCurrentStrength() const { return _currentStrength ; } ;
126 inline int    UNIT::getLightIntensity() const  { return _lightIntensity ; } ;
127
128 #endif /* UNIT_HXX */