In file classad.h:

class ClassAd : public ExprTree

An internal node of an expression which represents a ClassAd.

Inheritance:

ClassAd < ExprTree


Public Methods

void GetComponents( vector< pair< string, ExprTree *> > &vec )
Deconstructor to get the components of a classad
ClassAd* MakeClassAd( vector< pair< string, ExprTree* > > &vec )
Factory method to make a classad

Public

Attribute Deletion Methods
void Clear( )
Clears the ClassAd of all attributes
bool Delete( const string &attrName )
Deletes the named attribute from the ClassAd
bool DeepDelete( const string &scopeExpr, const string &attrName )
Deletes the named attribute from a nested classAd
bool DeepDelete( ExprTree *scopeExpr, const string &attrName )
Deletes the named attribute from a nested classAd
ExprTree* Remove( const string &attrName )
Similar to Delete, but the expression is returned rather than deleted from the classad
ExprTree* DeepRemove( const string &scopeExpr, const string &attrName )
Similar to DeepDelete, but the expression is returned rather than deleted from the classad
ExprTree* DeepRemove( ExprTree *scopeExpr, const string &attrName )
Similar to DeepDelete, but the expression is returned rather than deleted from the classad
Constructors/Destructor
ClassAd()
Default constructor
ClassAd(const ClassAd &)
Copy constructor
~ClassAd()
Destructor
Evaluation Methods
bool EvaluateAttr( const string& attrName, Value &result )
Evaluates expression bound to an attribute
bool EvaluateExpr( const string& buf, Value &result )
Evaluates an expression
bool EvaluateExpr( ExprTree* expr, Value &result )
Evaluates an expression
bool EvaluateExpr( ExprTree* expr, Value &result, ExprTree *&sig)
Evaluates an expression, and returns the significant subexpressions encountered during the evaluation
bool EvaluateAttrInt( const string &attrName, int& intValue )
Evaluates an attribute to an integer
bool EvaluateAttrReal( const string &attrName, double& realValue )
Evaluates an attribute to a real
bool EvaluateAttrNumber( const string &attrName, int& intValue )
Evaluates an attribute to an integer
bool EvaluateAttrNumber(const string &attrName, double& realValue)
Evaluates an attribute to a real
bool EvaluateAttrString( const string &attrName, char *buf, int len)
Evaluates an attribute to a string
bool EvaluateAttrString( const string &attrName, string &buf )
Evaluates an attribute to a string
bool EvaluateAttrBool( const string &attrName, bool& boolValue )
Evaluates an attribute to a boolean
Inherited virtual methods
virtual ClassAd* Copy( )
Makes a deep copy of the expression tree
Insertion Methods
bool Insert( const string &attrName, ExprTree *expr )
Inserts an attribute into the ClassAd
bool DeepInsert( ExprTree *scopeExpr, const string &attrName, ExprTree *expr )
Inserts an attribute into a nested classAd
bool InsertAttr( const string &attrName, int value, Value::NumberFactor f=Value::NO_FACTOR )
Inserts an attribute into the ClassAd
bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, int value, Value::NumberFactor f=Value::NO_FACTOR )
Inserts an attribute into a nested classad
bool InsertAttr( const string &attrName, double value, Value::NumberFactor f=Value::NO_FACTOR)
Inserts an attribute into the ClassAd
bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, double value, Value::NumberFactor f=Value::NO_FACTOR)
Inserts an attribute into a nested classad
bool InsertAttr( const string &attrName, bool value )
Inserts an attribute into the ClassAd
bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, bool value )
Inserts an attribute into a nested classad
bool InsertAttr( const string &attrName, const string &value )
Inserts an attribute into the ClassAd
bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, const string &value )
Inserts an attribute into a nested classad
Lookup Methods
ExprTree* Lookup( const string &attrName )
Finds the expression bound to an attribute name
ExprTree* LookupInScope(const string &attrName, const ClassAd *&ad)
Finds the expression bound to an attribute name
Miscellaneous
bool Flatten( const ExprTree* expr, Value& val, ExprTree *&fexpr )
Flattens (a partial evaluation operation) the given expression in the context of the classad

