Public Member Functions | Static Public Member Functions | Protected Attributes

MatchClassAd Class Reference

#include <matchClassad.h>

Inheritance diagram for MatchClassAd:
ClassAd ClassAd ExprTree ExprTree ExprTree ExprTree

List of all members.

Public Member Functions

 MatchClassAd ()
 Default constructor.
 MatchClassAd (ClassAd *al, ClassAd *ar)
virtual ~MatchClassAd ()
 Default destructor.
bool InitMatchClassAd (ClassAd *al, ClassAd *ar)
bool symmetricMatch ()
bool rightMatchesLeft ()
bool leftMatchesRight ()
bool ReplaceLeftAd (ClassAd *al)
bool ReplaceRightAd (ClassAd *ar)
ClassAdGetLeftAd ()
ClassAdGetRightAd ()
ClassAdGetLeftContext ()
ClassAdGetRightContext ()
ClassAdRemoveLeftAd ()
ClassAdRemoveRightAd ()
 MatchClassAd ()
 Default constructor.
 MatchClassAd (ClassAd *al, ClassAd *ar)
virtual ~MatchClassAd ()
 Default destructor.
bool InitMatchClassAd (ClassAd *al, ClassAd *ar)
bool symmetricMatch ()
bool rightMatchesLeft ()
bool leftMatchesRight ()
bool ReplaceLeftAd (ClassAd *al)
bool ReplaceRightAd (ClassAd *ar)
ClassAdGetLeftAd ()
ClassAdGetRightAd ()
ClassAdGetLeftContext ()
ClassAdGetRightContext ()
ClassAdRemoveLeftAd ()
ClassAdRemoveRightAd ()

Static Public Member Functions

static MatchClassAdMakeMatchClassAd (ClassAd *al, ClassAd *ar)
static bool OptimizeRightAdForMatchmaking (ClassAd *ad, std::string *error_msg)
static bool OptimizeLeftAdForMatchmaking (ClassAd *ad, std::string *error_msg)
static bool UnoptimizeAdForMatchmaking (ClassAd *ad)
static MatchClassAdMakeMatchClassAd (ClassAd *al, ClassAd *ar)
static bool OptimizeRightAdForMatchmaking (ClassAd *ad, std::string *error_msg)
static bool OptimizeLeftAdForMatchmaking (ClassAd *ad, std::string *error_msg)
static bool UnoptimizeAdForMatchmaking (ClassAd *ad)

Protected Attributes

const ClassAdladParent
const ClassAdradParent
ClassAdlCtx
ClassAdrCtx
ClassAdlad
ClassAdrad
ExprTreesymmetric_match
ExprTreeright_matches_left
ExprTreeleft_matches_right

Detailed Description

Special case of a ClassAd which make it easy to do matching. The top-level ClassAd equivalent to the following, with some minor implementation differences for efficiency. Because of the use of global-scope references to .LEFT and .RIGHT, this ad is not suitable for nesting inside of other ads. The use of global-scope references is done purely for efficiency, since attribute lookups tends to be a big part of the time spent in matchmaking.

    [
       symmetricMatch   = leftMatchesRight && rightMatchesLeft;
       leftMatchesRight = RIGHT.requirements;
       rightMatchesLeft = LEFT.requirements;
       leftRankValue    = LEFT.rank;
       rightRankValue   = RIGHT.rank;
       RIGHT            = rCtx.ad;
       LEFT             = lCtx.ad;
       lCtx             =
           [
               other    = .RIGHT;
               target   = .RIGHT;   // for condor backwards compatibility
               my       = .LEFT;    // for condor backwards compatibility
               ad       = 
                  [
the ``left'' match candidate goes here
                  ]
    	   ];
       rCtx             =
           [
               other    = .LEFT;
               target   = .LEFT;    // for condor backwards compatibility
               my       = .RIGHT;   // for condor backwards compatibility
               ad       = 
                  [
the ``right'' match candidate goes here
                  ]
    	   ];
    ]
	

Constructor & Destructor Documentation

MatchClassAd::MatchClassAd ( ClassAd al,
ClassAd ar 
)

