//---------------------------------------------------------------------------
#ifndef blif_exportH
#define blif_exportH

#include <map>

#include "trav.h"
#include "export.h"
#include "hub/hub.h"
#include "util/indent.h"
#include "hub/fsm.h"
#include "hub/pla.h"
//---------------------------------------------------------------------------
class BlifExport:
public TopTraverserClient,
public StructArchTravClient,
public Export {
private:
    TopTraverser traverser_;
	std::list<std::string> inPortNames;
	std::list<std::string> outPortNames;

	bool netBegins_;

	std::string findNet(std::string, std::string, hub::StructArch*);
public:
	virtual void haveEntity(hub::Entity*);
	virtual void endEntity(hub::Entity*);
    virtual void havePortProto (hub::PortProto*);
    virtual void haveArch (hub::Architecture*);

    virtual void haveInst (hub::Instance*);
public:
    virtual void operator() (std::ostream* os, Export::Source* src); 
    BlifExport (hub::Hub*);
   ~BlifExport () {}
};

// ========== wrappers that introduce repr functions into exportMap =======
class BlifKissTable {
public:
	static bool Represent (BlifExport&, hub::FsmDescr&);
	static int wantInit;
};
// ========== wrappers that introduce repr functions into exportMap =======
class BlifPlaTable {
public:
	static bool Represent (BlifExport&, hub::PlaDescr&);
	static int wantInit;
};
// ======================================================================================
class BlifExpLang: public ExportLang {
public:
    static void enregister (void);
    BlifExpLang (const std::string& n): ExportLang(n) {}
    Export* getExporter (hub::Hub& theHub) { return new BlifExport (&theHub); }
    void getDefaults (hub::Hub* h, const std::string& fn, Export::Source&);

};
#endif
