7fd59977 |
1 | //----------------------------------------------------------------------------- |
2 | // |
3 | // inline methods for Convert from Quantity |
4 | // |
5 | // Author : M. MERCIEN |
6 | //----------------------------------------------------------------------------- |
7 | #include <Quantity_Array1OfCoefficient.hxx> |
8 | |
9 | |
10 | #ifndef __Quantity_API |
11 | # if defined(WNT) && !defined(HAVE_NO_DLL) |
12 | # ifdef __Quantity_DLL |
13 | # define __Quantity_API __declspec( dllexport ) |
14 | # else |
15 | # define __Quantity_API __declspec( dllimport ) |
16 | # endif // __Quantity_DLL |
17 | # else |
18 | # define __Quantity_API |
19 | # endif // WNT |
20 | #endif // __Quantity_API |
21 | |
22 | |
23 | extern __Quantity_API Quantity_Array1OfCoefficient ConvertTable; |
24 | |
25 | |
26 | //---------------------------------------------------------------------------- |
27 | // SetQuantity |
28 | //---------------------------------------------------------------------------- |
29 | inline void Quantity_Convert::SetQuantity (const Quantity_PhysicalQuantity aQuantity, |
30 | const Quantity_Coefficient aCoef) { |
31 | // ...Update du coefficient de conversion |
32 | if (aQuantity > 0 && aQuantity <= 68) ConvertTable(aQuantity) = aCoef; |
33 | } |
34 | |
35 | //---------------------------------------------------------------------------- |
36 | // ConvertUserToSI |
37 | //---------------------------------------------------------------------------- |
38 | inline Quantity_Coefficient Quantity_Convert::ConvertUserToSI |
39 | (const Quantity_PhysicalQuantity aQuantity , |
40 | const Standard_Real aVal) { |
41 | // ...Conversion de la valeur aVal, du Systeme Utilisateur en Systeme International |
42 | if (aQuantity > 0 && aQuantity <= 68) |
43 | return (aVal*ConvertTable(aQuantity)); |
44 | else |
45 | return aVal; |
46 | } |
47 | |
48 | //---------------------------------------------------------------------------- |
49 | // ConvertSIToUser |
50 | //---------------------------------------------------------------------------- |
51 | inline Quantity_Coefficient Quantity_Convert::ConvertSIToUser |
52 | (const Quantity_PhysicalQuantity aQuantity , |
53 | const Standard_Real aVal) { |
54 | // ...Conversion de la valeur aVal, du Systeme International au Systeme Utilisateur |
55 | if (aQuantity > 0 && aQuantity <= 68) |
56 | return (aVal/ConvertTable(aQuantity)); |
57 | else |
58 | return aVal; |
59 | } |