Inherited from ExprTree:

Public Classes

enum NodeKind
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

Public Methods

virtual ExprTree* Copy( )
NodeKind GetKind(void)
const ClassAd* GetParentScope( )
void Puke( )
void SetParentScope( const ClassAd* p )

Public

enum NodeKind
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

Documentation

An internal node of an expression which represents a ClassAd.
Constructors/Destructor

Inherited virtual methods

virtual ClassAd* Copy( )
Makes a deep copy of the expression tree
Returns:
A deep copy of the expression, or NULL on failure.

ClassAd* MakeClassAd( vector< pair< string, ExprTree* > > &vec )
Factory method to make a classad
Returns:
The constructed classad
Parameters:
vec - A vector of (name,expression) pairs to make a classad

void GetComponents( vector< pair< string, ExprTree *> > &vec )
Deconstructor to get the components of a classad
Parameters:
vec - A vector of (name,expression) pairs which are the attributes of the classad

Insertion Methods

bool Insert( const string &attrName, ExprTree *expr )
Inserts an attribute into the ClassAd. The setParentScope() method is invoked on the inserted expression.
Returns:
true if the operation succeeded, false otherwise.
Parameters:
attrName - The name of the attribute.
expr - The expression bound to the name.
See Also:
ExprTree::setParentScope

bool DeepInsert( ExprTree *scopeExpr, const string &attrName, ExprTree *expr )
Inserts an attribute into a nested classAd. The scope expression is evaluated to obtain a nested classad, and the attribute is inserted into this subclassad. The setParentScope() method is invoked on the inserted expression.
Returns:
true if the operation succeeded, false otherwise.
Parameters:
scopeExpr - The scope expression.
attrName - The name of the attribute.
expr - The expression bound to the name.
See Also:
ExprTree::setParentScope

bool InsertAttr( const string &attrName, int value, Value::NumberFactor f=Value::NO_FACTOR )
Inserts an attribute into the ClassAd. The integer value is converted into a Literal expression, and then inserted into the classad.
Parameters:
attrName - The name of the attribute.
value - The integer value of the attribute.
f - The multiplicative factor to be attached to value.
See Also:
Value::NumberFactor

bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, int value, Value::NumberFactor f=Value::NO_FACTOR )
Inserts an attribute into a nested classad. The scope expression is evaluated to obtain a nested classad, and the attribute is inserted into this subclassad. The integer value is converted into a Literal expression, and then inserted into the nested classad.
Parameters:
scopeExpr - The scope expression.
attrName - The name of the attribute.
value - The integer value of the attribute.
f - The multiplicative factor to be attached to value.
See Also:
Value::NumberFactor

bool InsertAttr( const string &attrName, double value, Value::NumberFactor f=Value::NO_FACTOR)
Inserts an attribute into the ClassAd. The real value is converted into a Literal expression, and then inserted into the classad.
Parameters:
attrName - The name of the attribute.
value - The real value of the attribute.
f - The multiplicative factor to be attached to value.
See Also:
Value::NumberFactor

bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, double value, Value::NumberFactor f=Value::NO_FACTOR)
Inserts an attribute into a nested classad. The scope expression is evaluated to obtain a nested classad, and the insertion is made in the nested classad. The double value is converted into a Literal expression to yield the expression to be inserted.
Parameters:
scopeExpr - String representation of the scope expression.
attrName - The name of the attribute.
value - The string attribute
dup - If dup is true, the value is duplicated internally. Otherwise, the string is assumed to have been created with new[] and the classad assumes responsibility for freeing the storage.

bool InsertAttr( const string &attrName, bool value )
Inserts an attribute into the ClassAd. The boolean value is converted into a Literal expression, and then inserted into the classad.
Parameters:
attrName - The name of the attribute.
value - The boolean value of the attribute.

bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, bool value )
Inserts an attribute into a nested classad. The scope expression is evaluated to obtain a nested classad, and the insertion is made in the nested classad. The boolean value is converted into a Literal expression to yield the expression to be inserted.
Parameters:
scopeExpr - The scope expression.
attrName - The name of the attribute. This string is always duplicated internally.
value - The string attribute
dup - If dup is true, the value is duplicated internally. Otherwise, the string is assumed to have been created with new[] and the classad assumes responsibility for freeing the storage.

bool InsertAttr( const string &attrName, const string &value )
Inserts an attribute into the ClassAd. The string value is converted into a Literal expression, and then inserted into the classad.
Parameters:
attrName - The name of the attribute.
value - The string attribute

bool DeepInsertAttr( ExprTree *scopeExpr, const string &attrName, const string &value )
Inserts an attribute into a nested classad. The scope expression is evaluated to obtain a nested classad, and the insertion is made in the nested classad. The string value is converted into a Literal expression to yield the expression to be inserted.
Parameters:
scopeExpr - The scope expression.
attrName - The name of the attribute.
value - The string attribute
dup - If dup is true, the value is duplicated internally. Otherwise, the string is assumed to have been created with new[] and the classad assumes responsibility for freeing the storage.

Lookup Methods

ExprTree* Lookup( const string &attrName )
Finds the expression bound to an attribute name. The lookup only involves this ClassAd; scoping information is ignored.
Returns:
The expression bound to the name in the ClassAd, or NULL otherwise.
Parameters:
attrName - The name of the attribute.

ExprTree* LookupInScope(const string &attrName, const ClassAd *&ad)
Finds the expression bound to an attribute name. The lookup uses the scoping structure (including super attributes) to determine the expression bound to the given attribute name in the closest enclosing scope. The closest enclosing scope is also returned.
Returns:
The expression bound to the name in the ClassAd, or NULL otherwise.
Parameters:
attrName - The name of the attribute.
ad - The closest enclosing scope of the returned expression, or NULL if no expression was found.

Attribute Deletion Methods

bool Delete( const string &attrName )
Deletes the named attribute from the ClassAd. Only attributes from the local ClassAd are considered; scoping information is ignored. The expression bound to the attribute is deleted.
Returns:
true if the attribute previously existed and was successfully removed, false otherwise.
Parameters:
attrName - The name of the attribute to be delete.

bool DeepDelete( const string &scopeExpr, const string &attrName )
Deletes the named attribute from a nested classAd. The scope expression is evaluated to obtain a nested classad, and the attribute is then deleted from this ad. Only attributes from the local ClassAd are considered; scoping information is ignored. The expression bound to the attribute is deleted.
Returns:
true if the attribute previously existed and was successfully removed, false otherwise.
Parameters:
scopeExpr - String representation of the scope expression.
attrName - The name of the attribute to be delete.

bool DeepDelete( ExprTree *scopeExpr, const string &attrName )
Deletes the named attribute from a nested classAd. The scope expression is evaluated to obtain a nested classad, and the attribute is then deleted from this ad. Only attributes from the local ClassAd are considered; scoping information is ignored. The expression bound to the attribute is deleted.
Returns:
true if the attribute previously existed and was successfully removed, false otherwise.
Parameters:
scopeExpr - The scope expression.
attrName - The name of the attribute to be delete.

ExprTree* Remove( const string &attrName )
Similar to Delete, but the expression is returned rather than deleted from the classad
Returns:
The expression tree of the named attribute, or NULL if the attribute could not be found.
Parameters:
attrName - The name of the attribute to be extricated.
See Also:
Delete

ExprTree* DeepRemove( const string &scopeExpr, const string &attrName )
Similar to DeepDelete, but the expression is returned rather than deleted from the classad
Returns:
The expression tree of the named attribute, or NULL if the attribute could not be found.
Parameters:
scopeExpr - String representation of the scope expression
attrName - The name of the attribute to be extricated.
See Also:
Delete

