[ROOT] how to know what is the class of the object calling a member function of another class

From: Frankland John (frankland@ganil.fr)
Date: Thu Oct 30 2003 - 12:11:06 MET


Hi all

Whilst waiting an answer to my previous questions, here's a new one:
is there a way to know who has called a member function in a class ?
I have searched the web site, the reference guide (especially all the 
TDictionary
and TClass stuff), and the roottalk digest, and I can't find anything.

If I have a member function SomeFunction in SomeClass (derived from TObject)
I want to be able to do the following:

SomeClass::SomeFunction ( SomeArguments...){

    if ( 
getClassOfCallingObjectHere->InheritsFrom("SomeOtherRootBasedClass") )
    {
        doSomethingSpecific();
    }
}

So that if I have SomeOtherClass which has SomeOtherFunction

SomeOtherClass::SomeOtherFunction(){

    SomeClass obj;
    obj.SomeFunction( ... )
}

inside SomeClass::SomeFunction I will know that it was SomeOtherClass 
who made the call.

To be more specific, what I want to be able to do is to know if the dtor 
of one of
my classes has been called by a class derived from TList or not, and do
different things as a consequence.

Thanks a lot
John
-- 

John D. Frankland <mailto:frankland@ganil.fr>
Beam Coordinator
GANIL
B.P. 55027
14076 CAEN Cedex 05

*tel:* +33 (0)231454628
*fax:* +33 (0)231454665



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET