Arc::SoftwareRequirement Class Reference

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

#include <Software.h>

Public Member Functions

 SoftwareRequirement ()
 SoftwareRequirement (const Software &sw, Software::ComparisonOperator swComOp)
 SoftwareRequirement (const Software &sw, Software::ComparisonOperatorEnum co=Software::EQUAL)
SoftwareRequirementoperator= (const SoftwareRequirement &sr)
 SoftwareRequirement (const SoftwareRequirement &sr)
void add (const Software &sw, Software::ComparisonOperator swComOp)
void add (const Software &sw, Software::ComparisonOperatorEnum co)
bool isSatisfied (const Software &sw) const
bool isSatisfied (const std::list< Software > &swList) const
bool isSatisfied (const std::list< ApplicationEnvironment > &swList) const
bool selectSoftware (const Software &sw)
bool selectSoftware (const std::list< Software > &swList)
bool selectSoftware (const std::list< ApplicationEnvironment > &swList)
bool isResolved () const
bool empty () const
void clear ()
const std::list< Software > & getSoftwareList () const
const std::list
< Software::ComparisonOperator > & 
getComparisonOperatorList () const

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

Arc::SoftwareRequirement::SoftwareRequirement (  )  [inline]

Create a empty SoftwareRequirement object.

The created SoftwareRequirement object will contain no requirements.

Arc::SoftwareRequirement::SoftwareRequirement ( const Software sw,
Software::ComparisonOperator  swComOp 
)

Create a SoftwareRequirement object.

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

This constructor is not available in language bindings created by Swig, since method pointers are not supported by Swig, see SoftwareRequirement(const Software&, Software::ComparisonOperatorEnum) instead.

Parameters:
sw is the Software object of the requirement to add.
swComOp is the Software::ComparisonOperator of the requirement to add.
Arc::SoftwareRequirement::SoftwareRequirement ( const Software sw,
Software::ComparisonOperatorEnum  co = Software::EQUAL 
)

Create a SoftwareRequirement object.

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

Parameters:
sw is the Software object of the requirement to add.
co is the Software::ComparisonOperatorEnum of the requirement to add.
Arc::SoftwareRequirement::SoftwareRequirement ( const SoftwareRequirement sr  )  [inline]

Copy constructor.

Create a SoftwareRequirement object from another SoftwareRequirement object.

Parameters:
sr is the SoftwareRequirement object to make a copy of.

Member Function Documentation

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:
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.
void Arc::SoftwareRequirement::add ( const Software sw,
Software::ComparisonOperator  swComOp 
)

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).

This method is not available in language bindings created by Swig, since method pointers are not supported by Swig, see add(const Software&, Software::ComparisonOperatorEnum) instead.

Parameters:
sw is the Software object to add as part of a requirement.
swComOp is the Software::ComparisonOperator method pointer to add as part of a requirement, the default operator will be Software::operator==().
void Arc::SoftwareRequirement::clear (  )  [inline]

Clear the object.

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

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

Test if the object is empty.

Returns:
true if this object do no contain any requirements, otherwise false.
const std::list<Software::ComparisonOperator>& Arc::SoftwareRequirement::getComparisonOperatorList (  )  const [inline]

Get list of comparison operators.

Returns:
The list of internally stored comparison operators is returned.
See also:
Software::ComparisonOperator,
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.
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.
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:
swList is 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.
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:
swList is 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.
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:
sw is 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.

References isSatisfied().

Referenced by isSatisfied().

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

Assignment operator.

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

Parameters:
sr is the SoftwareRequirement object to set object equal to.
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:
swList is 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.
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:
swList is 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.
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:
sw is 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.

References selectSoftware().

Referenced by selectSoftware().


The documentation for this class was generated from the following file:
Generated on Wed Jun 27 11:54:19 2012 for Hosting Environment (Daemon) by  doxygen 1.6.3