00001 // AList.hpp - Class interface for a Array Based List 00002 00003 #ifndef __J2K__AList_HPP__ 00004 #define __J2K__AList_HPP__ 00005 00006 #include <j2k/Fred/Standard.hpp> 00007 00008 class AList { // Array-based AList class 00009 public: 00010 AList(); // Default Constructor 00011 AList( ULONG size ); // Constructor with Size 00012 virtual ~AList(); // Destructor 00013 00014 void clear(); // Remove all Elems from List 00015 void insert( Elem item ); // Insert Elem at current position 00016 void append( Elem item ); // Insert Elem at tail of List 00017 Elem remove(); // Remove and return current Elem 00018 void setFirst(); // Set curr to first position 00019 void prev(); // Move curr to previous position 00020 void next(); // Move curr to next position 00021 long getPos(); // Get curr position (-1 if empty) 00022 void setPos( ULONG pos ); // Set curr to specified position 00023 void setValue( Elem item ); // Set current Elem's value 00024 00025 Elem currValue() const; // Return current Elem's value 00026 ULONG length() const; // Return current length of List 00027 ULONG getMaxSize() const; // Return Maximum Size 00028 BOOL isEmpty() const; // Return TRUE if List is empty 00029 BOOL isInList() const; // TRUE if curr is within List 00030 long find( Elem val ); // Find value in list (-1 if fail) 00031 00032 void display() const; 00033 00034 private: 00035 ULONG msize; // Maximum size of List 00036 ULONG nbList; // Actual number of Elems in List 00037 ULONG curr; // Position of "current" Elem 00038 Elem* listarray; // Array holding List Elems 00039 }; 00040 00041 #endif