matchClassad.h

00001 /***************************************************************
00002  *
00003  * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
00004  * University of Wisconsin-Madison, WI.
00005  * 
00006  * Licensed under the Apache License, Version 2.0 (the "License"); you
00007  * may not use this file except in compliance with the License.  You may
00008  * obtain a copy of the License at
00009  * 
00010  *    http://www.apache.org/licenses/LICENSE-2.0
00011  * 
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  *
00018  ***************************************************************/
00019 
00020 
00021 #ifndef __CLASSAD_MATCH_CLASSAD_H__
00022 #define __CLASSAD_MATCH_CLASSAD_H__
00023 
00024 #include "classad/classad.h"
00025 
00026 BEGIN_NAMESPACE( classad )
00027 
00028 
00068 class MatchClassAd : public ClassAd
00069 {
00070     public:
00072         MatchClassAd();
00077         MatchClassAd( ClassAd* al, ClassAd* ar );
00079         virtual ~MatchClassAd();
00080 
00087         static MatchClassAd *MakeMatchClassAd( ClassAd* al, ClassAd* ar );
00088 
00095         bool InitMatchClassAd( ClassAd* al, ClassAd *ar );
00096 
00099         bool symmetricMatch();
00100 
00103         bool rightMatchesLeft();
00104 
00107         bool leftMatchesRight();
00108 
00114         bool ReplaceLeftAd( ClassAd *al );
00115 
00121         bool ReplaceRightAd( ClassAd *ar );
00122 
00126         ClassAd *GetLeftAd();
00127 
00131         ClassAd *GetRightAd();
00132 
00137         ClassAd *GetLeftContext( );
00138 
00143         ClassAd *GetRightContext( );
00144 
00151         ClassAd *RemoveLeftAd( );
00152 
00159         ClassAd *RemoveRightAd( );
00160 
00171         static bool OptimizeRightAdForMatchmaking( ClassAd *ad, std::string *error_msg );
00172 
00183         static bool OptimizeLeftAdForMatchmaking( ClassAd *ad, std::string *error_msg );
00184 
00189         static bool UnoptimizeAdForMatchmaking( ClassAd *ad );
00190 
00191     protected:
00192         const ClassAd *ladParent, *radParent;
00193         ClassAd *lCtx, *rCtx, *lad, *rad;
00194         ExprTree *symmetric_match, *right_matches_left, *left_matches_right;
00195 
00196     private:
00197         // The copy constructor and assignment operator are defined
00198         // to be private so we don't have to write them, or worry about
00199         // them being inappropriately used. The day we want them, we can 
00200         // write them. 
00201         MatchClassAd(const MatchClassAd &) : ClassAd(){ return;       }
00202         MatchClassAd &operator=(const MatchClassAd &) { return *this; }
00203 
00215         static bool OptimizeAdForMatchmaking( ClassAd *ad, bool is_right, std::string *error_msg );
00216 
00220         bool EvalMatchExpr(ExprTree *match_expr);
00221 };
00222 
00223 END_NAMESPACE // classad
00224 
00225 #endif
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends