IntegerList

Overview

An IntegerList is for communicating a list of integers (C++ "long"s, actually) between Emdros and the program using Emdros. Internally, monad_ms, id_d_ts, and enumeration constant values are all longs. Thus an IntegerList can hold any of those kinds of values.

The list is ordered, and can be iterated with the normal Emdros-iterators.

The interface of IntegerList is very, very similar to StringList. They are even defined using the same template in the same header-file.

SPECIAL SWIG JAVA NOTE: The use of IntegerListConstIterator is deprecated on SWIG Java. Please use the IntegerList::getAsVector to obtain an IntVector instead.


#include <string_list.h>

class IntegerListConstIterator {
public:
  IntegerListConstIterator();
  IntegerListConstIterator(const IntegerList *pMotherIntegerList); // Not SWIG-wrapped.
  IntegerListConstIterator(const IntegerListConstIterator& other);
  ~IntegerListConstIterator();
  bool hasNext() const; // Is the iterator == end iterator?  Doesn't alter iterator
  long next(); // Gets current and advances iterator afterwards
  long previous();  // Regresses iterator and then gets current
  long current(); // Gets current without altering iterator
};

class IntegerList {
public:
  // Create empty string list, to be populated later
  // with addIntegerFront and/or addIntegerBack.
  IntegerList();

  // Copy constructor
  IntegerList(const IntegerList& other);

  // Assignment operator
  const IntegerList& operator=(const IntegerList& other); // Not SWIG-wrapped!

  ~IntegerList();

  IntegerListConstIterator const_iterator() const;

  std::vector<long> getAsVector(void) const;

  // Add at beginning of list, pushing everything down one member
  void addIntegerFront(long l);

  // Add at end of list
  void addIntegerBack(long l);

  bool isEmpty(void) const;
};


Previous:StringList
Up:Part II: APIs
Next:XML output