COPASI API  4.40.278
CModelVersionHierarchy Class Reference

#include <CModelVersionHierarchy.h>

Public Types

typedef CNodeIterator< NodeTypeiterator
 
typedef CCopasiNode< CModelVersionNodeType
 

Public Member Functions

int addVersion (std::string version, std::string authorGivenName, std::string authorFamilyName, std::string authorOrganization, std::string authorEmail, std::string comment)
 
void clear ()
 
 CModelVersionHierarchy (CDataModel &dataModel)
 
int deleteVersion (std::string Version)
 
const CModelVersiongetCurrentVersion () const
 
std::string getDiretory () const
 
iterator getNodeIterator ()
 
const CModelVersiongetParentVersion (const CModelVersion &version) const
 
const CModelVersiongetParentVersion (const std::string &version) const
 
CModelVersiongetVersion (const std::string &version)
 
const CModelVersiongetVersion (const std::string &version) const
 
std::string getVersionDirectory (const CModelVersion &version) const
 
std::string getVersionDirectory (const std::string &version) const
 
int readVersionXML ()
 
int restoreVersion (std::string Version)
 
void setCurrentVersion (std::string Version)
 
size_t size () const
 
 ~CModelVersionHierarchy ()
 

Private Member Functions

int addVersion (const CModelVersion &version)
 
 CModelVersionHierarchy ()
 
bool doesVersionExist (std::string Version)
 
bool updateVersionXML ()
 

Static Private Member Functions

static void addChild (NodeType *pParent, NodeType *pChild)
 

Private Attributes

NodeTypempCurrentVersion
 
CDataModelmpDataModel
 
NodeTypempRoot
 
std::map< std::string, NodeType * > mVersionNames
 

Member Typedef Documentation

◆ iterator

◆ NodeType

Constructor & Destructor Documentation

◆ CModelVersionHierarchy() [1/2]

CModelVersionHierarchy::CModelVersionHierarchy ( )
private

Default constructor

References CCopasiNode< _Data >::getData(), mpCurrentVersion, mpRoot, and mVersionNames.

◆ CModelVersionHierarchy() [2/2]

CModelVersionHierarchy::CModelVersionHierarchy ( CDataModel dataModel)

Specific constructor

Parameters
CDataModel& dataModel

References CCopasiNode< _Data >::getData(), mpCurrentVersion, mpRoot, and mVersionNames.

◆ ~CModelVersionHierarchy()

CModelVersionHierarchy::~CModelVersionHierarchy ( )

Destructor

Member Function Documentation

◆ addChild()

void CModelVersionHierarchy::addChild ( NodeType pParent,
NodeType pChild 
)
staticprivate

◆ addVersion() [1/2]

int CModelVersionHierarchy::addVersion ( const CModelVersion version)
private

Add a new version to Model Version Hierarchy data table Set this new version as the parent of current version Update Versioning Hierarchy XML file Returns: 1 if the version is repeated 2: if the version name is empty 3: if the version name has added to table but XML file was not updated successfully 0: for succes

References addChild(), doesVersionExist(), CCopasiNode< _Data >::getData(), CModelVersion::getName(), CModelVersion::getParentName(), mVersionNames, and CCopasiNode< _Data >::setData().

◆ addVersion() [2/2]

int CModelVersionHierarchy::addVersion ( std::string  version,
std::string  authorGivenName,
std::string  authorFamilyName,
std::string  authorOrganization,
std::string  authorEmail,
std::string  comment 
)

Add a new version to Model Version Hierarchy data table Set this new version as the parent of current version Update Versioning Hierarchy XML file Returns: 1 if the version is repeated 2: if the version name is empty 3: if the version name has added to table but XML file was not updated successfully 0: for succes

References CDirEntry::copy(), CDirEntry::createDir(), CDirEntry::dirName(), CDirEntry::fileName(), CCopasiNode< _Data >::getData(), CDataModel::getFileName(), CModelVersion::getName(), getVersionDirectory(), mpCurrentVersion, mpDataModel, setCurrentVersion(), updateVersionXML(), and UTCTimeStamp().

Referenced by readVersionXML().

◆ clear()

void CModelVersionHierarchy::clear ( )

Clear CModelVersion data when a new session starts

◆ deleteVersion()

int CModelVersionHierarchy::deleteVersion ( std::string  Version)

