ARC SDK
Public Member Functions
Arc::SoftwareRequirement Class Reference

Class used to express and resolve version requirements on software. More...

#include <arc/compute/Software.h>

Public Member Functions

 SoftwareRequirement ()
 Create a empty SoftwareRequirement object. More...
 
 SoftwareRequirement (const Software &sw, Software::ComparisonOperatorEnum co)
 Create a SoftwareRequirement object. More...
 
SoftwareRequirementoperator= (const SoftwareRequirement &sr)
 Assignment operator. More...
 
 SoftwareRequirement (const SoftwareRequirement &sr)
 Copy constructor. More...
 
void add (const Software &sw, Software::ComparisonOperatorEnum co)
 Add a Software object a corresponding comparion operator to this object. More...
 
bool isSatisfied (const Software &sw) const
 Test if requirements are satisfied. More...
 
bool isSatisfied (const std::list< Software > &swList) const
 Test if requirements are satisfied. More...
 
bool isSatisfied (const std::list< ApplicationEnvironment > &swList) const
 Test if requirements are satisfied. More...
 
bool selectSoftware (const Software &sw)
 Select software. More...
 
bool selectSoftware (const std::list< Software > &swList)
 Select software. More...
 
bool selectSoftware (const std::list< ApplicationEnvironment > &swList)
 Select software. More...
 
bool isResolved () const
 Indicates whether requirements have been resolved or not. More...
 
bool empty () const
 Test if the object is empty. More...
 
void clear ()
 Clear the object. More...
 
const std::list< Software > & getSoftwareList () const
 Get list of Software objects. More...
 
const std::list< Software::ComparisonOperatorEnum > & getComparisonOperatorList () const
 Get list of comparison operators. More...
 

Detailed Description

Class used to express and resolve version requirements on software.

A requirement in this class is defined as a pair composed of a Software object and either a Software::ComparisonOperator method pointer or equally a Software::ComparisonOperatorEnum enum value. A SoftwareRequirement object can contain multiple of such requirements, and then it can specified if all these requirements should be satisfied, or if it is enough to satisfy only one of them. The requirements can be satisfied by a single Software object or a list of either Software or ApplicationEnvironment objects, by using the method isSatisfied(). This class also contain a number of methods (selectSoftware()) to select Software objects which are satisfying the requirements, and in this way resolving requirements.

Constructor & Destructor Documentation

◆ SoftwareRequirement() [1/3]

Arc::SoftwareRequirement::SoftwareRequirement ( )
inline

Create a empty SoftwareRequirement object.

The created SoftwareRequirement object will contain no requirements.

◆ SoftwareRequirement() [2/3]

Arc::SoftwareRequirement::SoftwareRequirement ( const Software sw,
Software::ComparisonOperatorEnum  co 
)

Create a SoftwareRequirement object.

The created SoftwareRequirement object will contain one requirement specified by the Software object sw, and the Software::ComparisonOperatorEnum co.

Parameters
swis the Software object of the requirement to add.
cois the Software::ComparisonOperatorEnum of the requirement to add.

◆ SoftwareRequirement() [3/3]

Arc::SoftwareRequirement::SoftwareRequirement ( const SoftwareRequirement sr)
inline

Copy constructor.

Create a SoftwareRequirement object from another SoftwareRequirement object.

Parameters
sris the SoftwareRequirement object to make a copy of.

Member Function Documentation

◆ add()

void Arc::SoftwareRequirement::add ( const Software sw,
Software::ComparisonOperatorEnum  co 
)

Add a Software object a corresponding comparion operator to this object.

Adds software name and version to list of requirements and associates the comparison operator with it (equality by default).

Parameters
swis the Software object to add as part of a requirement.
cois the Software::ComparisonOperatorEnum value to add as part of a requirement, the default enum will be Software::EQUAL.

◆ clear()

void Arc::SoftwareRequirement::clear ( )
inline

Clear the object.

The requirements in this object will be cleared when invoking this method.

◆ empty()

bool Arc::SoftwareRequirement::empty ( ) const
inline

Test if the object is empty.

Returns
true if this object do no contain any requirements, otherwise false.

◆ getComparisonOperatorList()

const std::list<Software::ComparisonOperatorEnum>& Arc::SoftwareRequirement::getComparisonOperatorList ( ) const
inline

Get list of comparison operators.

Returns
The list of internally stored comparison operators is returned.
See also
Software::ComparisonOperatorEnum,
getSoftwareList.

◆ getSoftwareList()

const std::list<Software>& Arc::SoftwareRequirement::getSoftwareList ( ) const
inline

Get list of Software objects.

Returns
The list of internally stored Software objects is returned.
See also
Software,
getComparisonOperatorList.

◆ isResolved()

