ARC SDK
|
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... | |
SoftwareRequirement & | operator= (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... | |
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.
|
inline |
Create a empty SoftwareRequirement object.
The created SoftwareRequirement object will contain no requirements.
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.
sw | is the Software object of the requirement to add. |
co | is the Software::ComparisonOperatorEnum of the requirement to add. |
|
inline |
Copy constructor.
Create a SoftwareRequirement object from another SoftwareRequirement object.
sr | is the SoftwareRequirement object to make a copy of. |
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).
sw | is the Software object to add as part of a requirement. |
co | is the Software::ComparisonOperatorEnum value to add as part of a requirement, the default enum will be Software::EQUAL. |
|
inline |
Clear the object.
The requirements in this object will be cleared when invoking this method.
|
inline |
Test if the object is empty.
true
if this object do no contain any requirements, otherwise false
.
|
inline |
Get list of comparison operators.
|
inline |
Get list of Software objects.
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.
true
if this object have been resolved, otherwise false
.
|
inline |
|
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.
swList | is the list of Software objects which should be used to try satisfy the requirements. |
true
if requirements are satisfied, otherwise false
. 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.
swList | is the list of ApplicationEnvironment objects which should be used to try satisfy the requirements. |
true
if requirements are satisfied, otherwise false
. SoftwareRequirement& Arc::SoftwareRequirement::operator= | ( | const SoftwareRequirement & | sr | ) |
Assignment operator.
Set this object equal to that of the passed SoftwareRequirement object sr.
sr | is the SoftwareRequirement object to set object equal to. |
|
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.
sw | is the Software object used to satisfy requirements. |
true
if requirements are satisfied, otherwise false
. 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.
swList | is a list of Software objects used to satisfy requirements. |
true
if requirements are satisfied, otherwise false
. bool Arc::SoftwareRequirement::selectSoftware | ( | const std::list< ApplicationEnvironment > & | swList | ) |
Select software.
This method behaves exactly as the selectSoftware(const std::list<Software>&) method does.
swList | is a list of ApplicationEnvironment objects used to satisfy requirements. |
true
if requirements are satisfied, otherwise false
.