COPASI API
4.40.278
|
#include <CUnit.h>
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< SymbolComponent > | getSymbolComponents () 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 |
CUnit & | operator= (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_INT32 > | removeSymbolFromUnit (const CUnit &symbol, CUnit &unit) |
static void | replaceExponentInExpression (std::string &expression, const size_t &exponent) |
Private Attributes | |
std::set< CUnitComponent > | mComponents |
std::string | mExpression |
CUnitComponent * | mpDimensionless |
std::set< std::string > | mUsedSymbols |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CUnit &o) |
enum CUnit::UnitType |
CUnit::CUnit | ( | ) |
Default constructor
Referenced by exponentiate(), CUnitDefinition::getSIUnit(), CValidatedUnit::merge(), and operator*().
CUnit::CUnit | ( | const CBaseUnit::Kind & | kind | ) |
Kind constructor
const | CBaseUnit::Kind & kind |
References addComponent(), CBaseUnit::getSymbol(), mUsedSymbols, and CBaseUnit::undefined.
CUnit::CUnit | ( | const std::string & | expression | ) |
CUnit::CUnit | ( | const CUnit & | src | ) |
|
virtual |
void CUnit::addComponent | ( | const CUnitComponent & | component | ) |
References C_FLOAT64, CBaseUnit::dimensionless, CUnitComponent::getExponent(), CUnitComponent::getKind(), CUnitComponent::getMultiplier(), CUnitComponent::getScale(), mComponents, mpDimensionless, CUnitComponent::setExponent(), CUnitComponent::setMultiplier(), and CUnitComponent::setScale().
Referenced by SBMLUnitSupport::createUnitExpressionFor(), CUnit(), CUnitDefinitionDB::getAllValidUnits(), and operator*().
void CUnit::buildExpression | ( | ) |
References getSymbolComponents(), CRootContainer::getUnitList(), isValid(), mExpression, CBaseUnit::prefixFromScale(), CRootContainer::quoteUnitDefSymbol(), replaceExponentInExpression(), and stringReplace().
Referenced by SBMLUnitSupport::createUnitExpressionFor(), CUnitDefinitionDB::getAllValidUnits(), and prettyPrint().
CIssue CUnit::compile | ( | ) |
References CCopasiMessage::ERROR, CIssue::Error, CUnitParserBase::getComponents(), CUnitParserBase::getSymbols(), mComponents, MCUnit, mExpression, mpDimensionless, mUsedSymbols, CIssue::Success, CBaseUnit::undefined, CIssue::UnitInvalid, CIssue::UnitUndefined, CIssue::Warning, and CUnitParserBase::yyparse().
Referenced by SBMLUnitSupport::createUnitExpressionFor(), and setExpression().
CUnit CUnit::exponentiate | ( | double | exp | ) | const |
References CUnit(), CBaseUnit::dimensionless, getComponents(), CUnitComponent::getExponent(), CUnitComponent::getMultiplier(), CUnitComponent::getScale(), min, CUnitComponent::setExponent(), CUnitComponent::setMultiplier(), and CUnitComponent::setScale().
Referenced by SBMLUnitSupport::createUnitExpressionFor(), CValidatedUnit::exponentiate(), and CUnitDefinitionDB::getAllValidUnits().
void CUnit::filterUsedSymbols | ( | const CUnitDefinitionDB & | unitDefinitiionDB | ) |
References CUnitDefinitionDB::containsSymbol(), and mUsedSymbols.
Referenced by SBMLUnitSupport::createUnitExpressionFor().
const std::set< CUnitComponent > & CUnit::getComponents | ( | ) | const |
References mComponents.
Referenced by addSymbolComponentToUnitDefinition(), CSBMLExporter::createUnitDefinitionFor(), exponentiate(), CUnitParserBase::getComponents(), getSymbolComponents(), CEvaluationNodeFunction::getUnit(), CEvaluationNodeOperator::getUnit(), removeSymbolFromUnit(), CModel::setQuantityUnit(), and CEvaluationNodeOperator::setUnit().
|
staticprivate |
References C_INT32, CBaseUnit::fromSymbol(), removeSymbolFromUnit(), and CBaseUnit::undefined.
Referenced by getSymbolComponents().
std::string CUnit::getExpression | ( | ) | const |
References mExpression.
Referenced by CUnitDefinition::createUndoData(), CSBMLExporter::createUnitDefinitionFor(), SBMLUnitSupport::createUnitExpressionFor(), isUnitType(), CCopasiXML::mergeUnitDefinitions(), prettyPrint(), CCopasiXML::saveUnitDefinitionList(), CUnitDefinition::setExpression(), and CUnitDefinition::toData().
std::vector< CUnit::SymbolComponent > CUnit::getSymbolComponents | ( | ) | const |
References C_INT32, C_INVALID_INDEX, CBaseUnit::dimensionless, CUnit::SymbolComponent::exponent, getComponents(), getExponentOfSymbol(), CBaseUnit::getSymbol(), CUnit::SymbolComponent::multiplier, mUsedSymbols, CUnit::SymbolComponent::scale, sortSymbols(), and CUnit::SymbolComponent::symbol.
Referenced by buildExpression(), and CSBMLExporter::createUnitDefinitionFor().
const std::set< std::string > & CUnit::getUsedSymbols | ( | ) | const |
References mUsedSymbols.
Referenced by CModel::getUnitSymbolUsage(), getUsedSymbolCount(), and sortSymbols().
bool CUnit::isDimensionless | ( | ) | const |
References mComponents.
Referenced by SBMLUnitSupport::importUnit(), isUnitType(), CModel::setQuantityUnit(), and SBMLUnitSupport::validateUnit().
bool CUnit::isEquivalent | ( | const CUnit & | rightSide | ) | const |
References CBaseUnit::avogadro, CBaseUnit::dimensionless, and mComponents.
Referenced by SBMLUnitSupport::validateUnit().
bool CUnit::isUndefined | ( | ) | const |
References mComponents.
Referenced by CSBMLExporter::createUnitDefinitionFor(), CSBMLExporter::exportAndAssignUnit(), CUnitDefinition::setExpression(), CModel::setQuantityUnit(), and sortSymbols().
bool CUnit::isUnitType | ( | UnitType | type | ) | const |
bool CUnit::isValid | ( | ) | const |
References mComponents.
Referenced by buildExpression(), and removeSymbolFromUnit().
References addComponent(), CUnit(), mComponents, mUsedSymbols, and CBaseUnit::undefined.
bool CUnit::operator< | ( | const CUnit & | rightSide | ) | const |
References mComponents, mExpression, and mUsedSymbols.
Referenced by CValidatedUnit::operator<().
Assignment operator
References mComponents, mExpression, mpDimensionless, and mUsedSymbols.
Referenced by CUnitDefinition::operator=().
bool CUnit::operator== | ( | const CUnit & | rightSide | ) | const |
References CBaseUnit::dimensionless, and mComponents.
|
static |
|
staticprivate |
References getComponents(), and isValid().
Referenced by getExponentOfSymbol().
|
staticprivate |
Referenced by buildExpression().
|
static |
void CUnit::replaceSymbol | ( | const std::string & | oldSymbol, |
const std::string & | newSymbol | ||
) |
References mExpression, replaceSymbol(), and setExpression().
void CUnit::setDimensionLess | ( | double | multiplier, |
double | scale, | ||
double | exponent | ||
) |
|
virtual |
Reimplemented in CUnitDefinition.
References compile(), mExpression, and CIssue::Success.
Referenced by CUnit(), CUnitDefinition::getSIUnit(), CModel::getUnitSymbolUsage(), replaceSymbol(), CUnitDefinition::setExpression(), and CModelEntity::setUnitExpression().
|
friend |
|
static |
Referenced by CFunctionDB::initObjects(), and ModelHandler::processStart().
|
private |
Referenced by addComponent(), compile(), CUnit(), getComponents(), isDimensionless(), isEquivalent(), isUndefined(), isUnitType(), isValid(), operator*(), operator<(), operator=(), operator==(), and setDimensionLess().
|
private |
Referenced by buildExpression(), compile(), getExpression(), operator<(), operator=(), replaceSymbol(), and setExpression().
|
private |
Referenced by addComponent(), compile(), CUnit(), operator=(), and setDimensionLess().
|
private |
Referenced by compile(), CUnit(), filterUsedSymbols(), getSymbolComponents(), getUsedSymbols(), operator*(), operator<(), and operator=().