//---------------------------------------------------------------------------
#ifndef blif_importH
#define blif_importH
//---------------------------------------------------------------------------
#include "hub/hub.h"
#include "hub/structural.h"
#include "hub/attr.h"
#include "hub/location.h"
#include "import.h"
#include "blif_parser.h"
//---------------------------------------------------------------------------
class BlifImport: public BlifParserClient, public Import {
private:
    BlifParser parser_;

    int plaId;

    std::string modelname;
    hub::StructArch* theArchImpl_;

    hub::Location dest_;
    hub::Location synth_;
    hub::Location kiss_;

    hub::Location* toplevel_;

protected:
    virtual void endModel();
    virtual void haveModel (const std::string&); 
    virtual void haveInPorts (const std::list<std::string>& portNames);
    virtual void haveOutPorts (const std::list<std::string>& portNames);
    virtual void haveNames (std::list<std::string>& ports, std::list<std::string>& matrix);
    virtual void haveSubckt (std::list<SubcktRecord*>& subckts);
    virtual void haveKiss (int, int, std::list<hub::StateTableRow>&, std::string& resetState, int stateCount, int productCount);
    virtual void haveSearch (const std::string& fn);

public:
    virtual void operator() (std::istream*, const std::string&, std::vector<hub::Location>&);

    BlifImport(hub::Hub* h):
        parser_(this), plaId(0),
        dest_ (h), synth_ (h), kiss_ (h)
        {}
   ~BlifImport() {}
};

// ==========================================================================
class BlifImpLang: public ImportLang {
public:
    static void enregister (void);
    BlifImpLang (const std::string& n): ImportLang(n) {}
    Import* getImporter (hub::Hub* theHub) { return new BlifImport (theHub); }
    void getDefaults (hub::Hub*, const std::string&, Import::Destinations&);
};

#endif
