Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-10-22
0002 // Created by: Gilles DEBARBOUILLE
0003 // Copyright (c) 1993-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_UnitsSystem_HeaderFile
0018 #define _Units_UnitsSystem_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Units_QuantitiesSequence.hxx>
0024 #include <TColStd_HSequenceOfInteger.hxx>
0025 #include <Standard_Transient.hxx>
0026 class TCollection_AsciiString;
0027 
0028 
0029 class Units_UnitsSystem;
0030 DEFINE_STANDARD_HANDLE(Units_UnitsSystem, Standard_Transient)
0031 
0032 //! This class  allows  the  user  to  define his  own
0033 //! system of units.
0034 class Units_UnitsSystem : public Standard_Transient
0035 {
0036 
0037 public:
0038 
0039   
0040   //! Returns an instance of UnitsSystem initialized to the
0041   //! S.I. units system.
0042   Standard_EXPORT Units_UnitsSystem();
0043   
0044   //! Returns an instance of UnitsSystem initialized to the
0045   //! S.I. units system upgraded by the base system units description
0046   //! file.
0047   //! Attempts to find the four following files:
0048   //! $CSF_`aName`Defaults/.aName
0049   //! $CSF_`aName`SiteDefaults/.aName
0050   //! $CSF_`aName`GroupDefaults/.aName
0051   //! $CSF_`aName`UserDefaults/.aName
0052   //! See : Resource_Manager for the description of this file.
0053   Standard_EXPORT Units_UnitsSystem(const Standard_CString aName, const Standard_Boolean Verbose = Standard_False);
0054   
0055   //! Returns the sequence of refined quantities.
0056   Standard_EXPORT Handle(Units_QuantitiesSequence) QuantitiesSequence() const;
0057   
0058   //! Returns a sequence of integer in correspondence with
0059   //! the sequence of quantities, which indicates, for each
0060   //! redefined quantity, the index into the sequence of
0061   //! units, of the active unit.
0062   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ActiveUnitsSequence() const;
0063   
0064   //! Specifies for <aquantity> the unit <aunit> used.
0065   Standard_EXPORT void Specify (const Standard_CString aquantity, const Standard_CString aunit);
0066   
0067   //! Removes for <aquantity> the unit <aunit> used.
0068   Standard_EXPORT void Remove (const Standard_CString aquantity, const Standard_CString aunit);
0069   
0070   //! Specifies for <aquantity> the unit <aunit> used.
0071   Standard_EXPORT void Activate (const Standard_CString aquantity, const Standard_CString aunit);
0072   
0073   //! Activates the first unit of all defined system quantities
0074   Standard_EXPORT void Activates();
0075   
0076   //! Returns for <aquantity> the active unit.
0077   Standard_EXPORT TCollection_AsciiString ActiveUnit (const Standard_CString aquantity) const;
0078   
0079   //! Converts a real value <avalue> from the unit <aunit>
0080   //! belonging to the physical dimensions <aquantity> to
0081   //! the corresponding unit of the user system.
0082   Standard_EXPORT Standard_Real ConvertValueToUserSystem (const Standard_CString aquantity, const Standard_Real avalue, const Standard_CString aunit) const;
0083   
0084   //! Converts the real value <avalue> from the S.I. system
0085   //! of units to the user system of units. <aquantity> is
0086   //! the physical dimensions of the measurement.
0087   Standard_EXPORT Standard_Real ConvertSIValueToUserSystem (const Standard_CString aquantity, const Standard_Real avalue) const;
0088   
0089   //! Converts the real value <avalue> from the user system
0090   //! of units to the S.I. system of units. <aquantity> is
0091   //! the physical dimensions of the measurement.
0092   Standard_EXPORT Standard_Real ConvertUserSystemValueToSI (const Standard_CString aquantity, const Standard_Real avalue) const;
0093   
0094   Standard_EXPORT void Dump() const;
0095   
0096   //! Returns TRUE if no units has been defined in the system.
0097   Standard_EXPORT Standard_Boolean IsEmpty() const;
0098 
0099 
0100 
0101 
0102   DEFINE_STANDARD_RTTIEXT(Units_UnitsSystem,Standard_Transient)
0103 
0104 protected:
0105 
0106 
0107 
0108 
0109 private:
0110 
0111 
0112   Handle(Units_QuantitiesSequence) thequantitiessequence;
0113   Handle(TColStd_HSequenceOfInteger) theactiveunitssequence;
0114 
0115 
0116 };
0117 
0118 
0119 
0120 
0121 
0122 
0123 
0124 #endif // _Units_UnitsSystem_HeaderFile