#ifndef __ITERATOR_H_
#define __ITERATOR_H_

enum e_IteratorStatus
{
    IteratorSuccess,
    IteratorEnd,
    IteratorOutOfSync
};

typedef struct s_IIterator IIterator;

typedef struct s_Iterator Iterator;
typedef enum e_IteratorStatus IteratorStatus;

struct s_IIterator
{
    IteratorStatus (*next) (IIterator *);
    void * (*get_value) (IIterator *);
    void (*destroy) (IIterator *);
};

typedef IteratorStatus (*IteratorNextDelegate)(void *data);
typedef void *(*IteratorValueDelegate)(void *data);
typedef void (*IteratorDestroyDelegate)(void *data);

Iterator * iterator_new (void *data, IteratorNextDelegate next,
                IteratorValueDelegate value, IteratorDestroyDelegate destroy);

IteratorStatus iterator_next (Iterator *iter);
void * iterator_value (Iterator *iter);
void iterator_destroy (void *ptr);


#endif
