Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-24 08:18:54

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