COPASI API  4.40.278
CUnit Class Reference

#include <CUnit.h>

Inheritance diagram for CUnit:
[legend]

Classes

struct  SymbolComponent
 

Public Types

enum  UnitType {
  time = 0 , quantity , volume , area ,
  length
}
 

Public Member Functions

void addComponent (const CUnitComponent &component)
 
void buildExpression ()
 
CIssue compile ()
 
 CUnit ()
 
 CUnit (const CBaseUnit::Kind &kind)
 
 CUnit (const CUnit &src)
 
 CUnit (const std::string &expression)
 
CUnit exponentiate (double exp) const
 
void filterUsedSymbols (const CUnitDefinitionDB &unitDefinitiionDB)
 
const std::set< CUnitComponent > & getComponents () const
 
std::string getExpression () const
 
std::vector< SymbolComponentgetSymbolComponents () const
 
const std::set< std::string > & getUsedSymbols () const
 
bool isDimensionless () const
 
bool isEquivalent (const CUnit &rightSide) const
 
bool isUndefined () const
 
bool isUnitType (UnitType type) const
 
bool isValid () const
 
CUnit operator* (const CUnit &rightSide) const
 
bool operator< (const CUnit &rightSide) const
 
CUnitoperator= (const CUnit &rightSide)
 
bool operator== (const CUnit &rightSide) const
 
void replaceSymbol (const std::string &oldSymbol, const std::string &newSymbol)
 
void setDimensionLess (double multiplier, double scale, double exponent)
 
virtual CIssue setExpression (const std::string &expression)
 
virtual ~CUnit ()
 

Static Public Member Functions

static std::string prettyPrint (const std::string &expression)
 
static std::string replaceSymbol (const std::string &expression, const std::string &oldSymbol, const std::string &newSymbol)
 

Static Public Attributes

static C_FLOAT64 Avogadro
 

Static Private Member Functions

static C_INT32 getExponentOfSymbol (const std::pair< std::string, CUnit > &SymbolDef, CUnit &unit)
 
static std::pair< C_INT32, C_INT32removeSymbolFromUnit (const CUnit &symbol, CUnit &unit)
 
static void replaceExponentInExpression (std::string &expression, const size_t &exponent)
 

Private Attributes

std::set< CUnitComponentmComponents
 
std::string mExpression
 
CUnitComponentmpDimensionless
 
std::set< std::string > mUsedSymbols
 

Friends

std::ostream & operator<< (std::ostream &os, const CUnit &o)
 

Member Enumeration Documentation

◆ UnitType

Enumerator
time 
quantity 
volume 
area 
length 

Constructor & Destructor Documentation

◆ CUnit() [1/4]

CUnit::CUnit ( )

◆ CUnit() [2/4]

CUnit::CUnit ( const CBaseUnit::Kind kind)

Kind constructor

Parameters
constCBaseUnit::Kind & kind

References addComponent(), CBaseUnit::getSymbol(), mUsedSymbols, and CBaseUnit::undefined.

◆ CUnit() [3/4]

CUnit::CUnit ( const std::string &  expression)

Expression constructor

Parameters
conststd::string & expression

References setExpression().

◆ CUnit() [4/4]

CUnit::CUnit ( const CUnit src)

Copy constructor

Parameters
constCUnit & src

References mComponents, and mpDimensionless.

◆ ~CUnit()

CUnit::~CUnit ( )
virtual

Member Function Documentation

◆ addComponent()

◆ buildExpression()

◆ compile()

◆ exponentiate()

◆ filterUsedSymbols()

void CUnit::filterUsedSymbols ( const CUnitDefinitionDB unitDefinitiionDB)

◆ getComponents()

◆ getExponentOfSymbol()

C_INT32 CUnit::getExponentOfSymbol ( const std::pair< std::string, CUnit > &  SymbolDef,
CUnit unit 
)
staticprivate

◆ getExpression()

◆ getSymbolComponents()

◆ getUsedSymbols()

const std::set< std::string > & CUnit::getUsedSymbols ( ) const

◆ isDimensionless()

bool CUnit::isDimensionless ( ) const

◆ isEquivalent()

bool CUnit::isEquivalent ( const CUnit rightSide) const

◆ isUndefined()

◆ isUnitType()

◆ isValid()

bool CUnit::isValid ( ) const

References mComponents.

Referenced by buildExpression(), and removeSymbolFromUnit().

◆ operator*()

CUnit CUnit::operator* ( const CUnit rightSide) const

◆ operator<()

bool CUnit::operator< ( const CUnit rightSide) const

◆ operator=()

CUnit & CUnit::operator= ( const CUnit rightSide)

Assignment operator

References mComponents, mExpression, mpDimensionless, and mUsedSymbols.

Referenced by CUnitDefinition::operator=().

◆ operator==()

bool CUnit::operator== ( const CUnit rightSide) const

◆ prettyPrint()

◆ removeSymbolFromUnit()

std::pair< C_INT32, C_INT32 > CUnit::removeSymbolFromUnit ( const CUnit symbol,
CUnit unit 
)
staticprivate

References getComponents(), and isValid().

Referenced by getExponentOfSymbol().

◆ replaceExponentInExpression()

void CUnit::replaceExponentInExpression ( std::string &  expression,
const size_t &  exponent 
)
staticprivate

Referenced by buildExpression().

◆ replaceSymbol() [1/2]

std::string CUnit::replaceSymbol ( const std::string &  expression,
const std::string &  oldSymbol,
const std::string &  newSymbol 
)
static

◆ replaceSymbol() [2/2]

void CUnit::replaceSymbol ( const std::string &  oldSymbol,
const std::string &  newSymbol 
)

◆ setDimensionLess()

void CUnit::setDimensionLess ( double  multiplier,
double  scale,
double  exponent 
)

◆ setExpression()

CIssue CUnit::setExpression ( const std::string &  expression)
virtual

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const CUnit o 
)
friend

Member Data Documentation

◆ Avogadro

C_FLOAT64 CUnit::Avogadro
static

◆ mComponents

◆ mExpression

std::string CUnit::mExpression
private

◆ mpDimensionless

CUnitComponent* CUnit::mpDimensionless
private

◆ mUsedSymbols

std::set< std::string > CUnit::mUsedSymbols
private

The documentation for this class was generated from the following files: