#include <ConnectionIterator.h>
Interface for iterating over connections | |
virtual void | init (const SimObjectPopulation &src, const SimObjectPopulation &dst)=0 |
Tell the iterator about the populations to connect. | |
virtual void | reset (SimObject::ID::SortedVector::const_iterator src_begin, SimObject::ID::SortedVector::const_iterator src_end, SimObject::ID::SortedVector::const_iterator dst_begin, SimObject::ID::SortedVector::const_iterator dst_end)=0 |
Reset/Prepare the iterator to connect src to dst (specified by the begin and end iterators). | |
virtual bool | next (pair< SimObject::ID, SimObject::ID > &connection)=0 |
Move on to the next connection. If true is returned the connection pair is set properly. | |
virtual bool | getIdx (size_t &src_idx, size_t &dst_idx) |
get the indices of the SimObjects in the src- and dst-population, only valid if last next() returned true | |
virtual size_t | estimate () |
Return an estimated number of connections which will be generated (if possible). | |
Random number engine interface | |
void | setRNDEngine (RandomEngine *engine) |
Set a particular random number engine. | |
void | unsetRNDEngine (void) |
Set default random number engine. | |
Public Member Functions | |
ConnectionIterator () | |
Default constructor. | |
virtual | ~ConnectionIterator () |
Destruct me. | |
Protected Attributes | |
RandomEngine * | m_rnd_eng |
The engine currently to use. | |
pair< size_t, size_t > | last_conn_idx |
bool | last_conn_valid |
This interface is used by the WiringMethod implementations SimpleAllToAllWiringMethod and DistributedSyncWiringMethod
Definition at line 30 of file ConnectionIterator.h.
ConnectionIterator::ConnectionIterator | ( | ) |
Default constructor.
Initializes the random number generator engine
Definition at line 16 of file ConnectionIterator.cpp.
References ThreadSpecificRandomEngine::get(), ThreadSpecificRandomEngine::init(), last_conn_idx, last_conn_valid, m_rnd_eng, and theThreadSpecificRandomEngine.
ConnectionIterator::~ConnectionIterator | ( | ) | [virtual] |
virtual void ConnectionIterator::init | ( | const SimObjectPopulation & | src, | |
const SimObjectPopulation & | dst | |||
) | [pure virtual] |
Tell the iterator about the populations to connect.
Implemented in DegreeDistributionConnections, EuclideanDistanceRandomConnections, PredicateBasedConnections, RandomConnections, and RandomFixNumberConnections.
Referenced by SimpleAllToAllWiringMethod::connect(), and DistributedSyncWiringMethod::connect().
virtual void ConnectionIterator::reset | ( | SimObject::ID::SortedVector::const_iterator | src_begin, | |
SimObject::ID::SortedVector::const_iterator | src_end, | |||
SimObject::ID::SortedVector::const_iterator | dst_begin, | |||
SimObject::ID::SortedVector::const_iterator | dst_end | |||
) | [pure virtual] |
Reset/Prepare the iterator to connect src to dst (specified by the begin and end iterators).
Implemented in DegreeDistributionConnections, EuclideanDistanceRandomConnections, PredicateBasedConnections, RandomConnections, and RandomFixNumberConnections.
Referenced by SimpleAllToAllWiringMethod::connect(), and DistributedSyncWiringMethod::connect().
virtual bool ConnectionIterator::next | ( | pair< SimObject::ID, SimObject::ID > & | connection | ) | [pure virtual] |
Move on to the next connection. If true is returned the connection pair is set properly.
Implemented in DegreeDistributionConnections, EuclideanDistanceRandomConnections, PredicateBasedConnections, RandomConnections, and RandomFixNumberConnections.
Referenced by SimpleAllToAllWiringMethod::connect(), and DistributedSyncWiringMethod::connect().
get the indices of the SimObjects in the src- and dst-population, only valid if last next() returned true
Definition at line 31 of file ConnectionIterator.cpp.
References last_conn_idx, and last_conn_valid.
Referenced by SimpleAllToAllWiringMethod::connect(), and DistributedSyncWiringMethod::connect().
virtual size_t ConnectionIterator::estimate | ( | ) | [inline, virtual] |
Return an estimated number of connections which will be generated (if possible).
Reimplemented in DegreeDistributionConnections, RandomConnections, and RandomFixNumberConnections.
Definition at line 59 of file ConnectionIterator.h.
void ConnectionIterator::setRNDEngine | ( | RandomEngine * | engine | ) | [inline] |
Set a particular random number engine.
Definition at line 67 of file ConnectionIterator.h.
References m_rnd_eng.
Referenced by SimpleAllToAllWiringMethod::connect(), and DistributedSyncWiringMethod::connect().
void ConnectionIterator::unsetRNDEngine | ( | void | ) | [inline] |
Set default random number engine.
Definition at line 72 of file ConnectionIterator.h.
References ThreadSpecificRandomEngine::get(), ThreadSpecificRandomEngine::init(), m_rnd_eng, and theThreadSpecificRandomEngine.
RandomEngine* ConnectionIterator::m_rnd_eng [protected] |
The engine currently to use.
Definition at line 75 of file ConnectionIterator.h.
Referenced by ConnectionIterator(), PredicateBasedConnections::init(), RandomConnections::next(), PredicateBasedConnections::next(), EuclideanDistanceRandomConnections::next(), DegreeDistributionConnections::next(), setRNDEngine(), and unsetRNDEngine().
pair<size_t, size_t> ConnectionIterator::last_conn_idx [protected] |
Definition at line 84 of file ConnectionIterator.h.
Referenced by ConnectionIterator(), getIdx(), RandomFixNumberConnections::next(), RandomConnections::next(), PredicateBasedConnections::next(), EuclideanDistanceRandomConnections::next(), and DegreeDistributionConnections::next().
bool ConnectionIterator::last_conn_valid [protected] |
Definition at line 85 of file ConnectionIterator.h.
Referenced by ConnectionIterator(), getIdx(), RandomFixNumberConnections::next(), RandomConnections::next(), PredicateBasedConnections::next(), EuclideanDistanceRandomConnections::next(), and DegreeDistributionConnections::next().