Re: [classad-users] ClassAd Transform?


Date: Tue, 27 Jul 2004 10:54:23 -0500 (CDT)
From: Matthew Farrellee <matt@xxxxxxxxxxx>
Subject: Re: [classad-users] ClassAd Transform?
That looks promising. Thanks! It'll save me some ugly switch'ing etc!

matt

On Jul 27, 2004, at 10:49 AM, Rajesh Raman wrote:

It's been a while, but I think you can:
  ad->Insert(ATTR_FOO, Literal::MakeLiteral(foo_value))
++Rajesh

--- Matthew Farrellee <matt@xxxxxxxxxxx> wrote:

Alain,

Is there a quick method for evaluating a bunch of attributes and
plugging them into a new ClassAd? I am skimming the API and evaluation
(i.e. EvaluateAttr) always seems to result in a Value, which then has
to be inspected (i.e. find out if IsBooleanValue should be called or 
if
IsClassAdValue should be called...) before it can be inserted into a
new ClassAd. is there a simpler way, such as an Insert call on ClassAd
that takes a Value instead of an ExprTree?

matt

On Jun 2, 2004, at 4:01 PM, Alain Roy wrote:

Matthew Farrellee wrote:
How easily would it be for me to use the new ClassAd library to take
an
input ClassAd I, a "tranform" ClassAd T, and produce an output 
ClassAd
O? For example:

I: [A = 2; B = 3;]
T: [A = $(A); B = $(B); C = $(A) * $(B);]
O: [A = 2; B = 3; C = 6;]
Is this a job for CAFL?
There is no easy, automatic way to do this with the new ClassAd
library. CAFL may be appropriate.
One way to do it is to set up a big ClassAd like this:

[
  input = 0;
  template = 0;
]
Then when you know the input and template, substitute them. They 
won't
have $ in them, but would look something like this:

[
  input = [A = 2; B = 3;]
  template = [A = input.A; B = input.B; C = input.A * input.C;
]
Then iterate through the template (using the STL-like functions
begin() and end() and evaluate each expression, and create a new
ClassAd.
-alain
Condor Classads Info:
http://www.cs.wisc.edu/condor/classad/



		
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
Condor Classads Info:
http://www.cs.wisc.edu/condor/classad/
Condor Classads Info:
http://www.cs.wisc.edu/condor/classad/


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