Re: [classad-users] ExprTree , ExprTreeList, Literal , Value


Date: Fri, 7 Jun 2002 12:18:15 -0500 (CDT)
From: Alessandro Maraschini <alessandro.maraschini@xxxxxxxxxx>
Subject: Re: [classad-users] ExprTree , ExprTreeList, Literal , Value
Nicholas Coleman wrote:
> Value           
valueToInsert ;
> valueToInsert.SetListValue(el)                        
//Create a Value
> instance of ExprList type
> Literal   *lit = Literal::MakeLiteral (valueToInsert);        
//converts the
> Value into a Literal
> someClassAd.Insert( some_string   ,   (ExprTree*)
lit);   //Insert  into a
> ClassAd
>
> That doesn't seem to me quite a good solution...
> Is there any other methods/classes available that I can use instead?
Yes. Since ExprList is a subexpression of ExprTree all you have to do
is:
someClassAd.Insert( some_string, el )
Uh! That's nice thank you. And what about my first problem? Have you
got any Idea?
>I have an ExprList instance and I'd like to append a new Value val.
>The solution I found is the following:
>const ExprList    *el;
>vector<ExprTree*>    vect;
>Value val ;
>[...]
>el-> GetComponents(vect);                              
// obtain the components of the expression list
>Literal   *lit = Literal::MakeLiteral (val);        
// convert the Value into a Literal
>vect.push_back(   (ExprTree*) lit  );                
// Append the Literal to the vector
>el= ExprList::MakeExprList(vect);                 
//Re-generate the ExprList from the vector
Alex


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