attrrefs.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_ATTRREFS_H__
00022 #define __CLASSAD_ATTRREFS_H__
00023 
00024 BEGIN_NAMESPACE( classad )
00025 
00026 
00027 class AttributeReference : public ExprTree 
00028 {
00029     public:
00030 
00032         AttributeReference(const AttributeReference &ref);
00033 
00035         virtual ~AttributeReference ();
00036 
00038         AttributeReference &operator=(const AttributeReference &ref);
00039 
00050         static AttributeReference *MakeAttributeReference(ExprTree *expr, 
00051                     const std::string &attrName, bool absolute=false);
00052 
00059         void GetComponents( ExprTree *&expr,std::string &attr, bool &abs ) const;
00060 
00063         virtual ExprTree* Copy( ) const;
00064 
00069         bool CopyFrom(const AttributeReference &ref);
00070 
00075         virtual bool SameAs(const ExprTree *tree) const;
00076 
00082         friend bool operator==(const AttributeReference &ref1, const AttributeReference &ref2);
00083 
00084     protected:
00086         AttributeReference ();
00087 
00088     private:
00089         // private ctor for internal use
00090         AttributeReference( ExprTree*, const std::string &, bool );
00091         virtual void _SetParentScope( const ClassAd* p );
00092         virtual bool _Evaluate( EvalState & , Value & ) const;
00093         virtual bool _Evaluate( EvalState & , Value &, ExprTree*& ) const;
00094         virtual bool _Flatten( EvalState&, Value&, ExprTree*&, int* ) const;
00095         int FindExpr( EvalState&, ExprTree*&, ExprTree*&, bool ) const;
00096 
00097         ExprTree    *expr;
00098         bool        absolute;
00099         std::string attributeStr;
00100 };
00101 
00102 END_NAMESPACE // classad
00103 
00104 #endif//__CLASSAD_ATTRREFS_H__
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends