Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:29

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 
0033 //! This  package provides all the  facilities  to create
0034 //! and question a dictionary of  units,  and also  to
0035 //! manipulate measurements which are real values with
0036 //! units.
0037 class Units 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Defines the location of the file containing all the
0045   //! information useful in creating the dictionary of all
0046   //! the units known to the system.
0047   Standard_EXPORT static void UnitsFile (const Standard_CString afile);
0048   
0049   //! Defines the location of the file containing the lexicon
0050   //! useful in manipulating composite units.
0051   Standard_EXPORT static void LexiconFile (const Standard_CString afile);
0052   
0053   //! Returns a unique instance of the dictionary of units.
0054   //! If <amode> is True, then it forces the recomputation of
0055   //! the dictionary of units.
0056   Standard_EXPORT static Handle(Units_UnitsDictionary) DictionaryOfUnits (const Standard_Boolean amode = Standard_False);
0057   
0058   //! Returns a unique quantity instance corresponding to <aquantity>.
0059   Standard_EXPORT static Handle(Units_Quantity) Quantity (const Standard_CString aquantity);
0060   
0061   //! Returns the first quantity string founded from the unit <aUnit>.
0062   Standard_EXPORT static Standard_CString FirstQuantity (const Standard_CString aunit);
0063   
0064   //! Returns a unique instance of the Units_Lexicon.
0065   //! If <amode> is True, it forces the recomputation of
0066   //! the dictionary of units, and by consequence the
0067   //! completion of the Units_Lexicon.
0068   Standard_EXPORT static Handle(Units_Lexicon) LexiconUnits (const Standard_Boolean amode = Standard_True);
0069   
0070   //! Return a unique instance of LexiconFormula.
0071   Standard_EXPORT static Handle(Units_Lexicon) LexiconFormula();
0072   
0073   //! Returns always the same instance of Dimensions.
0074   Standard_EXPORT static Handle(Units_Dimensions) NullDimensions();
0075   
0076   //! Converts <avalue> expressed in <afirstunit> into the <asecondunit>.
0077   Standard_EXPORT static Standard_Real Convert (const Standard_Real avalue, const Standard_CString afirstunit, const Standard_CString asecondunit);
0078   
0079   Standard_EXPORT static Standard_Real ToSI (const Standard_Real aData, const Standard_CString aUnit);
0080   
0081   Standard_EXPORT static Standard_Real ToSI (const Standard_Real aData, const Standard_CString aUnit, Handle(Units_Dimensions)& aDim);
0082   
0083   Standard_EXPORT static Standard_Real FromSI (const Standard_Real aData, const Standard_CString aUnit);
0084   
0085   Standard_EXPORT static Standard_Real FromSI (const Standard_Real aData, const Standard_CString aUnit, Handle(Units_Dimensions)& aDim);
0086   
0087   //! return the dimension associated to the Type
0088   Standard_EXPORT static Handle(Units_Dimensions) Dimensions (const Standard_CString aType);
0089 
0090 };
0091 
0092 #endif // _Units_HeaderFile