bool Arc::SoftwareRequirement::isResolved ( ) const

Indicates whether requirements have been resolved or not.

If specified that only one requirement has to be satisfied, then for this object to be resolved it can only contain one requirement and it has use the equal operator (Software::operator==).

If specified that all requirements has to be satisfied, then for this object to be resolved each requirement must have a Software object with a unique family/name composition, i.e. no other requirements have a Software object with the same family/name composition, and each requirement must use the equal operator (Software::operator==).

If this object has been resolved then true is returned when invoking this method, otherwise false is returned.

Returns
true if this object have been resolved, otherwise false.

◆ isSatisfied() [1/3]

bool Arc::SoftwareRequirement::isSatisfied ( const Software sw) const
inline

Test if requirements are satisfied.

Returns true if the requirements are satisfied by the specified Software sw, otherwise false is returned.

Parameters
swis the Software which should satisfy the requirements.
Returns
true if requirements are satisfied, otherwise false.
See also
isSatisfied(const std::list<Software>&) const,
isSatisfied(const std::list<ApplicationEnvironment>&) const,
selectSoftware(const Software&),
isResolved() const.

◆ isSatisfied() [2/3]

bool Arc::SoftwareRequirement::isSatisfied ( const std::list< Software > &  swList) const
inline

Test if requirements are satisfied.

Returns true if stored requirements are satisfied by software specified in swList, otherwise false is returned.

Note that if all requirements must be satisfied and multiple requirements exist having identical name and family all these requirements should be satisfied by a single Software object.

Parameters
swListis the list of Software objects which should be used to try satisfy the requirements.
Returns
true if requirements are satisfied, otherwise false.
See also
isSatisfied(const Software&) const,
isSatisfied(const std::list<ApplicationEnvironment>&) const,
selectSoftware(const std::list<Software>&),
isResolved() const.

◆ isSatisfied() [3/3]

bool Arc::SoftwareRequirement::isSatisfied ( const std::list< ApplicationEnvironment > &  swList) const

Test if requirements are satisfied.

This method behaves in exactly the same way as the isSatisfied(const Software&) const method does.

Parameters
swListis the list of ApplicationEnvironment objects which should be used to try satisfy the requirements.
Returns
true if requirements are satisfied, otherwise false.
See also
isSatisfied(const Software&) const,
isSatisfied(const std::list<Software>&) const,
selectSoftware(const std::list<ApplicationEnvironment>&),
isResolved() const.

◆ operator=()

SoftwareRequirement& Arc::SoftwareRequirement::operator= ( const SoftwareRequirement sr)

Assignment operator.

Set this object equal to that of the passed SoftwareRequirement object sr.

Parameters
sris the SoftwareRequirement object to set object equal to.
Python interface deviation
Method is unavailable in Python interface

◆ selectSoftware() [1/3]

bool Arc::SoftwareRequirement::selectSoftware ( const Software sw)
inline

Select software.

If the passed Software sw do not satisfy the requirements false is returned and this object is not modified. If however the Software object sw do satisfy the requirements true is returned and the requirements are set to equal the sw Software object.

Parameters
swis the Software object used to satisfy requirements.
Returns
true if requirements are satisfied, otherwise false.
See also
selectSoftware(const std::list<Software>&),
selectSoftware(const std::list<ApplicationEnvironment>&),
isSatisfied(const Software&) const,
isResolved() const.

◆ selectSoftware() [2/3]

bool Arc::SoftwareRequirement::selectSoftware ( const std::list< Software > &  swList)

Select software.

If the passed list of Software objects swList do not satisfy the requirements false is returned and this object is not modified. If however the list of Software objects swList do satisfy the requirements true is returned and the Software objects satisfying the requirements will replace these with the equality operator (Software::operator==) used as the comparator for the new requirements.

Note that if all requirements must be satisfied and multiple requirements exist having identical name and family all these requirements should be satisfied by a single Software object and it will replace all these requirements.

Parameters
swListis a list of Software objects used to satisfy requirements.
Returns
true if requirements are satisfied, otherwise false.
See also
selectSoftware(const Software&),
selectSoftware(const std::list<ApplicationEnvironment>&),
isSatisfied(const std::list<Software>&) const,
isResolved() const.

◆ selectSoftware() [3/3]

bool Arc::SoftwareRequirement::selectSoftware ( const std::list< ApplicationEnvironment > &  swList)

Select software.

This method behaves exactly as the selectSoftware(const std::list<Software>&) method does.

Parameters
swListis a list of ApplicationEnvironment objects used to satisfy requirements.
Returns
true if requirements are satisfied, otherwise false.
See also
selectSoftware(const Software&),
selectSoftware(const std::list<Software>&),
isSatisfied(const std::list<ApplicationEnvironment>&) const,
isResolved() const.

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