#ifndef DBG_EXPORT_H
#define DBG_EXPORT_H

#include <map>

#include "trav.h"
#include "export.h"
#include "hub.h"
#include "indent.h"
#include "attr.h"
#include "symfunc.h"

class DbgExport: 
public TraverserClient, 
public StructArchTravClient,
public Export {
    Traverser traverser_;
    bool netBegins_;

    static std::map < hub::AttrIndex <hub::PortProto>, std::string > portAttrMap;
    static std::map < hub::AttrIndex <hub::Architecture>, std::string > archAttrMap;
    static std::map < hub::AttrIndex <hub::Net>, std::string > netAttrMap;

    void initPortAttrMap (void);
    void initArchAttrMap (void);
    void initNetAttrMap (void);

    void havePortAttr (hub::PortProto*);
    void haveArchAttr (hub::Architecture*);
    void haveNetAttr  (hub::Net*);
    
public:
    virtual void haveUnit (void);
    virtual void endUnit  (void);
    virtual void haveLibrary (hub::Library*);
    virtual void endLibrary  (hub::Library*);
    virtual void haveDesign (hub::Design*);
    virtual void endDesign  (hub::Design*);
    virtual void haveEntity (hub::Entity*);
    virtual void endEntity  (hub::Entity*);
    virtual void havePortProto (hub::PortProto*);
    virtual void haveArch (hub::Architecture*);
    virtual void endArch  (hub::Architecture*);

    virtual void haveNet (hub::Net*);
    virtual void endNet  (hub::Net*);
    virtual void haveJoined (hub::Joinable*);
    virtual void havePort (hub::Port <hub::StructArch>*);
    virtual void haveInst (hub::Instance*);

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

    DbgExport (hub::Hub*,          const std::string& fn="");
    DbgExport (hub::Library*,      const std::string& fn="");
    DbgExport (hub::Entity*,       const std::string& fn="");
    DbgExport (hub::Architecture*, const std::string& fn="");
    ~DbgExport () {}
};
// ========== wrappers that introduce repr functions into exportMap =======
class DbgSymFunc {
public:
	static const char* ftab [hub::SymFunc::fNull+1];
	static bool Represent (DbgExport&, hub::SymFunc&);
	static int wantInit;
};
class DbgRTLReg {
public:
	static bool Represent (DbgExport&, hub::RTLReg&);
	static int wantInit;
};
#endif
