#ifndef KLIST_H
#define KLIST_H

#include <stdint.h>
#include <klog.h>

class KListNode
{
public:
    KListNode(void *iData) : mData(iData), mNext(0) {}
    void setNext(KListNode *nextnode) { mNext = nextnode; }
    KListNode *getNext() { return mNext; }
    void *getData() { return mData; }
private:
    void *mData;
    KListNode *mNext;
};

class KList : public cKlog
{
public:
    KList() : cKlog("Klist"),mStart(0), mCurrent(0), mEnd(0), mNodeCount(0) {}
    ~KList();
    void add(void *content);
    bool step();
    void *get();
    void *getfirst();
    void *pull();
    void reset() { mCurrent = mStart; }
    bool empty();
    uint16_t size() { return mNodeCount; }
private:
    KListNode *mStart;
    KListNode *mCurrent;
    KListNode *mEnd;
    uint16_t mNodeCount;
};

#endif
