#ifndef TRAV_H
#define TRAV_H
#include "hub/hub.h"
#include "hub/structural.h"
#include "export.h"
#include "hub/location.h"
#include <string>

class TopTraverserClient {
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 ~TopTraverserClient ();

};
class StructArchTravClient {
public:
    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*);

    virtual ~StructArchTravClient ();
};
// ======================================================================
class TopTraverser: public hub::Location {
    
    TopTraverserClient* client_;

    void travLib (hub::Library*);
    void travEnt (hub::Entity*);

public:
    void operator() (void);
    TopTraverser (hub::Hub* h, TopTraverserClient* client): 
    hub::Location (h),
    client_(client) 
    {}
    TopTraverser& operator = (const Location& loc) { Location::operator = (loc); return *this; }
};

// ----------------------------------------------------------------------
class StructArchTraverser {
    hub::StructArch* archImpl_;
    StructArchTravClient* client_;
    
public:
    void travNets (void);
    void travPorts (void);
    void travPorts (const hub::PortProto::flagsType&);
    void travInsts (void);

    StructArchTraverser (hub::StructArch* archImpl, StructArchTravClient* client):
    archImpl_(archImpl),
    client_(client) {} 

};


#endif
