Main Page | Class Hierarchy | Class List | File List | Class Members

attrrefs.h

00001 /*********************************************************************
00002  *
00003  * Condor ClassAd library
00004  * Copyright (C) 1990-2003, Condor Team, Computer Sciences Department,
00005  * University of Wisconsin-Madison, WI and Rajesh Raman.
00006  *
00007  * This source code is covered by the Condor Public License, which can
00008  * be found in the accompanying LICENSE file, or online at
00009  * www.condorproject.org.
00010  *
00011  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00012  * AND THE UNIVERSITY OF WISCONSIN-MADISON "AS IS" AND ANY EXPRESS OR
00013  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00014  * WARRANTIES OF MERCHANTABILITY, OF SATISFACTORY QUALITY, AND FITNESS
00015  * FOR A PARTICULAR PURPOSE OR USE ARE DISCLAIMED. THE COPYRIGHT
00016  * HOLDERS AND CONTRIBUTORS AND THE UNIVERSITY OF WISCONSIN-MADISON
00017  * MAKE NO MAKE NO REPRESENTATION THAT THE SOFTWARE, MODIFICATIONS,
00018  * ENHANCEMENTS OR DERIVATIVE WORKS THEREOF, WILL NOT INFRINGE ANY
00019  * PATENT, COPYRIGHT, TRADEMARK, TRADE SECRET OR OTHER PROPRIETARY
00020  * RIGHT.
00021  *
00022  *********************************************************************/
00023 
00024 #ifndef __ATTRREFS_H__
00025 #define __ATTRREFS_H__
00026 
00027 BEGIN_NAMESPACE( classad )
00028 
00029 
00030 class AttributeReference : public ExprTree 
00031 {
00032         public:
00033 
00035         AttributeReference(const AttributeReference &ref);
00036 
00038         ~AttributeReference ();
00039 
00041         AttributeReference &operator=(const AttributeReference &ref);
00042 
00053         static AttributeReference *MakeAttributeReference(ExprTree *expr, 
00054                                         const std::string &attrName, bool absolute=false);
00055 
00062                 void GetComponents( ExprTree *&expr,std::string &attr, bool &abs ) const;
00063 
00066                 virtual ExprTree* Copy( ) const;
00067 
00072         bool CopyFrom(const AttributeReference &ref);
00073 
00078         virtual bool SameAs(const ExprTree *tree) const;
00079 
00085         friend bool operator==(const AttributeReference &ref1, const AttributeReference &ref2);
00086 
00087         protected:
00089         AttributeReference ();
00090 
00091         private:
00092                 // private ctor for internal use
00093                 AttributeReference( ExprTree*, const std::string &, bool );
00094                 virtual void _SetParentScope( const ClassAd* p );
00095         virtual bool _Evaluate( EvalState & , Value & ) const;
00096         virtual bool _Evaluate( EvalState & , Value &, ExprTree*& ) const;
00097         virtual bool _Flatten( EvalState&, Value&, ExprTree*&, int* ) const;
00098                 int     FindExpr( EvalState&, ExprTree*&, ExprTree*&, bool ) const;
00099 
00100                 ExprTree        *expr;
00101                 bool            absolute;
00102         std::string attributeStr;
00103 };
00104 
00105 END_NAMESPACE // classad
00106 
00107 #endif//__ATTRREFS_H__