COPASI API
4.40.278
|
#include <CModelVersionHierarchy.h>
Public Types | |
typedef CNodeIterator< NodeType > | iterator |
typedef CCopasiNode< CModelVersion > | NodeType |
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 CModelVersion & | getCurrentVersion () const |
std::string | getDiretory () const |
iterator | getNodeIterator () |
const CModelVersion & | getParentVersion (const CModelVersion &version) const |
const CModelVersion & | getParentVersion (const std::string &version) const |
CModelVersion & | getVersion (const std::string &version) |
const CModelVersion & | getVersion (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 | |
NodeType * | mpCurrentVersion |
CDataModel * | mpDataModel |
NodeType * | mpRoot |
std::map< std::string, NodeType * > | mVersionNames |
|
private |
Default constructor
References CCopasiNode< _Data >::getData(), mpCurrentVersion, mpRoot, and mVersionNames.
CModelVersionHierarchy::CModelVersionHierarchy | ( | CDataModel & | dataModel | ) |
Specific constructor
CDataModel | & dataModel |
References CCopasiNode< _Data >::getData(), mpCurrentVersion, mpRoot, and mVersionNames.
CModelVersionHierarchy::~CModelVersionHierarchy | ( | ) |
Destructor
References CCopasiNode< _Data >::addChild(), CCopasiNode< _Data >::getChild(), CCopasiNode< _Data >::getData(), and CCopasiNode< _Data >::getSibling().
Referenced by addVersion(), and deleteVersion().
|
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().
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().
void CModelVersionHierarchy::clear | ( | ) |
Clear CModelVersion data when a new session starts
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().
|
private |
Returns true if Version exists in Model Versioning Hierarchy table
References mVersionNames.
Referenced by addVersion().
const CModelVersion & CModelVersionHierarchy::getCurrentVersion | ( | ) | const |
Retrieve the last created or restored version
References CCopasiNode< _Data >::getData(), and mpCurrentVersion.
std::string CModelVersionHierarchy::getDiretory | ( | ) | const |
Retrieve the Path to the versioning data files
References CDataModel::getReferenceDirectory(), and mpDataModel.
Referenced by getVersionDirectory(), readVersionXML(), and updateVersionXML().
CModelVersionHierarchy::iterator CModelVersionHierarchy::getNodeIterator | ( | ) |
Retrieve a node iterator
References CNodeIteratorMode::Before, mpRoot, CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::setProcessingModes().
Referenced by updateVersionXML().
const CModelVersion & CModelVersionHierarchy::getParentVersion | ( | const CModelVersion & | version | ) | const |
References CModelVersion::getName(), and getParentVersion().
const CModelVersion & CModelVersionHierarchy::getParentVersion | ( | const std::string & | version | ) | const |
Return Parent Version of a given Version
References mVersionNames.
Referenced by getParentVersion().
CModelVersion & CModelVersionHierarchy::getVersion | ( | const std::string & | version | ) |
References mVersionNames.
Referenced by updateVersionXML().
const CModelVersion & CModelVersionHierarchy::getVersion | ( | const std::string & | version | ) | const |
References mVersionNames.
std::string CModelVersionHierarchy::getVersionDirectory | ( | const CModelVersion & | version | ) | const |
References CModelVersion::getName(), and getVersionDirectory().
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().
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().
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().
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_t CModelVersionHierarchy::size | ( | ) | const |
Retrieve the number of saved versions
References C_INVALID_INDEX, CNodeContextIterator< Node, Context >::end(), mpRoot, and CNodeContextIterator< Node, Context >::next().
|
private |
Returns true if Version XML file updated successfully
References CDirEntry::createTmpName(), CNodeContextIterator< Node, Context >::end(), CLocaleString::fromUtf8(), CCopasiNode< _Data >::getData(), getDiretory(), getNodeIterator(), COptions::getValue(), getVersion(), CDirEntry::move(), mpCurrentVersion, mpRoot, CNodeContextIterator< Node, Context >::next(), CDirEntry::remove(), and CVersion::VERSION.
Referenced by addVersion(), deleteVersion(), and restoreVersion().
|
private |
|
private |
Referenced by addVersion(), getDiretory(), and restoreVersion().
|
private |
Referenced by CModelVersionHierarchy(), getNodeIterator(), getVersionDirectory(), readVersionXML(), size(), and updateVersionXML().
|
private |
A set to enforce unique version names
Referenced by addVersion(), CModelVersionHierarchy(), deleteVersion(), doesVersionExist(), getParentVersion(), getVersion(), getVersionDirectory(), readVersionXML(), restoreVersion(), and setCurrentVersion().