Construct version 5.4.4
An agent based modeling framework
|
Finds the next index that aligns iterators. More...
Public Member Functions | |
graph_iterator (unsigned int row, unsigned int col, const Graph< link_type > *parent, void *ptr) | |
virtual const link_type & | examine (void) const =0 |
Returns the value of the link the iterator is pointing to. More... | |
Public Member Functions inherited from typeless_graph_iterator | |
typeless_graph_iterator (unsigned int row=0, unsigned int col=0, void *ptr=NULL) | |
unsigned int | row (void) const noexcept |
The row index this iterator is pointing to. | |
unsigned int | col (void) const noexcept |
The column index this iterator is pointing to. | |
virtual unsigned int | index () const noexcept |
Depending on implementation, returns either row or col. More... | |
virtual unsigned int | max () const noexcept |
Returns the maximum value that Construct can return. More... | |
virtual const typeless_graph_iterator & | operator++ (void) const |
Depending on implementation, increments the iterator to point to the next relevant element. More... | |
Public Attributes | |
Graph< link_type > * | _parent = NULL |
Public Attributes inherited from typeless_graph_iterator | |
void * | _ptr |
unsigned int | _row |
unsigned int | _col |
Finds the next index that aligns iterators.
Each iterator is advanced until each typeless_graph_iterator::index are all equal. If an iterator's index ever equals typeless_graph_iterator::max, all other iterators are advanced until they are set to their maximum index.
it_list | A vector of iterator pointers this function will align. |
Example
Output:
//Agent 3 has a value of 2 and agent 2 has a value of 3 //Agent 3 has a value of 3 and agent 2 has a value of 6 //
Complexity
Dependent on the number of elements in the iterator vector and the number of increment operator calls on the iterators.
Exception Safety
An assertion is raised if it_list has size 0 or 1. / void it_align(std::vector<typeless_graph_iterator*>& it_list);
/*!
Aligns the iterators if they are not already.
Does nothing if all typeless_graph_iterator::index are equal. Otherwise it_align is used to align the iterators.
it_list | A vector of iterator pointers this function will align. |
Example
Output:
// Agent 3 has a value of 2 and agent 2 has a value of 3 // Agent 3 has a value of 3 and agent 2 has a value of 6 //
Complexity
If the iterators are aligned, linear in number of iterators. Otherwise, Dependent on the number of elements in the iterator vector and the number of increment operator calls on the iterators.
Exception Safety
An assertion is raised if it_list has size 0 or 1. / void init_align(std::vector<typeless_graph_iterator*>& it_list);
/*!
Finds the next index that aligns iterators except the first iterator.
The first iterator is incremented if its typeless_graph_iterator::index is less than any of the other iterators in the vector. If the first iterator index is ever equal to any other iterator, both iterators are incremented.
it_list | A vector of iterator pointers this function will align. |
Example
Output:
// Agent 3 has a value of 2 and agent 2 has a value of 3 // Agent 3 has a value of 3 and agent 2 has a value of 6 //
Complexity
Dependent on the number of elements in the iterator vector and the number of increment operator calls on the iterators.
Exception Safety
An assertion is raised if it_list has size 0 or 1. / void it_align_before_first(std::vector<typeless_graph_iterator*>& it_list);
/*!
Aligns the iterators if they are not already.
Does nothing if all typeless_graph_iterator::index are equal. Otherwise it_align is used to align the iterators.
it_list | A vector of iterator pointers this function will align. |
Example
Output:
// Agent 3 has a value of 2 and agent 2 has a value of 3 // Agent 3 has a value of 3 and agent 2 has a value of 6 //
Complexity
If the iterators are aligned, linear in number of iterators. Otherwise, Dependent on the number of elements in the iterator vector and the number of increment operator calls on the iterators.
Exception Safety
An assertion is raised if it_list has size 0 or 1. / void init_align_before_first(std::vector<typeless_graph_iterator*>& it_list);
/*! <summary> An iterator parent with a template type that stores the parent graph pointer. <para> All graph_iterator pointers rely on the parent graph to tell it how to interpret the data it stores. </para> </summary>
|
pure virtual |
Returns the value of the link the iterator is pointing to.
Implemented in graph_utils::row_graph_iterator< link_type >, and graph_utils::col_graph_iterator< link_type >.
Graph<link_type>* graph_utils::graph_iterator< link_type >::_parent = NULL |
summary>