

#ifndef AFC_NODEMASTER_H
#define AFC_NODEMASTER_H


/*  NodeMaster.h  $ 19/05/97 FR MT $  */


#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef EXEC_LISTS_H
#include <exec/lists.h>
#endif


/* Version and revision */

#define NODEMASTER_VERSION  3
#define NODEMASTER_REVISION 40

/* Error codes */

#define NODEMASTER_BASE 0x00010000
#define NMERR_NOMEMORY  (NODEMASTER_BASE + 0)

/* Insertion modes */

#define NM_ADD_HEAD 1
#define NM_ADD_HERE 2
#define NM_ADD_TAIL 3


/* Class prototype */

class nodemaster
{
   public:

   nodemaster(void);
   ~nodemaster(void);
   ULONG error(void);
   APTR add(APTR s, ULONG mode = NM_ADD_TAIL);
   BOOL empty(void);
   APTR first(void);
   Node *get(void);
   List *addr(void);
   BOOL push(void);
   APTR pop(BOOL autopos = TRUE);
   APTR obj(void);
   APTR del(void);
   void clearstack(void);
   APTR last(void);
   APTR succ(void);
   APTR prev(void);
   APTR insert(APTR s);
   BOOL clear(void);
   ULONG numitems(void);
   APTR item(ULONG n);
   APTR change(APTR s);
   APTR changepos(Node *node);
   LONG numpos(void);
   void changenum(ULONG newnum);
   APTR sort(LONG (*comp)(APTR, APTR, APTR), APTR info = NULL);
   ULONG version(BOOL rev = FALSE);
   BOOL isfirst(void);
   BOOL islast(void);
};


#endif

