Another common feature is the access methods. All containers provide random access to its elements. They are indexed by an int (CEventVector, DistVector and EntityQueue) or by a key (BEventMap). For example:
Entity* ent = queue[5];
//gets the 5º element in queue
BEvent* bev = map[“llegada”]; //gets the BEvent whose name is “llegada” from bev
Also you can remove elements by giving the proper type of index. In case of indexing outside the container, EOSimulator immediately aborts displaying an error message.
All containers are created empty and ready to use, but when it comes to destructors things are a little bit complicated. As we said above, most model attributes could be created statically or dynamically but is responsibility of the user to delete them. On the other hand, entities must be created dynamically and EOSimulator deletes them. EntityQueue and its subclasses delete every pointer they store, because they assumed that all entities are created dynamically. CEventVector, DistVector and BEventMap don’t make any assumptions so the programmer takes charge. For more information about container see [4].
Classes | |
class | eosim::utils::BEventMap |
Mapping of B Events. More... | |
class | eosim::utils::CEventVector |
Vector of C Events. More... | |
class | eosim::utils::DistVector |
Vector of Distributions. More... | |
class | eosim::utils::EntityQueue |
Interface for Queue of Entities. More... | |
class | eosim::utils::EntityQueueFifo |
Fifo Queue of Entities. More... | |
class | eosim::utils::EntityQueueLifo |
Lifo Queue of Entities. More... | |
class | eosim::utils::EntityQueueOrdered |
Ordered Queue of Entities. More... |