Constructor which builds the CondorClassad given two ads

Parameters:
al The left candidate ad
ar The right candidate ad
MatchClassAd::MatchClassAd ( ClassAd al,
ClassAd ar 
)

Constructor which builds the CondorClassad given two ads

Parameters:
al The left candidate ad
ar The right candidate ad

Member Function Documentation

ClassAd * MatchClassAd::GetLeftAd (  ) 

Gets the ad in the left context.

Returns:
The ClassAd, or NULL if the ad doesn't exist.
ClassAd* MatchClassAd::GetLeftAd (  ) 

Gets the ad in the left context.

Returns:
The ClassAd, or NULL if the ad doesn't exist.
ClassAd * MatchClassAd::GetLeftContext (  ) 

Gets the left context ad. (.adcl in the above example)

Returns:
The left context ad, or NULL if the MatchClassAd is not valid
ClassAd* MatchClassAd::GetLeftContext (  ) 

Gets the left context ad. (.adcl in the above example)

Returns:
The left context ad, or NULL if the MatchClassAd is not valid
ClassAd * MatchClassAd::GetRightAd (  ) 

Gets the ad in the right context.

Returns:
The ClassAd, or NULL if the ad doesn't exist.
ClassAd* MatchClassAd::GetRightAd (  ) 

Gets the ad in the right context.

Returns:
The ClassAd, or NULL if the ad doesn't exist.
ClassAd * MatchClassAd::GetRightContext (  ) 

Gets the right context ad. (.adcr in the above example)

Returns:
The left context ad, or NULL if the MatchClassAd is not valid
ClassAd* MatchClassAd::GetRightContext (  ) 

Gets the right context ad. (.adcr in the above example)

Returns:
The left context ad, or NULL if the MatchClassAd is not valid
bool MatchClassAd::InitMatchClassAd ( ClassAd al,
ClassAd ar 
)

Method to initialize a MatchClassad given two ClassAds. The old expressions in the classad are deleted.

Parameters:
al The ad to be placed in the left context.
ar The ad to be placed in the right context.
Returns:
true if the operation succeeded, false otherwise
bool MatchClassAd::InitMatchClassAd ( ClassAd al,
ClassAd ar 
)

Method to initialize a MatchClassad given two ClassAds. The old expressions in the classad are deleted.

Parameters:
al The ad to be placed in the left context.
ar The ad to be placed in the right context.
Returns:
true if the operation succeeded, false otherwise
bool MatchClassAd::leftMatchesRight (  ) 
Returns:
true if the left ad matches the right ad's requirements
bool MatchClassAd::leftMatchesRight (  ) 
Returns:
true if the left ad matches the right ad's requirements
static MatchClassAd* MatchClassAd::MakeMatchClassAd ( ClassAd al,
ClassAd ar 
) [static]

Factory method to make a MatchClassad given two ClassAds to be matched.

Parameters:
al The ad to be placed in the left context.
ar The ad to be placed in the right context.
Returns:
A CondorClassad, or NULL if the operation failed.
MatchClassAd * MatchClassAd::MakeMatchClassAd ( ClassAd al,
ClassAd ar 
) [static]

Factory method to make a MatchClassad given two ClassAds to be matched.

Parameters:
al The ad to be placed in the left context.
ar The ad to be placed in the right context.
Returns:
A CondorClassad, or NULL if the operation failed.
bool MatchClassAd::OptimizeLeftAdForMatchmaking ( ClassAd ad,
std::string *  error_msg 
) [static]

Modifies the requirements expression in the given ad to make matchmaking more efficient. This will only improve efficiency if it is called once and then the resulting requirements are used multiple times. Saves the old requirements expression so it can be restored via UnoptimizeAdForMatchmaking.

Parameters:
ad The ad to be optimized.
error_msg non-NULL if an error description is desired.
Returns:
True on success.
static bool MatchClassAd::OptimizeLeftAdForMatchmaking ( ClassAd ad,
std::string *  error_msg 
) [static]

Modifies the requirements expression in the given ad to make matchmaking more efficient. This will only improve efficiency if it is called once and then the resulting requirements are used multiple times. Saves the old requirements expression so it can be restored via UnoptimizeAdForMatchmaking.

