COPASI API  4.40.278
CUnitDefinition Class Reference

#include <CUnitDefinition.h>

Inheritance diagram for CUnitDefinition:
[legend]

Public Member Functions

virtual bool applyData (const CData &data, CUndoData::CChangeSet &changes)
 
virtual void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const
 
 CUnitDefinition (const CUnitDefinition &src, const CDataContainer *pParent=NO_PARENT)
 
 CUnitDefinition (const std::string &name="NoName", const CDataContainer *pParent=NO_PARENT)
 
virtual const std::string & getKey () const
 
const std::string & getSymbol () const
 
bool isReadOnly () const
 
CUnitDefinitionoperator= (const CUnitDefinition &src)
 
virtual CIssue setExpression (const std::string &expression)
 
bool setSymbol (const std::string &symbol)
 
virtual CData toData () const
 
 ~CUnitDefinition ()
 
- Public Member Functions inherited from CDataContainer
virtual bool add (CDataObject *pObject, const bool &adopt=true)
 
virtual bool appendDeletedDependentData (CUndoData &undoData) const
 
 CDataContainer (const CDataContainer &src, const CDataContainer *pParent)
 
 CDataContainer (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
virtual std::string getChildObjectUnits (const CDataObject *pObject) const
 
void getDescendants (CDataObject::DataObjectSet &descendants, const bool &recursive=false) const
 
virtual size_t getIndex (const CDataObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCommonName &cn) const override
 
virtual objectMapgetObjects ()
 
virtual const objectMapgetObjects () const
 
virtual const std::string getUnits () const override
 
virtual const CDataObjectgetValueObject () const override
 
virtual CUndoObjectInterfaceinsert (const CData &data) override
 
void objectRenamed (CDataObject *pObject, const std::string &oldName)
 
virtual bool remove (CDataObject *pObject)
 
virtual ~CDataContainer ()
 
- Public Member Functions inherited from CDataObject
void addIssue (const CIssue &issue)
 
void addReference (const CDataContainer *pReference)
 
virtual void calculateValue () override
 
 CDataObject (const CDataObject &src, const CDataContainer *pParent=NULL)
 
virtual void destruct () override
 
virtual CCommonName getCN () const override
 
virtual const CDataObjectgetDataObject () const override
 
CDataContainergetObjectAncestor (const std::string &type) const
 
CDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName () const override
 
const CObjectInterfacegetObjectFromCN (const CCommonName &cn) const
 
const std::string & getObjectName () const
 
CDataContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const CObjectInterface::ObjectSetgetPrerequisites () const override
 
virtual const CValiditygetValidity () const override
 
virtual void * getValuePointer () const override
 
bool hasFlag (const Flag &flag) const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CCore::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const override
 
bool prerequisitsContains (const DataObjectSet &objects) const
 
virtual void print (std::ostream *ostream) const override
 
void removeIssue (const CIssue &issue)
 
void removeReference (const CDataContainer *pReference)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CDataContainer *pParent)
 
void validityChanged (const CValidity &changedValidity) override
 
void validityRemoved (const CValidity &changedValidity)
 
virtual ~CDataObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
 CObjectInterface (const CObjectInterface &src)
 
virtual ~CObjectInterface ()
 
- Public Member Functions inherited from CUndoObjectInterface
 CUndoObjectInterface ()
 
 CUndoObjectInterface (const CUndoObjectInterface &src)
 
bool generateUuid ()
 
const xg::Guid & getUuid () const
 
bool setUuid (const std::string &uuid)
 
bool setUuid (const xg::Guid &uuid)
 
virtual void updateIndex (const size_t &index, const CUndoObjectInterface *pUndoObject)
 
virtual ~CUndoObjectInterface ()
 
- Public Member Functions inherited from CUnit
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 ~CUnit ()
 
- Public Member Functions inherited from CAnnotation
bool addUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
bool applyData (const CData &data, CUndoData::CChangeSet &changes)
 
 CAnnotation ()
 
 CAnnotation (const CAnnotation &src)
 
