Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends
Arc::ApplicationEnvironment Class Reference

ApplicationEnvironment. More...

#include <ExecutionTarget.h>

Inheritance diagram for Arc::ApplicationEnvironment:
Inheritance graph
[legend]
Collaboration diagram for Arc::ApplicationEnvironment:
Collaboration graph
[legend]

List of all members.

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.

Public Member Functions

 ApplicationEnvironment ()
 ApplicationEnvironment (const std::string &Name)
 ApplicationEnvironment (const std::string &Name, const std::string &Version)
ApplicationEnvironmentoperator= (const Software &sv)
bool empty () const
 Indicates whether the object is empty.
bool operator== (const Software &sw) const
 Equality operator.
bool operator!= (const Software &sw) const
 Inequality operator (non-trivial behaviour).
bool operator> (const Software &sw) const
 Greater-than operator.
bool operator< (const Software &sw) const
 Less-than operator.
bool operator>= (const Software &sw) const
 Greater-than or equal operator.
bool operator<= (const Software &sw) const
 Less-than or equal operator.
std::string operator() () const
 Get string representation.
 operator std::string (void) const
 Cast to string.
const std::string & getFamily () const
 Get family.
const std::string & getName () const
 Get name.
const std::string & getVersion () const
 Get version.

Static Public Member Functions

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

Public Attributes

std::string State
int FreeSlots
int FreeJobs
int FreeUserSeats

Static Public Attributes

static const std::string VERSIONTOKENS = "-."
 Tokens used to split version string.

Friends

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

Detailed Description

ApplicationEnvironment.

The ApplicationEnviroment is closely related to the definition given in GLUE2. By extending the Software class the two GLUE2 attributes AppName and AppVersion are mapped to two private members. However these can be obtained through the inheriated member methods getName and getVersion.

GLUE2 description: A description of installed application software or software environment characteristics available within one or more Execution Environments.

Definition at line 32 of file ExecutionTarget.h.


Member Typedef Documentation

typedef bool(Software::* Arc::Software::ComparisonOperator)(const Software &) const [inherited]

Definition of a comparison operator method pointer.

This typedef defines a comparison operator method pointer.

See also:
operator==,
operator!=,
operator>,
operator<,
operator>=,
operator<=,
ComparisonOperatorEnum.

Definition at line 45 of file Software.h.


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<=

Definition at line 96 of file Software.h.


Constructor & Destructor Documentation

Definition at line 35 of file ExecutionTarget.h.

{}
Arc::ApplicationEnvironment::ApplicationEnvironment ( const std::string &  Name) [inline]

Definition at line 36 of file ExecutionTarget.h.

      : Software(Name) {}
Arc::ApplicationEnvironment::ApplicationEnvironment ( const std::string &  Name,
const std::string &  Version 
) [inline]

Definition at line 38 of file ExecutionTarget.h.

      : Software(Name, Version) {}

Member Function Documentation

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.

Definition at line 119 of file Software.cpp.

                                                                                     {
  switch (co) {
  case Software::EQUAL:
    return &Software::operator==;
  case Software::NOTEQUAL:
    return &Software::operator!=;
  case Software::GREATERTHAN:
    return &Software::operator>;
  case Software::LESSTHAN:
    return &Software::operator<;
  case Software::GREATERTHANOREQUAL:
    return &Software::operator>=;
  case Software::LESSTHANOREQUAL:
    return &Software::operator<=;
  };
}

Here is the caller graph for this function:

bool Arc::Software::empty ( ) const [inline, inherited]

Indicates whether the object is empty.

Returns:
true if the name of this object is empty, otherwise false.

Definition at line 126 of file Software.h.

{ return name.empty(); }

Here is the caller graph for this function:

const std::string& Arc::Software::getFamily ( ) const [inline, inherited]

Get family.

Returns:
The family the represented software belongs to is returned.

Definition at line 262 of file Software.h.

{ return family; }

Here is the caller graph for this function:

const std::string& Arc::Software::getName ( ) const [inline, inherited]

Get name.

Returns:
The name of the represented software is returned.

Definition at line 267 of file Software.h.

{ return name; }

Here is the caller graph for this function:

const std::string& Arc::Software::getVersion ( ) const [inline, inherited]

Get version.

Returns:
The version of the represented software is returned.

Definition at line 272 of file Software.h.

{ return version; }

Here is the caller graph for this function:

Arc::Software::operator std::string ( void  ) const [inline, inherited]

Cast to string.

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

See also:
operator()().

Definition at line 255 of file Software.h.

{ return operator()(); }

Here is the call graph for this function:

bool Arc::Software::operator!= ( const Software sw) const [inline, inherited]

Inequality operator (non-trivial behaviour).

The inequality operator should be used to test if two Software objects are of different versions but share the same name and family. So it should not be used to test if two Software objects differ in either name, version or family. Two Software objects are inequal if they share the same name and family but have different versions and the versions are non-empty.

Parameters:
swis the RHS Software object.
Returns:
true when the two objects are inequal, otherwise false.

