#ifndef FDTABLE_HPP_
#define FDTABLE_HPP_
#include "common.hpp"


#define MAX_CLIENTS 512


template <class T> class FdTable {
    private:
        T table[MAX_CLIENTS+10]; // leaves headroom for e.g. std-fds, accept fd

    public:
        FdTable() {
            memset(&table, 0, sizeof(table)); // should be rarely constructed, so this assumption might be ok to provide
        }
        ~FdTable() {}

        INLINE T get(int fd) const {
            return table[fd];
        }

        INLINE void set(int fd, const T val) {
            table[fd] = val;
        }

        INLINE T& operator[](int fd) {
            return table[fd];
        }

        static const unsigned size = MAX_CLIENTS+10;
};


#endif