void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const
 
const std::string & getMiriamAnnotation () const
 
const std::string & getNotes () const
 
UnsupportedAnnotationgetUnsupportedAnnotations ()
 
const UnsupportedAnnotationgetUnsupportedAnnotations () const
 
void initMiriamAnnotation (const std::string &newId)
 
bool operator== (const CAnnotation &rhs) const
 
bool removeUnsupportedAnnotation (const std::string &name)
 
bool replaceUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
void setMiriamAnnotation (const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
 
void setNotes (const std::string &notes)
 
CData toData () const
 
virtual ~CAnnotation ()
 

Static Public Member Functions

static CUnitDefinitionfromData (const CData &data, CUndoObjectInterface *pParent)
 
static CUnit getSIUnit (const std::string &symbol)
 
static bool isBuiltinUnitSymbol (std::string symbol)
 
static void updateSIUnitDefinitions (CUnitDefinitionDB *Units)
 
- Static Public Member Functions inherited from CDataContainer
static CDataContainerfromData (const CData &data, CUndoObjectInterface *pParent)
 
- Static Public Member Functions inherited from CDataObject
static CDataObjectfromData (const CData &data, CUndoObjectInterface *pParent)
 
static void sanitizeObjectName (std::string &name)
 
- Static Public Member Functions inherited from CObjectInterface
static const CDataObjectDataObject (const CObjectInterface *pInterface)
 
static CObjectInterfaceGetObjectFromCN (const ContainerList &listOfContainer, const CCommonName &objName)
 
- Static Public Member Functions inherited from CUndoObjectInterface
template<class CType >
static CType * fromData (const CData &, CUndoObjectInterface *)
 
- Static Public Member Functions inherited from CUnit
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 Member Functions inherited from CAnnotation
static CMIRIAMInfoallocateMiriamInfo (CDataContainer *pParent)
 
static CAnnotationcastObject (CDataObject *pObject)
 
static const CAnnotationcastObject (const CDataObject *pObject)
 
static void freeMiriamInfo (CDataContainer *pParent)
 

Private Member Functions

void setup ()
 

Private Attributes

bool mReadOnly
 
std::string mSymbol
 

Friends

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

Additional Inherited Members

- Public Types inherited from CDataContainer
typedef CDataObjectMap objectMap
 
- Public Types inherited from CDataObject
typedef std::set< const CDataObject * > DataObjectSet
 
enum  Flag {
  Container , Vector , Matrix , NameVector ,
  Reference , ValueBool , ValueInt , ValueInt64 ,
  ValueDbl , NonUniqueName , StaticString , ValueString ,
  Separator , DisplayName , ModelEntity , Array ,
  DataModel , Root , Gui , __SIZE
}
 
- Public Types inherited from CObjectInterface
typedef std::vector< const CDataContainer * > ContainerList
 
typedef std::set< const CObjectInterface * > ObjectSet
 
- Public Types inherited from CUnit
enum  UnitType {
  time = 0 , quantity , volume , area ,
  length
}
 
- Public Types inherited from CAnnotation
typedef std::map< std::string, std::string > UnsupportedAnnotation
 
- Static Public Attributes inherited from CDataContainer
static const CObjectInterface::ContainerList EmptyList
 
- Static Public Attributes inherited from CUnit
static C_FLOAT64 Avogadro
 
- Protected Member Functions inherited from CDataContainer
template<class CType >
CDataMatrixReference< CType > * addMatrixReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataObjectReference< CType > * addObjectReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataVectorReference< CType > * addVectorReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
 CDataContainer (const CDataContainer &src)
 
void initObjects ()
 
- Protected Member Functions inherited from CDataObject
 CDataObject ()
 
 CDataObject (const std::string &name, const CDataContainer *pParent=static_cast< CDataContainer * >((void *) 0), const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
- Protected Attributes inherited from CDataContainer
objectMap mObjects
 
- Protected Attributes inherited from CDataObject
ObjectSet mPrerequisits
 
std::set< CDataContainer * > mReferences
 
- Protected Attributes inherited from CObjectInterface
CValidity mValidity
 
- Protected Attributes inherited from CAnnotation
std::string mKey
 

Constructor & Destructor Documentation

◆ CUnitDefinition() [1/2]

CUnitDefinition::CUnitDefinition ( const std::string &  name = "NoName",
const CDataContainer pParent = NO_PARENT 
)

Default constructor

Parameters
conststd::string & name (default: "NoName")
constCDataContainer * pParent (default: NULL)

References CKeyFactory::add(), CRootContainer::getKeyFactory(), CAnnotation::initMiriamAnnotation(), CAnnotation::mKey, and setup().

Referenced by fromData(), and updateSIUnitDefinitions().

◆ CUnitDefinition() [2/2]

CUnitDefinition::CUnitDefinition ( const CUnitDefinition src,
const CDataContainer pParent = NO_PARENT 
)

◆ ~CUnitDefinition()

Member Function Documentation

◆ applyData()

bool CUnitDefinition::applyData ( const CData data,
CUndoData::CChangeSet changes 
)
virtual

Apply the provided data to the object

Parameters
constCData & data
Returns
bool success

Reimplemented from CDataContainer.

References CAnnotation::applyData(), CDataContainer::applyData(), CData::getProperty(), CData::isSetProperty(), mSymbol, setExpression(), CDataValue::toString(), CData::UNIT_EXPRESSION, and CData::UNIT_SYMBOL.

◆ createUndoData()

void CUnitDefinition::createUndoData ( CUndoData undoData,
const CUndoData::Type type,
const CData oldData = CData(),
const CCore::Framework framework = CCore::Framework::ParticleNumbers 
) const
virtual

Create the undo data which represents the changes recording the differences between the provided oldData and the current data.

Parameters
CUndoData& undoData
constCUndoData::Type & type
constCData & oldData (default: empty data)
constCCore::Framework & framework (default: CCore::Framework::ParticleNumbers)
Returns
CUndoData undoData

Reimplemented from CDataContainer.

References CUndoData::addProperty(), CUndoData::CHANGE, CAnnotation::createUndoData(), CDataContainer::createUndoData(), CUnit::getExpression(), CData::getProperty(), mSymbol, CData::UNIT_EXPRESSION, and CData::UNIT_SYMBOL.

◆ fromData()

CUnitDefinition * CUnitDefinition::fromData ( const CData data,
CUndoObjectInterface pParent 
)
static

Static method to create a CDataObject based on the provided data

Parameters
constCData & data
Returns
CUnitDefinition * pDataObject

References CUnitDefinition(), CData::getProperty(), NO_PARENT, CData::OBJECT_NAME, and CDataValue::toString().

◆ getKey()

const std::string & CUnitDefinition::getKey ( ) const
virtual

Retrieve the key

Returns
std::string key

Reimplemented from CAnnotation.

References CAnnotation::getKey().

Referenced by UnitDefinitionHandler::processEnd(), and CCopasiXML::saveUnitDefinitionList().

◆ getSIUnit()

CUnit CUnitDefinition::getSIUnit ( const std::string &  symbol)
static

◆ getSymbol()

◆ isBuiltinUnitSymbol()

bool CUnitDefinition::isBuiltinUnitSymbol ( std::string  symbol)
static

References SIUnits, and SIUnit::symbol.

◆ isReadOnly()

bool CUnitDefinition::isReadOnly ( ) const

References mReadOnly.

Referenced by CCopasiXML::saveUnitDefinitionList().

◆ operator=()

◆ setExpression()

◆ setSymbol()

◆ setup()

◆ toData()

CData CUnitDefinition::toData ( ) const
virtual

◆ updateSIUnitDefinitions()

Friends And Related Function Documentation

◆ operator<<

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

Member Data Documentation

◆ mReadOnly

bool CUnitDefinition::mReadOnly
private

◆ mSymbol

std::string CUnitDefinition::mSymbol
private

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