Arc::Software Class Reference

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

#include <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
}
typedef bool(Software::* ComparisonOperator )(const Software &) const

Public Member Functions

 Software ()
 Software (const std::string &name_version)
 Software (const std::string &name, const std::string &version)
 Software (const std::string &family, const std::string &name, const std::string &version)
bool empty () const
bool operator== (const Software &sw) const
bool operator!= (const Software &sw) const
bool operator> (const Software &sw) const
bool operator< (const Software &sw) const
bool operator>= (const Software &sw) const
bool operator<= (const Software &sw) const
std::string operator() () const
 operator std::string (void) const
const std::string & getFamily () const
const std::string & getName () const
const std::string & getVersion () const

Static Public Member Functions

static ComparisonOperator convert (const ComparisonOperatorEnum &co)
static std::string toString (ComparisonOperator co)

Static Public Attributes

static const std::string VERSIONTOKENS

Friends

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

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_version should 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:
name the software name to represent.
version the 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:
family the software family to represent.
name the software name to represent.
version the 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:
co a ComparisonOperatorEnum value.
Returns:
A method pointer to a comparison method is returned.
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()().

References 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:
sw is the RHS Software object.
Returns:
true when the two objects are inequal, otherwise false.

References operator==().

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

Referenced by operator std::string().

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:
sw is 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:
sw is 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:
sw is the RHS Software object.
Returns:
true when the two objects equals, otherwise false.

Referenced by operator!=().

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:
sw is 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:
sw is 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:
co is a Software::ComparisonOperator.
Returns:
The string representation of the passed Software::ComparisonOperator is returned.

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:
out is a std::ostream to write the string representation of the Software object to.
sw is 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.


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