#ifndef EXPORT_H
#define EXPORT_H
#include <iostream>
#include <fstream>
#include <string>
#include "hub.h"
#include "indent.h"
#include "location.h"
#include "behavioral.h"

// #define dbg
#include "reg.h"		// export bimethods
// #undef dbg
// ===========================================================
//	common export parameters
// -----------------------------------------------------------
class Export {
protected:
    std::string fileName_; 			// input file name
    hub::LocationNames loc_;		// destination names
    
public:								// because of output representers
    std::ofstream out;
    newline_base  nlbase_;
    newline nl_;

    Export (const std::string& fn = ""): fileName_(fn), nl_ (nlbase_) {}

    void fileName (const std::string& fn) { fileName_ = fn; }
    const std::string& fileName (void) { return fileName_; }	

    virtual void operator() (const std::string& ="")=0;
    virtual void operator() (hub::Library*,      const std::string& ="")=0;
    virtual void operator() (hub::Entity*,       const std::string& ="")=0;
    virtual void operator() (hub::Architecture*, const std::string& ="")=0;

    virtual ~Export() {}
    
    void libName       (const std::string& s) { loc_.libName(s); }
    void archName      (const std::string& s) { loc_.archName(s); }
    void entityName    (const std::string& s) { loc_.entityName(s); }

	static hub::StatDoubleReg <bool, Export&, hub::BehavDescr&> exportMap;
};
#endif
