00001 00011 #ifndef DEGREEDISTRIBUTIONCONNECTIONS_H 00012 #define DEGREEDISTRIBUTIONCONNECTIONS_H 00013 00014 #include <ConnectionIterator.h> 00015 #include "SimpleNonRepeatRandomNG.h" 00016 00018 00021 class DegreeDistributionConnections : public ConnectionIterator { 00022 00023 public: 00025 typedef enum {incoming, outgoing} DegreeType; 00026 00028 00032 DegreeDistributionConnections( RandomDistribution const& distribution, DegreeType degreeType); 00033 00034 virtual ~DegreeDistributionConnections(); 00035 00036 virtual void init(const SimObjectPopulation &source, const SimObjectPopulation &destination); 00037 00038 virtual void reset(SimObject::ID::SortedVector::const_iterator src_begin_it, 00039 SimObject::ID::SortedVector::const_iterator src_end_it, 00040 SimObject::ID::SortedVector::const_iterator dest_begin_it, 00041 SimObject::ID::SortedVector::const_iterator dest_end_it); 00042 00043 virtual bool next( pair<SimObject::ID, SimObject::ID> &connection ); 00044 00045 virtual size_t estimate() { 00046 return 0; 00047 }; 00048 00049 protected: 00050 00051 RandomDistribution *dist; 00052 00053 DegreeType degree_type; 00054 00055 const SimObjectPopulation *src_popul; 00056 const SimObjectPopulation *dest_popul; 00057 00058 unsigned curr_degree; 00059 unsigned curr_made_connections; 00060 00061 SimObject::ID::SortedVector::const_iterator from_begin_it; 00062 00063 unsigned from_seq_size; 00064 00065 SimObject::ID::SortedVector::const_iterator curr_to_it; 00066 SimObject::ID::SortedVector::const_iterator to_end_it; 00067 00068 SimpleNonRepeatRandomNG nonrepeat_rng; 00069 00070 }; 00071 00072 #endif