Re: [ROOT] signal/slots and dictionnary

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed May 02 2001 - 15:02:09 MEST


Hi Colin,

  yes the classes should have a dictionary. All ROOT GUI classes of
course have a dictionary so you only have to create them for your own
classes. We are aware of the map<> problem which will soon be fixed.
On the otherhand you classes don't have to support persistency to be
able to have a dictionary and use the signal/slot mechanism. So the
easiest thing is to use:

   ClassDef(myclass,0)   // 0 means class is not persistent

Cheers, Fons.


Colin Bernet wrote:
> 
> Hi,
> 
> I'm trying to convert a GUI (compiled program) to the signal/slot
> communication mechanism. The signals being not catched by the slots, I
> was wondering if a dictionnary is necessary to use signal/slots.
> 
> This brings me to a second question, concerning rootcint. Trying to
> generate the dictionnary for this program's classes, I run into the
> following problems :
> 
> - maps don't look to be correctly handled by rootcint. I have a
> map<string, TCanvas*> and a map<string, bool>, and I get the following
> message for both of them when compiling the dictionnary :
> 
> Dict.cc:1123: `R__t2' undeclared (first use this function)
> Dict.cc:1123: (Each undeclared identifier is reported only once
> Dict.cc:1123: for each function it appears in.)
> 
> I had a look in the generated code : R__t2 is not declared, and I found
> some other strange uses of these maps too, eg :
> 
> R__b << int(fDetInTree.size());
> map<string,bool>::iterator R__k;
> for (R__k = fDetInTree.begin(); R__k != fDetInTree.end(); ++R__k) {
> 
>       static TString R__str = (*R__k).c_str();
>       //  should be static TString R__str = ((*R__k).first).c_str(); ?
> 
>       R__str.Streamer(R__b);
> }
> 
> - streams also seem to be a problem
> Dict.cc:1130: no match for `TBuffer & >> ifstream *&'
> 
> Am I doing a mistake ? Are these types currently supported by root ?
> Thanks,
> Colin
> 
> Here are the messages I get when the dictionnary is generated and
> compiled :
> 
> /usr/local/root/3.01-00/root/bin/rootcint -f Dict.cc -c
> \
> -Wall -O2 -I/usr/local/root/3.01-00/root/include -g -I../../src
> -I../../expat/xmlparse -ansi Plane.h Plane1V.h PlaneTrigTime.h
> PlaneDriftChamber.h PlaneFiberHodo.h PlaneMicromegas.h PlaneTrigHodo.h
> PlaneMwpc.h PlaneScifi.h PlaneBMS.h PlaneRICH1.h MainFrame.h
> StartFrame.h Monitor.h  LinkDef.h
> Warning: File "Monitor.h" already loaded
> *** Datamember Plane1V::fChannelKept: no size indication!
> *** Datamember Plane1V::fChannelKept: pointer to fundamental type (need
> manual intervention)
> *** Datamember Plane1V::fTimeKept: no size indication!
> *** Datamember Plane1V::fTimeKept: pointer to fundamental type (need
> manual intervention)
> *** Datamember Plane1V::fChannel: no size indication!
> *** Datamember Plane1V::fChannel: pointer to fundamental type (need
> manual intervention)
> *** Datamember Plane1V::fTime: no size indication!
> *** Datamember Plane1V::fTime: pointer to fundamental type (need manual
> intervention)
> c++ -I. -Wall -O2 -I/usr/local/root/3.01-00/root/include -g -I../../src
> -I../../expat/xmlparse -ansi -c Dict.cc -o Dict.o
> Dict.cc: In method `void MainFrame::Streamer(class TBuffer &)':
> Dict.cc:853: warning: `char * R__t' might be used uninitialized in this
> function
> Dict.cc:854: warning: `Char_t * c' might be used uninitialized in this
> function
> Dict.cc: In method `void Monitor::Streamer(class TBuffer &)':
> Dict.cc:1123: `R__t2' undeclared (first use this function)
> Dict.cc:1123: (Each undeclared identifier is reported only once
> Dict.cc:1123: for each function it appears in.)
> Dict.cc:1130: no match for `TBuffer & >> ifstream *&'
> /usr/local/root/3.01-00/root/include/TBuffer.h:278: candidates are:
> TBuffer::operator >>(Char_t &)
> /usr/local/root/3.01-00/root/include/TBuffer.h:340:
> TBuffer::operator >>(UChar_t &)
> /usr/local/root/3.01-00/root/include/TBuffer.h:285:
> TBuffer::operator >>(Short_t &)
> ... and so on ....
> 
> Colin Bernet
> Tel. +49-6131/39-23192
> Fax  +49-6131/39-22964

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:44 MET