ARC SDK
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends
Arc::Software Class Reference

Used to represent software (names and version) and comparison. More...

#include <arc/compute/Software.h>

Inheritance diagram for Arc::Software:
Arc::ApplicationEnvironment

Public Types

enum  ComparisonOperatorEnum {
  NOTEQUAL = 0, EQUAL = 1, GREATERTHAN = 2, LESSTHAN = 3,
  GREATERTHANOREQUAL = 4, LESSTHANOREQUAL = 5
}
 Comparison operator enum. More...
 
typedef bool(Software::* ComparisonOperator )(const Software &) const
 Definition of a comparison operator method pointer. More...
 

Public Member Functions

 Software ()
 Dummy constructor. More...
 
 Software (const std::string &name_version)
 Create a Software object. More...
 
 Software (const std::string &name, const std::string &version)
 Create a Software object. More...
 
 Software (const std::string &family, const std::string &name, const std::string &version)
 Create a Software object. More...
 
bool empty () const
 Indicates whether the object is empty. More...
 
bool operator== (const Software &sw) const
 Equality operator. More...
 
bool operator!= (const Software &sw) const
 Inequality operator. More...
 
bool operator> (const Software &sw) const
 Greater-than operator. More...
 
bool operator< (const Software &sw) const
 Less-than operator. More...
 
bool operator>= (const Software &sw) const
 Greater-than or equal operator. More...
 
bool operator<= (const Software &sw) const
 Less-than or equal operator. More...
 
std::string operator() () const
 Get string representation. More...
 
 operator std::string (void) const
 Cast to string. More...
 
const std::string & getFamily () const
 Get family. More...
 
const std::string & getName () const
 Get name. More...
 
const std::string & getVersion () const
 Get version. More...
 
const std::list< std::string > & getOptions () const
 
void addOption (const std::string &opt)
 
void addOptions (const std::list< std::string > &opts)
 

Static Public Member Functions

static ComparisonOperator convert (const ComparisonOperatorEnum &co)
 Convert a ComparisonOperatorEnum value to a comparison method pointer. More...
 
static std::string toString (ComparisonOperator co)
 Convert Software::ComparisonOperator to a string. More...
 

Static Public Attributes

static const std::string VERSIONTOKENS
 Tokens used to split version string. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Software &sw)
 Write Software string representation to a std::ostream. More...
 

Detailed Description

Used to represent software (names and version) and comparison.

The Software class is used to represent the name of a piece of software internally. Generally software are identified by a name and possibly a version number. Some software can also be categorized by type or family (compilers, operating system, etc.). A software object can be compared to other software objects using the comparison operators contained in this class. The basic usage of this class is to test if some specified software requirement (SoftwareRequirement) are fulfilled, by using the comparability of the class.

Internally the Software object is represented by a family and name identifier, and the software version is tokenized at the characters defined in VERSIONTOKENS, and stored as a list of tokens.

Member Typedef Documentation

typedef bool(Software::* Arc::Software::ComparisonOperator)(const Software &) const

Definition of a comparison operator method pointer.

This typedef defines a comparison operator method pointer.

See Also
operator==,
operator!=,
operator>,
operator<,
operator>=,
operator<=,
ComparisonOperatorEnum.

Member Enumeration Documentation

Comparison operator enum.

The ComparisonOperatorEnum enumeration is a 1-1 correspondance between the defined comparison method operators (Software::ComparisonOperator), and can be used in circumstances where method pointers are not supported.

Enumerator
NOTEQUAL 

see operator!=

EQUAL 

see operator==

GREATERTHAN 

see operator>

LESSTHAN 

see operator<

GREATERTHANOREQUAL 

see operator>=

LESSTHANOREQUAL 

see operator<=

Constructor & Destructor Documentation

Arc::Software::Software ( )
inline

Dummy constructor.

This constructor creates a empty object.

Arc::Software::Software ( const std::string &  name_version)

Create a Software object.

Create a Software object from a single string composed of a name and a version part. The created object will contain a empty family part. The name and version part of the string will be split at the first occurence of a dash (-) which is followed by a digit (0-9). If the string does not contain such a pattern, the passed string will be taken to be the name and version will be empty.

Parameters
name_versionshould be a string composed of the name and version of the software to represent.
Arc::Software::Software ( const std::string &  name,
const std::string &  version 
)

Create a Software object.

Create a Software object with the specified name and version. The family part will be left empty.

Parameters
namethe software name to represent.
versionthe software version to represent.
Arc::Software::Software ( const std::string &  family,
const std::string &  name,
const std::string &  version 
)

Create a Software object.

Create a Software object with the specified family, name and version.

Parameters
familythe software family to represent.
namethe software name to represent.
versionthe software version to represent.

Member Function Documentation

static ComparisonOperator Arc::Software::convert ( const ComparisonOperatorEnum co)
static

Convert a ComparisonOperatorEnum value to a comparison method pointer.

The passed ComparisonOperatorEnum will be converted to a comparison method pointer defined by the Software::ComparisonOperator typedef.

This static method is not defined in language bindings created with Swig, since method pointers are not supported by Swig.

