eosim::utils::EntityQueueOrdered EoSimulator Programmer's Manual
NAME
EntityQueueOrdered: Ordered Queue of Entities
SYNOPSIS
#include <eosim/utils/entityqueueordered.hpp>
namespace eosim {
namespace utils {
class EntityQueueOrdered: public EntityQueue {
public:
EntityQueueOrdered(core::EntityComp* comp_);
~EntityQueueOrdered ();
void push(core::Entity* ent_);
core::Entity* pop();
void remove(unsigned int i_);
bool empty();
core::Entity* operator[] (unsigned int i_);
unsigned int size();
};
}
}
DESCRIPTION
This is a ordered queue of entities. The queue is ordered according to the comparator given in the constructor, in a way that comparator.compare(q1,q2) is true when q1 an element of the queue and q2 the following.
CLASS OPERATIONS
EntityQueueOrdered(core::EntityComp* comp_):
The constructor creates an empty EntityQueueOrdered.
~EntityQueueOrdered ():
The destructor of EntityQueueOrdered. It assumed that all entities in a simulation are created dynamically, so when an EntityQueueOrdered is destroyed it deletes every entity stored.
void push(core::Entity* ent_):
This operation adds ent_ according to the comparator given in the constructor.
core::Entity* pop():
This operation returns and remove the first entity in the queue. If the queue is empty, the simulation aborts immediately displaying an error message.
void remove(unsigned int i_):
This operation removes the entity whose position is i_. If i_ is outside the queue, the simulation aborts immediately displaying an error message.
bool empty():
This operation returns 1 if the queue is empty.
core::Entity* operator[] (unsigned int i_):
This operation returns the entity whose position is i_. If i_ is outside the queue, the simulation aborts immediately displaying an error message.
unsigned int size():
This operation returns the size of the queue.
SEE ALSO