Delete a given version from Model Version Hierarchy data table The root version of versioning hierarchy cannot be deleted in the existence of other versions if 'version == parent of current version' then reset parent of current version to its parent Update Versioning Hierarchy XML file Returns: 1: if the Version is empty 2: if the Version does not exist 3: if the Version is the root version of versioning hierarchy and it is not the only saved version 4: if the version name has been deleted from the table but XML file was not updated successfully 0: success

References addChild(), CCopasiNode< _Data >::getChild(), CCopasiNode< _Data >::getData(), CCopasiNode< _Data >::getParent(), getVersionDirectory(), mpCurrentVersion, mVersionNames, CDirEntry::remove(), CCopasiNode< _Data >::removeChild(), CDirEntry::removeFiles(), and updateVersionXML().

◆ doesVersionExist()

bool CModelVersionHierarchy::doesVersionExist ( std::string  Version)
private

Returns true if Version exists in Model Versioning Hierarchy table

References mVersionNames.

Referenced by addVersion().

◆ getCurrentVersion()

const CModelVersion & CModelVersionHierarchy::getCurrentVersion ( ) const

Retrieve the last created or restored version

References CCopasiNode< _Data >::getData(), and mpCurrentVersion.

◆ getDiretory()

std::string CModelVersionHierarchy::getDiretory ( ) const

Retrieve the Path to the versioning data files

References CDataModel::getReferenceDirectory(), and mpDataModel.

Referenced by getVersionDirectory(), readVersionXML(), and updateVersionXML().

◆ getNodeIterator()

CModelVersionHierarchy::iterator CModelVersionHierarchy::getNodeIterator ( )

◆ getParentVersion() [1/2]

const CModelVersion & CModelVersionHierarchy::getParentVersion ( const CModelVersion version) const

◆ getParentVersion() [2/2]

const CModelVersion & CModelVersionHierarchy::getParentVersion ( const std::string &  version) const

Return Parent Version of a given Version

References mVersionNames.

Referenced by getParentVersion().

◆ getVersion() [1/2]

CModelVersion & CModelVersionHierarchy::getVersion ( const std::string &  version)

References mVersionNames.

Referenced by updateVersionXML().

◆ getVersion() [2/2]

const CModelVersion & CModelVersionHierarchy::getVersion ( const std::string &  version) const

References mVersionNames.

◆ getVersionDirectory() [1/2]

std::string CModelVersionHierarchy::getVersionDirectory ( const CModelVersion version) const

◆ getVersionDirectory() [2/2]

std::string CModelVersionHierarchy::getVersionDirectory ( const std::string &  version) const

Returns a list of Versions from the root to the Parent of Current Model In provenance all the edits from begining to the current model is needed

References CCopasiNode< _Data >::getData(), getDiretory(), mpRoot, and mVersionNames.

Referenced by addVersion(), deleteVersion(), getVersionDirectory(), and restoreVersion().

◆ readVersionXML()

int CModelVersionHierarchy::readVersionXML ( )

Read Versioning Hierarachy XML data file when a file with versioning is opened Returns: 1: if the verioning hierarchy XML file does not exist 2: if the file is parsed but some error(s) has occured 3: if the file cannot be parsed 0: success

References addVersion(), CDirEntry::exist(), CCopasiNode< _Data >::getData(), getDiretory(), mpCurrentVersion, mpRoot, mVersionNames, and setCurrentVersion().

◆ restoreVersion()

int CModelVersionHierarchy::restoreVersion ( std::string  Version)

Restore a model with a given version name Set the parent of current model as the given version Update Versioning Hierarchy XML file Returns: 1: if the Version is empty 2: if the Version does not exist 3: if the version name has been restored but XML file was not updated successfully 0: success

References CDirEntry::copy(), CCopasiNode< _Data >::getData(), CDataModel::getFileName(), getVersionDirectory(), mpCurrentVersion, mpDataModel, mVersionNames, and updateVersionXML().

◆ setCurrentVersion()

void CModelVersionHierarchy::setCurrentVersion ( std::string  Version)

Restore the last saved Version as the parrent of current session before quiting the current session Also XML file must be updated

References mpCurrentVersion, and mVersionNames.

Referenced by addVersion(), and readVersionXML().

◆ size()

size_t CModelVersionHierarchy::size ( ) const

◆ updateVersionXML()

Member Data Documentation

◆ mpCurrentVersion

◆ mpDataModel

CDataModel* CModelVersionHierarchy::mpDataModel
private

◆ mpRoot

◆ mVersionNames

std::map< std::string, NodeType * > CModelVersionHierarchy::mVersionNames
private

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