ExprTree* DeepRemove( ExprTree *scopeExpr, const string &attrName )
Similar to DeepDelete, but the expression is returned rather than deleted from the classad
Returns:
The expression tree of the named attribute, or NULL if the attribute could not be found.
Parameters:
scopeExpr - The scope expression
attrName - The name of the attribute to be extricated.
See Also:
Delete

Evaluation Methods

bool EvaluateAttr( const string& attrName, Value &result )
Evaluates expression bound to an attribute
Parameters:
attrName - The name of the attribute in the ClassAd.
result - The result of the evaluation.

bool EvaluateExpr( const string& buf, Value &result )
Evaluates an expression
Returns:
true if the operation succeeded, false otherwise.
Parameters:
buf - Buffer containing the external representation of the expression. This buffer is parsed to yield the expression to be evaluated.
result - The result of the evaluation.

bool EvaluateExpr( ExprTree* expr, Value &result )
Evaluates an expression. If the expression doesn't already live in this ClassAd, the setParentScope() method must be called on it first.
Parameters:
expr - The expression to be evaluated.
result - The result of the evaluation.

bool EvaluateExpr( ExprTree* expr, Value &result, ExprTree *&sig)
Evaluates an expression, and returns the significant subexpressions encountered during the evaluation. If the expression doesn't already live in this ClassAd, call the setParentScope() method on it first.
Parameters:
expr - The expression to be evaluated.
result - The result of the evaluation.
sig - The significant subexpressions of the evaluation.

bool EvaluateAttrInt( const string &attrName, int& intValue )
Evaluates an attribute to an integer
Returns:
true if attrName evaluated to an integer, false otherwise.
Parameters:
attrName - The name of the attribute.
intValue - The value of the attribute.

bool EvaluateAttrReal( const string &attrName, double& realValue )
Evaluates an attribute to a real
Returns:
true if attrName evaluated to a real, false otherwise.
Parameters:
attrName - The name of the attribute.
realValue - The value of the attribute.

bool EvaluateAttrNumber( const string &attrName, int& intValue )
Evaluates an attribute to an integer. If the attribute evaluated to a real, it is truncated to an integer.
Returns:
true if attrName evaluated to an number, false otherwise.
Parameters:
attrName - The name of the attribute.
intValue - The value of the attribute.

bool EvaluateAttrNumber(const string &attrName, double& realValue)
Evaluates an attribute to a real. If the attribute evaluated to an integer, it is promoted to a real.
Returns:
true if attrName evaluated to a number, false otherwise.
Parameters:
attrName - The name of the attribute.
realValue - The value of the attribute.

bool EvaluateAttrString( const string &attrName, char *buf, int len)
Evaluates an attribute to a string. If the string value does not fit into the buffer, only the portion that does fit is copied over.
Returns:
true iff attrName evaluated to a string
Parameters:
attrName - The name of the attribute.
buf - The buffer for the string value.
len - Size of buffer

bool EvaluateAttrString( const string &attrName, string &buf )
Evaluates an attribute to a string. If the string value does not fit into the buffer, only the portion that does fit is copied over.
Returns:
true iff attrName evaluated to a string
Parameters:
attrName - The name of the attribute.
buf - The buffer for the string value.

bool EvaluateAttrBool( const string &attrName, bool& boolValue )
Evaluates an attribute to a boolean. A pointer to the string is returned.
Returns:
true if attrName evaluated to a boolean value, false otherwise.
Parameters:
attrName - The name of the attribute.
boolValue - The value of the attribute.

Miscellaneous

bool Flatten( const ExprTree* expr, Value& val, ExprTree *&fexpr )
Flattens (a partial evaluation operation) the given expression in the context of the classad
Returns:
true if the flattening was successful, and false otherwise.
Parameters:
expr - The expression to be flattened.
val - The value after flattening, if the expression was completely flattened. This value is valid if and only if fexpr is NULL.
fexpr - The flattened expression tree if the expression did not flatten to a single value, and NULL otherwise.


Direct child classes:
MatchClassAd

alphabetic index hierarchy of classes


Condor Home Page

generated by doc++