#include "VersionGraphCfg.h"
Public Types | |
typedef std::list< VersionGraphVersionCfg > | VersionsList |
typedef std::list< VersionsList > | BranchesList |
Public Member Functions | |
VersionGraphCfg () | |
VersionGraphCfg (const VersionGraphCfg &_other)=delete | |
VersionGraphCfg (VersionGraphCfg &&_other) noexcept | |
virtual | ~VersionGraphCfg () |
VersionGraphCfg & | operator= (const VersionGraphCfg &_other)=delete |
VersionGraphCfg & | operator= (VersionGraphCfg &&_other) noexcept |
virtual void | addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override |
Add the object contents to the provided JSON object. | |
virtual void | setFromJsonObject (const ot::ConstJsonObject &_object) override |
Set the object contents from the provided JSON object. | |
void | setActiveVersionName (const std::string &_version) |
const std::string & | getActiveVersionName (void) const |
Returns the active version name. The active version is the currently active model version. | |
void | incrementActiveVersion (void) |
void | setActiveBranchName (const std::string &_version) |
const std::string & | getActiveBranchName (void) const |
Returns the active branch name. The active branch is the currently active branch. All parent versions of this version are in the active branch. | |
VersionGraphVersionCfg & | insertVersion (const std::string &_version, const std::string &_parentVersion, const std::string &_label=std::string(), const std::string &_description=std::string()) |
VersionGraphVersionCfg & | insertVersion (VersionGraphVersionCfg &&_version) |
VersionsList & | insertBranch (VersionsList &&_branch) |
VersionGraphVersionCfg * | findVersion (const std::string &_version) |
Returns the version with the given name. | |
const VersionGraphVersionCfg * | findVersion (const std::string &_version) const |
Returns the version with the given name. | |
const VersionGraphVersionCfg * | findLastVersion (void) |
Returns the last version in the active branch. | |
const VersionGraphVersionCfg * | findLastVersion (const std::string &_branchName) |
Returns the last version in the specified branch. | |
const VersionGraphVersionCfg * | findPreviousVersion (const std::string &_version) const |
Returns the previous version to the specified version. | |
const VersionGraphVersionCfg * | findNextVersion (const std::string &_version) const |
Returns the next version to the specified version by taking the current branch into account. | |
const VersionGraphVersionCfg * | findNextVersion (const std::string &_version, const std::string &_activeBranch) const |
std::list< const VersionGraphVersionCfg * > | findNextVersions (const std::string &_version, const std::string &_lastVersion) |
Returns a list containing all next versions. The resulting list will not contain the specified _version. | |
std::list< const VersionGraphVersionCfg * > | findNextVersions (const std::string &_version, const std::string &_activeBranch, const std::string &_lastVersion) |
std::list< const VersionGraphVersionCfg * > | findAllNextVersions (const std::string &_version) |
Find all child versions of the specified versions. | |
bool | versionIsEndOfBranch (const std::string &_version) const |
Returns true if the version is the last one in its branch. Will return false if the version does not exist or is not the last of its branch. | |
bool | versionStartingWithNameExists (const std::string &_prefix) |
Returns true if a version with the given name prefix exists in any of the versions (Expensive). | |
void | removeVersion (const std::string &_version) |
Removes the version and all of its childs if the version exists (Expensive). | |
bool | getBranchExists (const std::string &_branchName) const |
const std::list< std::list< VersionGraphVersionCfg > > & | getBranches (void) const |
int | getBranchesCountFromNode (const std::string &_version) const |
Returns the number of branches that have the specified version as a branch node. | |
std::list< std::list< VersionGraphVersionCfg > > | getBranchesFromNode (const std::string &_version) const |
Returns a list of direct branches that have the specified version as a branch node. | |
void | clear (void) |
\breif Clear the version graph. | |
Public Member Functions inherited from ot::Serializable | |
Serializable () | |
virtual | ~Serializable () |
Static Public Member Functions | |
static std::string | incrementVersion (const std::string &_version) |
static VersionsList & | insertBranch (VersionsList &&_branch, std::list< VersionsList > &_branchesList) |
typedef std::list<VersionsList> ot::VersionGraphCfg::BranchesList |
typedef std::list<VersionGraphVersionCfg> ot::VersionGraphCfg::VersionsList |
ot::VersionGraphCfg::VersionGraphCfg | ( | ) |
|
delete |
|
noexcept |
|
virtual |
|
overridevirtual |
Add the object contents to the provided JSON object.
_object | Json object reference to write the data to. |
_allocator | Allocator. |
Implements ot::Serializable.
void ot::VersionGraphCfg::clear | ( | void | ) |
\breif Clear the version graph.
std::list< const ot::VersionGraphVersionCfg * > ot::VersionGraphCfg::findAllNextVersions | ( | const std::string & | _version | ) |
Find all child versions of the specified versions.
const ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findLastVersion | ( | const std::string & | _branchName | ) |
Returns the last version in the specified branch.
const ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findLastVersion | ( | void | ) |
Returns the last version in the active branch.
const ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findNextVersion | ( | const std::string & | _version | ) | const |
Returns the next version to the specified version by taking the current branch into account.
const ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findNextVersion | ( | const std::string & | _version, |
const std::string & | _activeBranch ) const |
std::list< const ot::VersionGraphVersionCfg * > ot::VersionGraphCfg::findNextVersions | ( | const std::string & | _version, |
const std::string & | _activeBranch, | ||
const std::string & | _lastVersion ) |
std::list< const ot::VersionGraphVersionCfg * > ot::VersionGraphCfg::findNextVersions | ( | const std::string & | _version, |
const std::string & | _lastVersion ) |
Returns a list containing all next versions. The resulting list will not contain the specified _version.
_version | The version to start searching from. |
_lastVersion | The last version to add to the list. Versions after that will be ignored. |
const ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findPreviousVersion | ( | const std::string & | _version | ) | const |
Returns the previous version to the specified version.
ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findVersion | ( | const std::string & | _version | ) |
Returns the version with the given name.
const ot::VersionGraphVersionCfg * ot::VersionGraphCfg::findVersion | ( | const std::string & | _version | ) | const |
Returns the version with the given name.
|
inline |
Returns the active branch name. The active branch is the currently active branch. All parent versions of this version are in the active branch.
|
inline |
Returns the active version name. The active version is the currently active model version.
|
inline |
int ot::VersionGraphCfg::getBranchesCountFromNode | ( | const std::string & | _version | ) | const |
Returns the number of branches that have the specified version as a branch node.
std::list< std::list< ot::VersionGraphVersionCfg > > ot::VersionGraphCfg::getBranchesFromNode | ( | const std::string & | _version | ) | const |
Returns a list of direct branches that have the specified version as a branch node.
bool ot::VersionGraphCfg::getBranchExists | ( | const std::string & | _branchName | ) | const |
void ot::VersionGraphCfg::incrementActiveVersion | ( | void | ) |
|
static |
ot::VersionGraphCfg::VersionsList & ot::VersionGraphCfg::insertBranch | ( | VersionsList && | _branch | ) |
|
static |
ot::VersionGraphVersionCfg & ot::VersionGraphCfg::insertVersion | ( | const std::string & | _version, |
const std::string & | _parentVersion, | ||
const std::string & | _label = std::string(), | ||
const std::string & | _description = std::string() ) |
ot::VersionGraphVersionCfg & ot::VersionGraphCfg::insertVersion | ( | VersionGraphVersionCfg && | _version | ) |
|
delete |
|
noexcept |
void ot::VersionGraphCfg::removeVersion | ( | const std::string & | _version | ) |
Removes the version and all of its childs if the version exists (Expensive).
|
inline |
|
inline |
|
overridevirtual |
Set the object contents from the provided JSON object.
_object | The JSON object containing the information. |
May | throw an exception if the provided object is not valid (members missing or invalid types). |
Implements ot::Serializable.
bool ot::VersionGraphCfg::versionIsEndOfBranch | ( | const std::string & | _version | ) | const |
Returns true if the version is the last one in its branch. Will return false if the version does not exist or is not the last of its branch.
bool ot::VersionGraphCfg::versionStartingWithNameExists | ( | const std::string & | _prefix | ) |
Returns true if a version with the given name prefix exists in any of the versions (Expensive).