Program Listing for File completion_table.hpp

Return to documentation for file (completion_table.hpp)

#ifndef FELIX_COMPLETIONTABLE_H_
#define FELIX_COMPLETIONTABLE_H_

#include <map>
#include <cstdint>

class CompletionTable
{
    public:
        CompletionTable();

        void push(uint32_t addr);

        int update(uint32_t addr);

        uint32_t get_rd() const;

        uint32_t get_count(uint32_t addr) const;

        uint32_t get_previous_rd() const;

        size_t get_entries() const;

        void inspect() const;

        bool is_empty() const;

    private:
        typedef uint32_t address_t;
        typedef uint32_t counter_t;

        address_t m_rd;
        address_t m_last_pushed_addr;
        address_t m_last_provided_addr;
        std::map<address_t, counter_t> *m_current_table;
        std::map<address_t, counter_t> *m_wrap_table;
        std::map<address_t, counter_t>  m_table_a;
        std::map<address_t, counter_t>  m_table_b;
};

#endif /* FELIX_COMPLETIONTABLE_H_ */