ParticleStack(Particle* h);The constructor takes a Particle pointer. If it is a null pointer an empty ParticleStack is created. Otherwise the stack has one particle. Adding a Particle to a ParticleStack modifies that Particle's link field; therefore a Particle can belong to only one ParticleStack at a time.
~ParticleStack();The destructor deletes all Particles EXCEPT for the last one; we do not delete the last one because it is the "reference" particle (for Plasma) and is normally not dynamically created (this code may be moved in a future release to the Plasma destructor, as this behavior is needed for Plasma and not for other types of ParticleStack).
void put(Particle* p);Push
p
onto the top (or head) of the ParticleStack.
Particle* get();Pop the particle off the top (or head) of the ParticleStack.
void putTail(Particle* p);Add
p
at the bottom (or tail) of the ParticleStack.
int empty() const;Return
TRUE
(1) if the ParticleStack is empty, otherwise 0.
int moreThanOne() const;Return
TRUE
(1) if the ParticleStack has two or more particles, otherwise 0. This is provided to speed up the derived class Plasma a bit.
void freeup();Returns all Particles on the stack to their Plasma (the allocation pool for that particle type).
Particle* head() const;Return pointer to head.
Particle* tail() const;Return pointer to tail.