Definition at line 156 of file Software.h.

                                              { return family == sw.family &&
                                                       name   == sw.name &&
                                                       !(version == sw.version || version.empty() || sw.version.empty()); }
std::string Arc::Software::operator() ( ) const [inherited]

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

Definition at line 53 of file Software.cpp.

                                     {
  if (empty()) return "";
  if (family.empty() && version.empty()) return name;
  if (family.empty()) return name + "-" + version;
  if (version.empty()) return family + "-" + name;
  return family + "-" + name + "-" + version;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Arc::Software::operator< ( const Software sw) const [inline, inherited]

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

Definition at line 199 of file Software.h.

{ return sw.operator>(*this); }
bool Arc::Software::operator<= ( const Software sw) const [inline, inherited]

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

Definition at line 225 of file Software.h.

{ return (*this == sw ? true : *this < sw); }
ApplicationEnvironment& Arc::ApplicationEnvironment::operator= ( const Software sv) [inline]

Definition at line 40 of file ExecutionTarget.h.

                                                          {
      Software::operator=(sv);
      return *this;
    }
bool Arc::Software::operator== ( const Software sw) const [inline, inherited]

Equality operator.

Two Software objects are equal if they are of the same family, and if they have the same name. If BOTH objects specifies a version they must also equal, for the objects to be equal. Otherwise the two objects does not equal. 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.

Definition at line 140 of file Software.h.

                                              { return family  == sw.family &&
                                                       name    == sw.name &&
                                                       (version.empty() || sw.version.empty() || version == sw.version); }
bool Arc::Software::operator> ( const Software sw) const [inherited]

Greater-than operator.

For the LHS object to be greater than the RHS object they must first share the same family and name and have non-empty versions. 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.

Definition at line 61 of file Software.cpp.

                                                 {
  if (family != sv.family || name != sv.name ||
      version.empty() || sv.version.empty() ||
      version == sv.version) return false;

  int lhsInt, rhsInt;
  std::list<std::string>::const_iterator lhsIt, rhsIt;
  for (lhsIt  = tokenizedVersion.begin(), rhsIt  = sv.tokenizedVersion.begin();
       lhsIt != tokenizedVersion.end() && rhsIt != sv.tokenizedVersion.end();
       lhsIt++, rhsIt++) {
    if (*lhsIt == *rhsIt)
      continue;
    if (stringto(*lhsIt, lhsInt) && stringto(*rhsIt, rhsInt)) {
      if (lhsInt > rhsInt) {
        logger.msg(VERBOSE, "%s > %s => true", (std::string)*this, (std::string)sv);
        return true;
      }
      if (lhsInt == rhsInt)
        continue;
    }
    else {
      logger.msg(VERBOSE, "%s > %s => false: \%s contains non numbers in the version part.", (std::string)*this, (std::string)sv, (!stringto(*lhsIt, lhsInt) ? (std::string)*this : (std::string)sv));
      return false;
    }

    logger.msg(VERBOSE, "%s > %s => false", (std::string)*this, (std::string)sv);
    return false;
  }

  if (sv.tokenizedVersion.size() != tokenizedVersion.size()) {
    // Left side contains extra tokens. These must only contain numbers.
    for (; lhsIt != tokenizedVersion.end(); lhsIt++) {
      if (!stringto(*lhsIt, lhsInt)) { // Try to convert ot an integer.
        logger.msg(VERBOSE, "%s > %s => false: %s contains non numbers in the version part.", (std::string)*this, (std::string)sv, (std::string)*this);
        return false;
      }

      if (lhsInt != 0) {
        logger.msg(VERBOSE, "%s > %s => true", (std::string)*this, (std::string)sv);
        return true;
      }
    }
  }

  logger.msg(VERBOSE, "%s > %s => false", (std::string)*this, (std::string)sv);

  return false;
}

Here is the call graph for this function:

bool Arc::Software::operator>= ( const Software sw) const [inline, inherited]

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

Definition at line 212 of file Software.h.

{ return (*this == sw ? true : *this > sw); }
std::string Arc::Software::toString ( ComparisonOperator  co) [static, inherited]

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.

Definition at line 110 of file Software.cpp.

                                                  {
  if (co == &Software::operator==) return "==";
  if (co == &Software::operator<)  return "<";
  if (co == &Software::operator>)  return ">";
  if (co == &Software::operator<=) return "<=";
  if (co == &Software::operator>=) return ">=";
  return "!=";
}

Here is the caller graph for this function:


Friends And Related Function Documentation

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

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.

Definition at line 237 of file Software.h.

{ out << sw(); return out; }

Member Data Documentation

Definition at line 46 of file ExecutionTarget.h.

Definition at line 45 of file ExecutionTarget.h.

Definition at line 47 of file ExecutionTarget.h.

Definition at line 44 of file ExecutionTarget.h.

const std::string Arc::Software::VERSIONTOKENS = "-." [static, inherited]

Tokens used to split version string.

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

Definition at line 292 of file Software.h.


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