Parameters:
ad The ad to be optimized.
error_msg non-NULL if an error description is desired.
Returns:
True on success.
static bool MatchClassAd::OptimizeRightAdForMatchmaking ( ClassAd ad,
std::string *  error_msg 
) [static]

Modifies the requirements expression in the given ad to make matchmaking more efficient. This will only improve efficiency if it is called once and then the resulting requirements are used multiple times. Saves the old requirements expression so it can be restored via UnoptimizeAdForMatchmaking.

Parameters:
ad The ad to be optimized.
error_msg non-NULL if an error description is desired.
Returns:
True on success.
bool MatchClassAd::OptimizeRightAdForMatchmaking ( ClassAd ad,
std::string *  error_msg 
) [static]

Modifies the requirements expression in the given ad to make matchmaking more efficient. This will only improve efficiency if it is called once and then the resulting requirements are used multiple times. Saves the old requirements expression so it can be restored via UnoptimizeAdForMatchmaking.

Parameters:
ad The ad to be optimized.
error_msg non-NULL if an error description is desired.
Returns:
True on success.
ClassAd * MatchClassAd::RemoveLeftAd (  ) 

Removes the left candidate from the match classad. If the candidate ``lives'' in another data structure, this method should be called so that the match classad doesn't delete the candidate.

Returns:
The left candidate ad.
ClassAd* MatchClassAd::RemoveLeftAd (  ) 

Removes the left candidate from the match classad. If the candidate ``lives'' in another data structure, this method should be called so that the match classad doesn't delete the candidate.

Returns:
The left candidate ad.
ClassAd* MatchClassAd::RemoveRightAd (  ) 

Removes the right candidate from the match classad. If the candidate ``lives'' in another data structure, this method should be called so that the match classad doesn't delete the candidate.

Returns:
The right candidate ad.
ClassAd * MatchClassAd::RemoveRightAd (  ) 

Removes the right candidate from the match classad. If the candidate ``lives'' in another data structure, this method should be called so that the match classad doesn't delete the candidate.

Returns:
The right candidate ad.
bool MatchClassAd::ReplaceLeftAd ( ClassAd al  ) 

Replaces ad in the left context, or insert one if an ad did not previously exist

Parameters:
al The ad to be placed in the left context.
Returns:
true if the operation succeeded and false otherwise.
bool MatchClassAd::ReplaceLeftAd ( ClassAd al  ) 

Replaces ad in the left context, or insert one if an ad did not previously exist

Parameters:
al The ad to be placed in the left context.
Returns:
true if the operation succeeded and false otherwise.
bool MatchClassAd::ReplaceRightAd ( ClassAd ar  ) 

Replaces ad in the right context, or insert one if an ad did not previously exist

Parameters:
ar The ad to be placed in the right context.
Returns:
true if the operation succeeded and false otherwise.
bool MatchClassAd::ReplaceRightAd ( ClassAd ar  ) 

Replaces ad in the right context, or insert one if an ad did not previously exist

Parameters:
ar The ad to be placed in the right context.
Returns:
true if the operation succeeded and false otherwise.
bool MatchClassAd::rightMatchesLeft (  ) 
Returns:
true if the right ad matches the left ad's requirements
bool MatchClassAd::rightMatchesLeft (  ) 
Returns:
true if the right ad matches the left ad's requirements
bool MatchClassAd::symmetricMatch (  ) 
Returns:
true if right and left ads match each other
bool MatchClassAd::symmetricMatch (  ) 
Returns:
true if right and left ads match each other
bool MatchClassAd::UnoptimizeAdForMatchmaking ( ClassAd ad  )  [static]

Restores ad previously optimized with OptimizeAdForMatchmaking.

Parameters:
ad The ad to be unoptimized.
Returns:
True on success.
static bool MatchClassAd::UnoptimizeAdForMatchmaking ( ClassAd ad  )  [static]

Restores ad previously optimized with OptimizeAdForMatchmaking.

Parameters:
ad The ad to be unoptimized.
Returns:
True on success.

The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends