#ifndef MGLIST_H
#define MGLIST_H

#ifdef DBG_MGLIST
#include <iostream.h>
#endif

#ifndef ROOT_TOrdCollection
#include <TOrdCollection.h>
#endif

class MGList : public TOrdCollection
{
public:
    ~MGList()
    {
#ifdef DBG_MGLIST
        cout << "Deleting:" << flush;
#endif

        TIter Next(this);

        TObject *obj;
        while ((obj=Next()))
        {
#ifdef DBG_MGLIST
            cout << " <" << ((TGObject*)obj)->GetName() << ">" << flush;
#endif
            delete (TGObject*)obj;
        }
#ifdef DBG_MGLIST
        cout << endl;
#endif
    }
    void Add(TGObject *obj)
    {
        TOrdCollection::Add(obj);
    }
};

#endif
