Hi Anton,
Whent CINT encounters an Unknown Object, it invokes TROOT::FindObject to
search
if an object with the specified name is in one of the "default" Root
lists:
//*-* - List of files
//*-* - List of memory mapped files
//*-* - List of functions
//*-* - List of geometries
//*-* - List of canvases
//*-* - List of styles
//*-* - List of specials
//*-* - List of materials in current geometry
//*-* - List of shapes in current geometry
//*-* - List of matrices in current geometry
//*-* - List of Nodes in current geometry
//*-* - Current Directory in memory
//*-* - Current Directory on file
If a named object in this search path exists, CINT creates a pointer
with the correct cast to the class name.
In your case, you can add your named objects, eg to the list of specials
TCamacCall *CamacCall = new TCamacCall("CC","Camac call");
gROOT->GetListOfSpecials()->Add(CamacCall);
In a macro, you can then reference directly CC.
If you look in the TCint constructor, you will see the following
statement:
G__InitGetSpecialObject(&TCint::FindObject);
This instructs CINT that in case it finds an unknown object, it must
call
the function in argument.
TCint::FindObject in turn calls TROOT::FindObject.
You can modify TCint::FindObject to extend the scope.
One could think of a generalized search path also.
Rene Brun
KOSU_FOKIN@garbo.lucas.lu.se wrote:
>
> Hi rooters,
>
> perhaps I missing a reference to a part of root documentation,
> so please tell me where to read on how to make named objects
> accessible by names under cint?
>
> I have
>
> TRint *theApp = new TRint("Rint", &argc, argv,0,0);
> TCamacCall *CamacCall = new TCamacCall("CC","Camac call"); // derived from TNamed
>
> in my program. Then
>
> CINT/ROOT C/C++ Interpreter version 5.14.10, Jul 20 1999
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] CC->Print();
> Error: No symbol CC->Print() in current scope FILE:/var/tmp/baa.raGHD_cint LINE:1
> Possible candidates are...
> filename line:size busy function type and name
> *** Interpreter error recovered ***
> root [1] CC.Print();
> Error: No symbol CC.Print() in current scope FILE:/var/tmp/caa_raGHD_cint LINE:1
> Possible candidates are...
> filename line:size busy function type and name
> *** Interpreter error recovered ***
> root [2] TCamacCall CC;
> root [3] CC.SomeCamacCall();
> This is a Camac call!
>
> -----
>
> Best regards,
> Anton
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET