Class:nsTDeque

From MozillaWiki
Revision as of 15:34, 15 June 2006 by Darin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
template <class T>
class nsTDeque {
public:
  /**
   * @constructor
   * @param objectsPerPage
   *    Optional parameter that specifies the number of objects per page
   *    in the deque.
   */
  explicit nsTDeque(PRUint32 objectsPerPage = 32);
   
  /**
   * @destructor
   */
  ~nsTDeque();
   
  /**
   * Clear all elements from the deque.
   */
  void Clear();
   
  /**
   * Returns the number of elements in the deque.
   */
  PRUint32 Length();  // or Count() ?
   
  /**
   * Adds a new element to the front of the deque.
   * @param obj
   *    The object to be added.
   */
  void PushFront(const T& obj);
   
  /**
   * Adds a new element to the front of the deque.
   * @returns the address of the newly added element. 
   */
  T* PushFront();
   
  void PushBack(const T& obj);
  T* PushBack();
  const T& Front() const;
  T& Front();
  const T& Back() const;
  T& Back();
  void PopFront();
  void PopBack();
};