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

ExprTree Class Reference

A node of the expression tree, which may be a literal, attribute reference, function call, classad, expression list, or an operator applied to other ExprTree operands. More...

#include <exprTree.h>

Inheritance diagram for ExprTree:

Inheritance graph
[legend]
Collaboration diagram for ExprTree:

Collaboration graph
[legend]
List of all members.

Public Types

enum  NodeKind {
  LITERAL_NODE, ATTRREF_NODE, OP_NODE, FN_CALL_NODE,
  CLASSAD_NODE, EXPR_LIST_NODE
}
 The kinds of nodes in expression trees. More...


Public Member Functions

virtual ~ExprTree ()
 Virtual destructor.

void SetParentScope (const ClassAd *p)
 Sets the lexical parent scope of the expression, which is used to determine the lexical scoping structure for resolving attribute references.

const ClassAdGetParentScope () const
 Gets the parent scope of the expression.

virtual ExprTreeCopy () const=0
 Makes a deep copy of the expression tree.

NodeKind GetKind (void) const
 Gets the node kind of this expression node.

void Puke () const
 A debugging method; send expression to stdout.

bool Evaluate (EvalState &state, Value &val) const
 Evaluate this tree.

bool Evaluate (Value &v) const
 Evaluate this tree.

virtual bool SameAs (const ExprTree *tree) const=0
 Is this ExprTree the same as the tree?


Protected Types

enum  {
  EVAL_FAIL, EVAL_OK, EVAL_UNDEF, PROP_UNDEF,
  EVAL_ERROR, PROP_ERROR
}

Protected Member Functions

void CopyFrom (const ExprTree &literal)
 Fill in this ExprTree with the contents of the other ExprTree.

bool Evaluate (Value &v, ExprTree *&t) const
bool Flatten (Value &val, ExprTree *&tree) const
bool Flatten (EvalState &, Value &, ExprTree *&, int *=NULL) const
bool Evaluate (EvalState &, Value &, ExprTree *&) const

Protected Attributes

const ClassAdparentScope
NodeKind nodeKind

Friends

class Operation
class AttributeReference
class FunctionCall
class FunctionTable
class ExprList
class ExprListIterator
class ClassAd
bool operator== (const ExprTree &tree1, const ExprTree &tree2)

Detailed Description

A node of the expression tree, which may be a literal, attribute reference, function call, classad, expression list, or an operator applied to other ExprTree operands.

See also:
NodeKind


Member Enumeration Documentation

enum ExprTree::NodeKind
 

The kinds of nodes in expression trees.

Enumeration values:
LITERAL_NODE  Literal node (string, integer, real, boolean, undefined, error).
ATTRREF_NODE  Attribute reference node (attr, .attr, expr.attr).
OP_NODE  Expression operation node (unary, binary, ternary)/.
FN_CALL_NODE  Function call node.
CLASSAD_NODE  ClassAd node.
EXPR_LIST_NODE  Expression list node.


Member Function Documentation

virtual ExprTree* ExprTree::Copy  )  const [pure virtual]
 

Makes a deep copy of the expression tree.

Returns:
A deep copy of the expression, or NULL on failure.

Implemented in AttributeReference, ClassAd, ExprList, FunctionCall, Literal, and Operation.

void ExprTree::CopyFrom const ExprTree literal  )  [protected]
 

Fill in this ExprTree with the contents of the other ExprTree.

Returns:
true if the copy succeeded, false otherwise.

bool ExprTree::Evaluate Value v  )  const
 

Evaluate this tree.

This only works if the expression is currently part of a ClassAd.

Parameters:
val The result of the evaluation
Returns:
true on success, false on failure

bool ExprTree::Evaluate EvalState &  state,
Value val
const
 

Evaluate this tree.

Parameters:
state The current state
val The result of the evaluation
Returns:
true on success, false on failure

NodeKind ExprTree::GetKind void   )  const [inline]
 

Gets the node kind of this expression node.

Returns:
The node kind.
See also:
NodeKind

const ClassAd* ExprTree::GetParentScope  )  const [inline]
 

Gets the parent scope of the expression.

Returns:
The parent scope of the expression.

virtual bool ExprTree::SameAs const ExprTree tree  )  const [pure virtual]
 

Is this ExprTree the same as the tree?

Returns:
true if it is the same, false otherwise

Implemented in AttributeReference, ClassAd, ExprList, FunctionCall, Literal, and Operation.

void ExprTree::SetParentScope const ClassAd p  ) 
 

Sets the lexical parent scope of the expression, which is used to determine the lexical scoping structure for resolving attribute references.

(However, the semantic parent may be different from the lexical parent if a super attribute is specified.) This method is automatically called when expressions are inserted into ClassAds, and should thus be called explicitly only when evaluating expressions which haven't been inserted into a ClassAd.

Parameters:
p The parent ClassAd.


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