Hi,
I'm having some problems while trying to make conversion between Exptree
and Value using ExprTreeList class using ClassAd C++ 0.9.1 Version
Well 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
but I really don't like it.
Moreover, if I had to Insert an ExprList into a ClassAd instanceI
should do the following :
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?
Thank you,
Alex
|