Construct version 5.4.3
An agent based modeling framework
|
An InteractionMessageQueue is a container of InteractionMessages using a list. More...
Public Types | |
using | iterator = std::list< InteractionMessage >::iterator |
using | const_iterator = std::list< InteractionMessage >::const_iterator |
using | reverse_iterator = std::list< InteractionMessage >::reverse_iterator |
using | const_reverse_iterator = std::list< InteractionMessage >::const_reverse_iterator |
Public Member Functions | |
iterator | begin (void) noexcept |
Returns an iterator pointer to the first element in the list of InteractionMessages. More... | |
iterator | end (void) noexcept |
Returns an iterator pointer to the after-the-last element in the list of InteractionMessages. More... | |
const_iterator | begin (void) const noexcept |
Returns a const_iterator pointer to the first element in the list of InteractionMessages. More... | |
const_iterator | end (void) const noexcept |
Returns a const_iterator pointer to the last element in the list of InteractionMessages. More... | |
reverse_iterator | rbegin (void) noexcept |
Returns an iterator pointer to the last element in the list of InteractionMessages. More... | |
reverse_iterator | rend (void) noexcept |
Returns an iterator pointer to the before-the-first element in the list of InteractionMessages. More... | |
const_reverse_iterator | rbegin (void) const noexcept |
Returns a const_reverse_iterator pointer to the last element in the list of InteractionMessages. More... | |
const_reverse_iterator | rend (void) const noexcept |
Returns a const_reverse_iterator pointer to the before-the-first element in the list of InteractionMessages. More... | |
void | clear (void) noexcept |
Clears the list of InteractionMessages. More... | |
void | addMessage (const InteractionMessage &msg) noexcept |
Adds the msg to the list of InteractionMessages. More... | |
void | addMessage (InteractionMessage &&msg) noexcept |
iterator | erase (iterator itr) noexcept |
Removes the InteractionMessage at the iterator position. More... | |
An InteractionMessageQueue is a container of InteractionMessages using a list.
Messages are used send information from one agent to another agent. This class allows the list of all messages to be centralized in one structure.
using InteractionMessageQueue::const_iterator = std::list<InteractionMessage>::const_iterator |
summary>
using InteractionMessageQueue::iterator = std::list<InteractionMessage>::iterator |
summary>
using InteractionMessageQueue::reverse_iterator = std::list<InteractionMessage>::reverse_iterator |
summary>
|
noexcept |
Adds the msg to the list of InteractionMessages.
An InteractionMessage is only added to the list if the Message is valid. Messages enter the list at the front using list::push_front.
msg | InteractionMessage to be added to the list of InteractionMessages. |
Example
Output:
Message Sender: 3 Message Receiver: 4 Message Contents: belief Message Sender: 5 Message Receiver: 6 Message Contents: knowledge
Complexity
Constant based on list::push_front.
Iterator validity
No changes
Exception Safety
This function never throws an exception.
|
inlinenoexcept |
Returns a const_iterator pointer to the first element in the list of InteractionMessages.
Example
Output:
Message Sender - 1 : Message Receiver - 3 Message Sender - 4 : Message Receiver - 1 Message Sender - 3 : Message Receiver - 5
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
inlinenoexcept |
Returns an iterator pointer to the first element in the list of InteractionMessages.
Example
Output:
Message Sender - 1 : Message Receiver - 3 Message Sender - 4 : Message Receiver - 1 Message Sender - 3 : Message Receiver - 5
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
inlinenoexcept |
Clears the list of InteractionMessages.
Example
Output:
Message Sender - 1 : Message Receiver - 3 Message Sender - 4 : Message Receiver - 1 Message Sender - 3 : Message Receiver - 5 Message queue size: 0
Complexity
Linear in number of InteractionMessages in list.
Iterator validity
All iterators, pointers, and references are invalidated.
|
inlinenoexcept |
Returns a const_iterator pointer to the last element in the list of InteractionMessages.
Example
Output:
Message Sender - 1 : Message Receiver - 3 Message Sender - 4 : Message Receiver - 1 Message Sender - 3 : Message Receiver - 5
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
inlinenoexcept |
Returns an iterator pointer to the after-the-last element in the list of InteractionMessages.
Example
Output:
Message Sender - 1 : Message Receiver - 3 Message Sender - 4 : Message Receiver - 1 Message Sender - 3 : Message Receiver - 5
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
noexcept |
Removes the InteractionMessage at the iterator position.
This reduces the size of the list by 1 and destroys the element. Because the data structure is a list, inserting and removal at any position is efficient even in the middle of the sequence.
itr | Iterator position of the InteractionMessage to be erased. |
Example
Output:
Message Sender: 5 Message Receiver: 6 Message Contents: knowledge
Complexity
Constant based on list::erase.
Iterator validity
Iterators, pointers and references referring to the element removed by the function are invalidated. All other iterators, pointers, and references kepp their validity.
Exception Safety
If itr is valid, the function never throws exceptions. Otherwise, it causes undefined behavior.
|
inlinenoexcept |
Returns a const_reverse_iterator pointer to the last element in the list of InteractionMessages.
Example
Output:
Message Sender - 3 : Message Receiver - 5 Message Sender - 4 : Message Receiver - 1 Message Sender - 1 : Message Receiver - 3
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
inlinenoexcept |
Returns an iterator pointer to the last element in the list of InteractionMessages.
Example
Output:
Message Sender - 1 : Message Receiver - 3 Message Sender - 4 : Message Receiver - 1 Message Sender - 3 : Message Receiver - 5
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
inlinenoexcept |
Returns a const_reverse_iterator pointer to the before-the-first element in the list of InteractionMessages.
Example
Output:
Message Sender - 3 : Message Receiver - 5 Message Sender - 4 : Message Receiver - 1 Message Sender - 1 : Message Receiver - 3
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
inlinenoexcept |
Returns an iterator pointer to the before-the-first element in the list of InteractionMessages.
Example
Output:
Message Sender - 3 : Message Receiver - 5 Message Sender - 4 : Message Receiver - 1 Message Sender - 1 : Message Receiver - 3
Complexity
Constant.
Iterator validity
No changes.
Exception Safety
No-throw guarantee: this member function never throws exceptions.