#ifndef MARS_MWriteAsciiFile
#define MARS_MWriteAsciiFile

#ifndef MARS_MWriteFile
#include "MWriteFile.h"
#endif
#ifndef ROOT_TObjArray
#include <TObjArray.h>
#endif

class MWriteAsciiFile : public MWriteFile
{
private:
    ofstream *fOut;

    TObjArray fContNames;
    TObjArray fContainer;

    TString fNameFile;

    virtual void   CheckAndWrite() const;
    virtual Bool_t IsFileOpen() const;
    virtual Bool_t GetContainer(MParList *pList);
    virtual const char *GetFileName() const { return fNameFile; }

    void Init(const char *filename, const char *name, const char *title);

public:
    MWriteAsciiFile(const char *filename, const char *contname,
                    const char *name=NULL, const char *title=NULL);
    MWriteAsciiFile(const char *filename, MParContainer *cont=NULL,
                    const char *name=NULL, const char *title=NULL);
    ~MWriteAsciiFile();

    void AddContainer(const char *cname);
    void AddContainer(MParContainer *cont);

    ClassDef(MWriteAsciiFile, 0) // Class to write one container to an ascii file
};

#endif
