Re: [CINT] Re: Embedding CINT in C++ application

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Wed, 05 Dec 2007 10:08:58 +0100


...or, for more of C++ including variable declaration etc, pass your C++ code as a string to ROOT's gInterpreter>ProcessLine(). gInterpreter is ROOT's global TCint object; a high level interface to CINT. See <http://root.cern.ch/root/html/TCint#TCint:ProcessLine> If you weant to do the same with CINT stand-alone then please let us know.

Cheers, Axel.

Rene Brun wrote:

> ROOT provides two classes (TFormula and TTreeFormula) for doing exactly
> what you want to do.
> see examples of use with ROOT Trees in the Users Guide
>   ftp://root.cern.ch/root/doc/12Trees.pdf
> at section "Simple Analysis using Trees" at page 213 and following
> 
> Rene Brun
> 
> Borse, Ganesh wrote:

>>
>> Hi,
>> Is it possible to embed ROOT CINT in C++ application & use it for
>> doing dynamic expressions parsing, compilation and then multiple run
>> time evaluations those expressions?
>>
>> I can see the root/bin/cint has all its logic in root/lib/libCint.so,
>> with ldd command.
>>
>> E.g, I have the expressions as below:
>> ((size < 1000) && (vol < (0.001 * ADV)) && (prod == "Stock") &&
>> strstr("ABCD,EFGH,HIJK,NEWONE,song,JUNK,DONE",ordClient))
>>
>> The variables size, ADV, vol, etc. will be changing at runtime.
>> So, I would like to create function which will take these variables as
>> input arguments & return the result of evaluated expression.
>>
>> Since, these expressions, the number & type of these variables is not
>> at compilation time, I cannot create & compile these function at
>> compiling my application.
>>
>> Hence, I need to use some kind of interpreter which can take these
>> expressions, etc as source code & compile them.
>>
>> I tried to use Python & Perl interpreters for embedding them in C++
>> application. But they don't provide the required performance level.
>>
>> Also, the syntax of the expressions is to be same that in these
>> scripting languages. Hence, it is little tedious to use them.
>>
>> May you please guide me, if I can use cint for this?
>> What are the functions, APIs & include headers, etc. I need to use for
>> this?
>>
>> A sample program of the same thing which I am doing with Cpython API
>> (embedding Python in C) is attached here.
>>
>> Thanks and Regards,
>> Ganesh
>> <<testeval.cpp>>
>>
>> ==============================================================================
>>
>> Please access the attached hyperlink for an important electronic
>> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>> ==============================================================================
>>
>>

>
> Received on Wed Dec 05 2007 - 10:09:21 CET

This archive was generated by hypermail 2.2.0 : Wed Dec 05 2007 - 11:50:01 CET