eosim::utils::EntityQueue                        EoSimulator Programmer's Manual

 

NAME

      EntityQueue: Interface for Queue of Entities

 

SYNOPSIS

      #include <eosim/utils/entityqueue.hpp>

 

namespace eosim {

namespace utils {

     

class EntityQueue {

public:

EntityQueue();

virtual ~EntityQueue();

virtual void push(core::Entity* ent_) = 0;

virtual core::Entity* pop() = 0;

virtual void remove(unsigned int i_) = 0;

virtual bool empty() = 0;

virtual core::Entity* operator[] (unsigned int i_) = 0;

virtual unsigned int size() = 0;

};

     

}

}

 

DESCRIPTION

This interface defines the behavior of all queues of entities in EoSimulator.

 

CLASS OPERATIONS

EntityQueue():

The constructor creates an empty EntityQueue.

     

~EntityQueue():

      The destructor of EntityQueue. It assumed that all entities in a simulation are created dynamically, so when an EntityQueue is destroyed it deletes every entity stored.

     

void push(core::Entity* ent_):

            This operation adds ent_ in the queue. The position where ent_ is inserted depends on the realization of the interface.

           

core::Entity* pop():

This operation returns and remove the first entity in the queue.

 

void remove(unsigned int i_):

            This operation removes the entity whose position is i_.

 

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_. The use of this operation is either eQue[i] or eQue.operator[](i).

     

unsigned int size():

This operation returns the size of the queue.

 

 

SEE ALSO

eosim::core::Entity

eosim::core::Model

eosim::utils::EntityQueueFifo

eosim::utils::EntityQueueLifo

eosim::utils::EntityQueueOrdered