[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:

   function `void ROOT::stl_streamer_vectorlESimuModulemUgR(TBuffer&, 
   allocate an object of type `SimuModule'
    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.


class SimuModule : public EusoConfigurable {

    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() {}


    string fName;


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

    // dtor
    virtual ~SimuModuleFactory();

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

    // 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;


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