#ifndef KERN_UOBJ_H
#define KERN_UOBJ_H


class File;
class Terminal;
class Ufile;
class Ulink;
class UlistB;

class Uobj;
class Ulist { // container class for user object
  private:
    unsigned long ulMaxID;
  public:
	  UlistB *llist;
  public:
		Ulist(void);
		~Ulist(void);
    unsigned long MaxID(void) const { return(ulMaxID); }
    void MaxID(unsigned long ul) { ulMaxID = ul; }
    void DestroyAll(void);
		void Delete(Uobj *uop);
    void write(File &) const;
    void read(File &);
		void remap(void); 
		Uobj *IndexToPointer(unsigned long ul);  
    Uobj *Front(void);
};
extern Ulist ulist;

const unsigned long USER_OBJ = 105;      
class Uobj {   // base class of user object
  private:
    unsigned long ulId;
		unsigned long ulType; 
	public:
		Ulink *ulink;
  public:
    Uobj(unsigned long ulID=0, bool bClone=false, bool bRegister=false);
    virtual ~Uobj(void);
    virtual const char *Name(void) const = 0;
		virtual unsigned long Type(void) const = 0;
		virtual unsigned long TypeUser(void);  
		virtual Uobj *Clone(unsigned long ulID=0) const = 0;
		virtual void write(Ufile &fi) const;
		virtual void read(Ufile &fi);
    virtual void remap(void);
		Uobj *Next(Uobj *uobjp); 
    // Static function to access all Uobjs
    static unsigned long NumUobjs(void);
    static const Uobj *GetUobj(unsigned long);
    static void PrintCommand(Terminal &term);
};



#endif
