Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-14 08:41:46

0001 // Created on: 1992-06-22
0002 // Created by: Gilles DEBARBOUILLE
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Units_HeaderFile
0018 #define _Units_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_CString.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_Real.hxx>
0027 class Units_UnitsDictionary;
0028 class Units_Quantity;
0029 class Units_Lexicon;
0030 class Units_Dimensions;
0031 
0032 //! This  package provides all the  facilities  to create
0033 //! and question a dictionary of  units,  and also  to
0034 //! manipulate measurements which are real values with
0035 //! units.
0036 class Units
0037 {
0038 public:
0039   DEFINE_STANDARD_ALLOC
0040 
0041   //! Defines the location of the file containing all the
0042   //! information useful in creating the dictionary of all
0043   //! the units known to the system.
0044   Standard_EXPORT static void UnitsFile(const Standard_CString afile);
0045 
0046   //! Defines the location of the file containing the lexicon
0047   //! useful in manipulating composite units.
0048   Standard_EXPORT static void LexiconFile(const Standard_CString afile);
0049 
0050   //! Returns a unique instance of the dictionary of units.
0051   //! If <amode> is True, then it forces the recomputation of
0052   //! the dictionary of units.
0053   Standard_EXPORT static Handle(Units_UnitsDictionary) DictionaryOfUnits(
0054     const Standard_Boolean amode = Standard_False);
0055 
0056   //! Returns a unique quantity instance corresponding to <aquantity>.
0057   Standard_EXPORT static Handle(Units_Quantity) Quantity(const Standard_CString aquantity);
0058 
0059   //! Returns the first quantity string founded from the unit <aUnit>.
0060   Standard_EXPORT static Standard_CString FirstQuantity(const Standard_CString aunit);
0061 
0062   //! Returns a unique instance of the Units_Lexicon.
0063   //! If <amode> is True, it forces the recomputation of
0064   //! the dictionary of units, and by consequence the
0065   //! completion of the Units_Lexicon.
0066   Standard_EXPORT static Handle(Units_Lexicon) LexiconUnits(
0067     const Standard_Boolean amode = Standard_True);
0068 
0069   //! Return a unique instance of LexiconFormula.
0070   Standard_EXPORT static Handle(Units_Lexicon) LexiconFormula();
0071 
0072   //! Returns always the same instance of Dimensions.
0073   Standard_EXPORT static Handle(Units_Dimensions) NullDimensions();
0074 
0075   //! Converts <avalue> expressed in <afirstunit> into the <asecondunit>.
0076   Standard_EXPORT static Standard_Real Convert(const Standard_Real    avalue,
0077                                                const Standard_CString afirstunit,
0078                                                const Standard_CString asecondunit);
0079 
0080   Standard_EXPORT static Standard_Real ToSI(const Standard_Real    aData,
0081                                             const Standard_CString aUnit);
0082 
0083   Standard_EXPORT static Standard_Real ToSI(const Standard_Real       aData,
0084                                             const Standard_CString    aUnit,
0085                                             Handle(Units_Dimensions)& aDim);
0086 
0087   Standard_EXPORT static Standard_Real FromSI(const Standard_Real    aData,
0088                                               const Standard_CString aUnit);
0089 
0090   Standard_EXPORT static Standard_Real FromSI(const Standard_Real       aData,
0091                                               const Standard_CString    aUnit,
0092                                               Handle(Units_Dimensions)& aDim);
0093 
0094   //! return the dimension associated to the Type
0095   Standard_EXPORT static Handle(Units_Dimensions) Dimensions(const Standard_CString aType);
0096 };
0097 
0098 #endif // _Units_HeaderFile