Parameters
coa ComparisonOperatorEnum value.
Returns
A method pointer to a comparison method is returned.
Python interface deviation
Method is unavailable in Python interface
Java interface deviation
Method is unavailable in Java interface
bool Arc::Software::empty ( ) const
inline

Indicates whether the object is empty.

Returns
true if the name of this object is empty, otherwise false.
const std::string& Arc::Software::getFamily ( ) const
inline

Get family.

Returns
The family the represented software belongs to is returned.
const std::string& Arc::Software::getName ( ) const
inline

Get name.

Returns
The name of the represented software is returned.
const std::string& Arc::Software::getVersion ( ) const
inline

Get version.

Returns
The version of the represented software is returned.
Arc::Software::operator std::string ( void  ) const
inline

Cast to string.

This casting operator behaves exactly as operator()() does. The cast is used like (std::string) <software-object>.

See Also
operator()().
bool Arc::Software::operator!= ( const Software sw) const
inline

Inequality operator.

The behaviour of the inequality operator is just opposite that of the equality operator (operator==()).

Parameters
swis the RHS Software object.
Returns
true when the two objects are inequal, otherwise false.
std::string Arc::Software::operator() ( ) const

Get string representation.

Returns the string representation of this object, which is 'family'-'name'-'version'.

Returns
The string representation of this object is returned.
See Also
operator std::string().
Java interface deviation
Method is unavailable in Java interface
bool Arc::Software::operator< ( const Software sw) const
inline

Less-than operator.

The behaviour of this less-than operator is equivalent to the greater-than operator (operator>()) with the LHS and RHS swapped.

Parameters
swis the RHS object.
Returns
true if the LHS is less than the RHS, otherwise false.
See Also
operator>().
bool Arc::Software::operator<= ( const Software sw) const
inline

Less-than or equal operator.

The LHS object is greater than or equal to the RHS object if the LHS equal the RHS (operator==()) or if the LHS is greater than the RHS (operator>()).

Parameters
swis the RHS object.
Returns
true if the LHS is less than or equal the RHS, otherwise false.
See Also
operator==(),
operator<().
bool Arc::Software::operator== ( const Software sw) const
inline

Equality operator.

Two Software objects are equal only if they are of the same family, have the same name and is of same version. This operator can also be represented by the Software::EQUAL ComparisonOperatorEnum value.

Parameters
swis the RHS Software object.
Returns
true when the two objects equals, otherwise false.
bool Arc::Software::operator> ( const Software sw) const

Greater-than operator.

For the LHS object to be greater than the RHS object they must first share the same family and name. If the version of the LHS is empty or the LHS and RHS versions equal then LHS is not greater than RHS. If the LHS version is not empty while the RHS is then LHS is greater than RHS. If both versions are non empty and not equal then, the first version token of each object is compared and if they are identical, the two next version tokens will be compared. If not identical, the two tokens will be parsed as integers, and if parsing fails the LHS is not greater than the RHS. If parsing succeeds and the integers equals, the two next tokens will be compared, otherwise the comparison is resolved by the integer comparison.

If the LHS contains more version tokens than the RHS, and the comparison have not been resolved at the point of equal number of tokens, then if the additional tokens contains a token which cannot be parsed to a integer the LHS is not greater than the RHS. If the parsed integer is not 0 then the LHS is greater than the RHS. If the rest of the additional tokens are 0, the LHS is not greater than the RHS.

If the RHS contains more version tokens than the LHS and comparison have not been resolved at the point of equal number of tokens, or simply if comparison have not been resolved at the point of equal number of tokens, then the LHS is not greater than the RHS.

Parameters
swis the RHS object.
Returns
true if the LHS is greater than the RHS, otherwise false.
bool Arc::Software::operator>= ( const Software sw) const
inline

Greater-than or equal operator.

The LHS object is greater than or equal to the RHS object if the LHS equal the RHS (operator==()) or if the LHS is greater than the RHS (operator>()).

Parameters
swis the RHS object.
Returns
true if the LHS is greated than or equal the RHS, otherwise false.
See Also
operator==(),
operator>().
static std::string Arc::Software::toString ( ComparisonOperator  co)
static

Convert Software::ComparisonOperator to a string.

This method is not available in language bindings created by Swig, since method pointers are not supported by Swig.

Parameters
cois a Software::ComparisonOperator.
Returns
The string representation of the passed Software::ComparisonOperator is returned.
Python interface deviation
Method is unavailable in Python interface
Java interface deviation
Method is unavailable in Java interface

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Software sw 
)
friend

Write Software string representation to a std::ostream.

Write the string representation of a Software object to a std::ostream.

Parameters
outis a std::ostream to write the string representation of the Software object to.
swis the Software object to write to the std::ostream.
Returns
The passed std::ostream out is returned.

Field Documentation

const std::string Arc::Software::VERSIONTOKENS
static

Tokens used to split version string.

This string constant specifies which tokens will be used to split the version string.

Java interface deviation
The member is only accessible through the getVERSIONTOKENS and setVERSIONTOKENS methods in the Java interface

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