/*
 * Copyright ©2026 Soham Pardeshi. All rights reserved.
 * Permission is hereby granted to students registered for University of
 * Washington CSE 333 for use solely during Summer Quarter 2026 for
 * purposes of the course. No other use, copying, distribution, or
 * modification is permitted without prior written consent. Copyrights
 * for third-party components of this work must be honored. Instructors
 * interested in reusing these course materials should contact the author.
 */

#ifndef INTLIST_H_
#define INTLIST_H_

namespace intlist333 {

// An abstract list of integers. Integers can be added to or removed from
// either end of the list.
class IntList {
 public:
  IntList() = default;

  virtual ~IntList() = default;

  // Returns the number of elements in the list.
  virtual int num_elements() const = 0;

  // Pushes the given integer onto the front of the list.
  virtual void Push(int payload) = 0;

  // Appends the given integer to the back of the list.
  virtual void Append(int payload) = 0;

  // Removes the first element and writes it to `payload_ptr`. Returns false if
  // the list is empty.
  virtual bool Pop(int* const payload_ptr) = 0;

  // Removes the last element and writes it to `payload_ptr`. Returns false if
  // the list is empty.
  virtual bool Slice(int* const payload_ptr) = 0;
};

}  // namespace intlist333

#endif  // INTLIST_H_