///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
// All rights reserved.
//
// This software and its documentation and related materials are owned by
// the Alliance. The software may only be incorporated into application
// programs owned by members of the Alliance, subject to a signed
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable
// trade secrets of the Alliance and its suppliers. The software is also
// protected by copyright law and international treaty provisions. Application
// programs incorporating this software must include the following statement
// with their copyright notices:
//
// This application incorporates Open Design Alliance software pursuant to a license
// agreement with Open Design Alliance.
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
// All rights reserved.
//
// By use of this software, its documentation or related materials, you
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
#if !defined(_DAI_UNITCONVERTER_H_INCLUDED_)
#define _DAI_UNITCONVERTER_H_INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "daiBuildOptions.h"
#include "TD_PackPush.h"
/** \details
Implements the Data Access Interface (DAI) that provides functionality for manipulating data that is defined within the EXPRESS SCHEMA format.
*/
namespace OdDAI {
/** \details
A class that implements an interface for conversion of different units to the SI units.
*/
class DAI_EXPORT OdUnitConverter
{
public:
/** \details
Destructor.
*/
virtual ~OdUnitConverter() {}
/** \details
Performs an attempt to convert a specified unit to the SI unit.
\param unitType [in] A string that contains the type of the unit to be converted.
\param val [in] A unit value.
\returns A double value that contains the converted value of the specified unit type.
*/
virtual double convertToSIUnit(const OdAnsiString& unitType, double val) const = 0;
/** \details
Appends a new convertible unit.
\param unitType [in] A string that contains the type of the convertible unit.
\param unitId [in] An identifier of the corresponding ConversionBasedUnit object.
*/
virtual void appendUnit(const OdAnsiString& unitType, const OdDAIObjectId& unitId) = 0;
/** \details
Appends a new convertible unit.
\param unitId [in] An identifier of the corresponding ConversionBasedUnit object.
*/
virtual void appendUnit(const OdDAIObjectId& unitId) = 0;
/** \details
Gets name and prefix of conversion type.
\param unitType [in] A string that contains the type of the unit to be returned.
\param unitName [out] A unit name.
\param unitPrefix [out] A unit prefix name. If no prefix then the value is empty.
\returns True if the attributes are retrieved successfully, false otherwise.
*/
virtual bool getConversionUnitName(const OdAnsiString& unitType, OdAnsiString& unitName, OdAnsiString& unitPrefix) = 0;
/** \details
Removes all convertible units.
*/
virtual void clearUnits() = 0;
/** \details
Performs an attempt to convert a local unit to the SI unit.
\param localUnitId [in] An id of local unit entity.
\param val [in] A unit value.
\returns A double value that contains the converted value of the specified unit type.
*/
virtual double convertFromLocalUnit(const OdDAIObjectId& localUnitId, double val) const = 0;
};
/** \details
A data type that represents a smart pointer to an object.
*/
typedef OdSharedPtr OdUnitConverterPtr;
}
#include "TD_PackPop.h"
#endif // !defined(_DAI_UNITCONVERTER_H_INCLUDED_)