Loading files
3d097a032This file is pinned to the selected release. Download the original to open it in your design tool.
// Created on: 1992-10-29
// Created by: Gilles DEBARBOUILLE
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Units_Unit_HeaderFile
#define _Units_Unit_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
#include <NCollection_Sequence.hxx>
#include <NCollection_HSequence.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Integer.hxx>
class TCollection_HAsciiString;
class Units_Quantity;
class Units_Token;
//! This class defines an elementary word contained in
//! a physical quantity.
class Units_Unit : public Standard_Transient
{
public:
//! Creates and returns a unit. <aname> is the name of
//! the unit, <asymbol> is the usual abbreviation of the
//! unit, and <avalue> is the value in relation to the
//! International System of Units.
Standard_EXPORT Units_Unit(const char* const aname,
const char* const asymbol,
const double avalue,
const occ::handle<Units_Quantity>& aquantity);
//! Creates and returns a unit. <aname> is the name of
//! the unit, <asymbol> is the usual abbreviation of the
//! unit.
Standard_EXPORT Units_Unit(const char* const aname, const char* const asymbol);
//! Creates and returns a unit. <aname> is the name of
//! the unit.
Standard_EXPORT Units_Unit(const char* const aname);
//! Returns the name of the unit <thename>
TCollection_AsciiString Name() const;
//! Adds a new symbol <asymbol> attached to <me>.
Standard_EXPORT void Symbol(const char* const asymbol);
//! Returns the value in relation with the International
//! System of Units.
double Value() const;
//! Returns <thequantity> contained in <me>.
occ::handle<Units_Quantity> Quantity() const;
//! Returns the sequence of symbols <thesymbolssequence>
occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>> SymbolsSequence() const;
//! Sets the value <avalue> to <me>.
void Value(const double avalue);
//! Sets the physical Quantity <aquantity> to <me>.
void Quantity(const occ::handle<Units_Quantity>& aquantity);
//! Starting with <me>, returns a new Token object.
Standard_EXPORT virtual occ::handle<Units_Token> Token() const;
//! Compares all the symbols linked within <me> with the
//! name of <atoken>, and returns True if there is one
//! symbol equal to the name, False otherwise.
Standard_EXPORT bool IsEqual(const char* const astring) const;
//! Useful for debugging
Standard_EXPORT virtual void Dump(const int ashift, const int alevel) const;
DEFINE_STANDARD_RTTIEXT(Units_Unit, Standard_Transient)
protected:
occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>> thesymbolssequence;
double thevalue;
private:
occ::handle<TCollection_HAsciiString> thename;
occ::handle<Units_Quantity> thequantity;
};
#include <Units_Unit.lxx>
#endif // _Units_Unit_HeaderFile