#ifndef INCLUDE_LEARN_ATOMEPORT____LEARN____INTPORT_HPP_
#define INCLUDE_LEARN_ATOMEPORT____LEARN____INTPORT_HPP_

#include <AtomExportPort.hpp>
#include <learn/AtomIPort__learn__intPort.hpp>

#include <learn/PT__learn__intPort.hpp>

class AtomEPort__learn__intPort :
    public virtual Port,
    public AtomExportPort,
    public PT__learn__intPort {
public:
    AtomEPort__learn__intPort(const string &name, bool hasEarlyUpdate);
    virtual ~AtomEPort__learn__intPort();
    virtual void addInternalPort(AtomIPort__learn__intPort &p);

    virtual vector<PortValue *> &portValues();
    virtual const vector<PortValue *> &portValues() const;
    virtual bool hasPortValues() const;
    virtual void addPortValue(PortValue &port);
    virtual void clearPortValues();

    virtual bool isReset() const;
    void setIsReset(bool b);

protected:
// Getting messy to store actual type and return more abstract one (thanks to vector template...)
//    vector<PV__learn__intPort *> mPortValues;
    vector<PortValue *> mPortValues;
    bool mIsReset;
}; 


inline
void AtomEPort__learn__intPort::addInternalPort(AtomIPort__learn__intPort &p) {
    AtomExportPort::addInternalPort(p);
}

inline
vector<PortValue *> &AtomEPort__learn__intPort::portValues() {
    return mPortValues;
}

inline
const vector<PortValue *> &AtomEPort__learn__intPort::portValues() const {
    return mPortValues;
}

inline
bool AtomEPort__learn__intPort::hasPortValues() const {
    return !mPortValues.empty();
}

inline
void AtomEPort__learn__intPort::addPortValue(PortValue &port) {
    mPortValues.push_back(&port);
}

inline
void AtomEPort__learn__intPort::clearPortValues() {
    mPortValues.clear();
}

inline
bool AtomEPort__learn__intPort::isReset() const {
    return mIsReset;
}

inline
void AtomEPort__learn__intPort::setIsReset(bool b) {
    mIsReset = b;
}
#endif // INCLUDE_LEARN_ATOMEPORT____LEARN____INTPORT_HPP_
