[ROOT] Rootcint (again) and std::vectors of abstract classes

From: Alessandro Thea (thea@ge.infn.it)
Date: Wed Jun 16 2004 - 09:04:18 MEST


Hi again rooters,
I encountered another problem with rootcint and a vector of pointers of 
an abstract class:

I use two classes, SimuModuleFactory and SimuModule described at the end 
of this mail.
In few words, SimuModuleFactory holds fModules, a std::vector of 
SimuModule pointers.
SimuModule is an abstract class.
rootcint doesn't complain generating dictionary but  while compiling the 
shared library, g++ throws the following error:

/home/thea/work/esaf/tmp/ESAFTMP.thea/i686/simuframework/G___simuframeworkDict.cc: 
In
   function `void ROOT::stl_streamer_vectorlESimuModulemUgR(TBuffer&, 
void*)':
/home/thea/work/esaf/tmp/ESAFTMP.thea/i686/simuframework/G___simuframeworkDict.cc:465: 
cannot
   allocate an object of type `SimuModule'
/home/thea/work/esaf/tmp/ESAFTMP.thea/i686/simuframework/G___simuframeworkDict.cc:465:
    because the following virtual functions are abstract:
include/SimuModule.hh:32:       virtual bool SimuModule::Init()
include/SimuModule.hh:35:       virtual bool SimuModule::PreProcess()
include/SimuModule.hh:38:       virtual bool SimuModule::Process()
include/SimuModule.hh:41:       virtual bool SimuModule::PostProcess()
include/SimuModule.hh:44:       virtual bool SimuModule::Done()


I can make g++ compile hiding fModules.

#ifndef __MAKECINT__ // FIXME
    vector<SimuModule*> fModules;
#endif /* __MAKECINT__*/

or making SimuModule not-abstract
I would like to find a way around to include fModules in the dictionary 
keeping SimuModule abstract.
Do you think it would be possible? Do you have any suggestion?

By the way, thank to all root team for you ready support and advices.

Alessandro


class SimuModule : public EusoConfigurable {
public:

    SimuModule( const string& );
    virtual ~SimuModule();

    inline const string& GetName() const { return fName; }
    virtual bool Init() = 0;
    virtual bool PreProcess() = 0;
    virtual bool Process() = 0;
    virtual bool PostProcess() = 0;
    virtual bool Done() = 0;
    virtual void UserMemoryClean() {}

public:
    EusoConfigClass(Simu,SimuModule)

private:
    string fName;

    ClassDef(SimuModule,1)
};


class SimuModuleFactory {
public:
    // ctor
    SimuModuleFactory(const string&);

    // dtor
    virtual ~SimuModuleFactory();

    // get modules: NULL when all modules are done
    SimuModule *GetModule();

private:
    // physically build the modules
    void MakeModule(const string& mName);
    void MakeSequence(const string& mName);

    // modules and sequences
    vector<SimuModule*> fModules;

    // current module counter used in Get()
    size_t fCurrent;

    ClassDef(SimuModuleFactory,1)
};



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET