Re: [classad-users] eval method


Date: Tue, 25 Jun 2002 13:38:43 -0500 (CDT)
From: Nicholas Coleman <ncoleman@xxxxxxxxxxx>
Subject: Re: [classad-users] eval method
What you need to do is use one of the EvaluateAttr methods in the ClassAd
class. Then you have to covert the value to a Literal (a subclass of
ExprTree) Then you can insert the attribue with the evaluated value.

So:

ClassAd ad;
...
< insert pippo = DayTime( ) >
...
Value val;
time_t timeval;
Literal *timeExpr;

ad.EvaluateAttr( "pippo", val );
if( !val.IsAbsoluteTimeVal( timeval ) ) {
    cout << "pippo not an abstime" << endl;
}
timeExpr = MakeAbsTime( timeval );
ad.InsertAttr( "pippo", timeExpr );
...

Of course you could avoid all that by doing:

time( timeval )
timeExpr = MakeAbsTime( timeval );
ad.InsertAttr( "pippo", timeExpr );


On Tue, 25 Jun 2002, Giuseppe Avellino wrote:

> I inserted in a RecordExpr some attributes.
> One of these attributes is pippo with value DayTime() (pippo =
> DayTime()). I'd like to know if it is possible to evaluate the function
> call DayTime() to assign this value to pippo.
> I know there are some ClassAd and Expr methods called eval. How can I
> use one of this method to see the result of the DayTime() function call?
> (I need what is assigned to pippo i.e. the value returned by DayTime()
> not that pippo is equal to "DayTime()").
> Thanx
> 
> Giuseppe
> Condor Classads Info:
> http://www.cs.wisc.edu/condor/classad/
> 
> 

- Nick
 


Condor Classads Info:
http://www.cs.wisc.edu/condor/classad/




[← Prev in Thread] Current Thread [Next in Thread→]