00001
00011 #ifndef WIRINGMETHOD_H_
00012 #define WIRINGMETHOD_H_
00013
00014 #include "SimNetwork.h"
00015 #include "SimObject.h"
00016 #include "SimObjectPopulation.h"
00017 #include "ConnectionIterator.h"
00018 #include "ConnObjectFactory.h"
00019
00020
00021 class SimNetwork;
00022
00024
00028 class WiringMethod {
00029
00030 public:
00031 typedef shared_ptr< vector< pair<SimObject::ID, SimObject::ID> > > ConnectPairsVector;
00032
00034 WiringMethod(SimNetwork *net)
00035 : net(net) {
00036 };
00037
00039 WiringMethod(SimNetwork &net)
00040 : net(&net) {
00041 };
00042
00044 WiringMethod() {
00045 };
00046
00048
00049 void setNetwork(SimNetwork *net) {
00050 this->net = net;
00051 };
00052
00053 virtual ~WiringMethod() {
00054 };
00055
00057
00065 virtual unsigned connect(const SimObjectPopulation &source,
00066 const SimObjectPopulation &destination,
00067 ConnectionIterator &iterator,
00068 bool collectPairs = false,
00069 ConnectPairsVector connectPairs = ConnectPairsVector( new vector< pair<SimObject::ID, SimObject::ID> > )) = 0;
00070
00071
00073
00083 virtual SimObject::ID::Vector connect(const SimObjectPopulation &source,
00084 const SimObjectPopulation &destination,
00085 const SimObjectFactory &connector,
00086 ConnectionIterator &iterator,
00087 bool collectIDs = false,
00088 bool collectPairs = false,
00089 ConnectPairsVector connectPairs =
00090 ConnectPairsVector(new vector< pair<SimObject::ID,
00091 SimObject::ID> > )) = 0;
00092
00093
00095
00105 virtual SimObject::ID::Vector connect(const SimObjectPopulation &source,
00106 const SimObjectPopulation &destination,
00107 ConnObjectFactory &connector,
00108 ConnectionIterator &iterator,
00109 bool collectIDs = false,
00110 bool collectPairs = false,
00111 ConnectPairsVector connectPairs =
00112 ConnectPairsVector(new vector< pair<SimObject::ID,
00113 SimObject::ID> > )) = 0;
00114
00116
00124 unsigned connect(const vector< SimObject::ID::Packed > &source,
00125 const vector< SimObject::ID::Packed > &destination,
00126 ConnectionIterator &iterator,
00127 bool collectPairs = false,
00128 ConnectPairsVector connectPairs = ConnectPairsVector(new vector< pair<SimObject::ID, SimObject::ID> >))
00129 {
00130 const SimObjectPopulation srcpopul(source);
00131 const SimObjectPopulation destpopul(destination);
00132 return connect(srcpopul, destpopul, iterator, collectPairs, connectPairs);
00133 }
00134
00135
00137
00147 SimObject::ID::Vector connect(const vector< SimObject::ID::Packed > &source,
00148 const vector< SimObject::ID::Packed > &destination,
00149 const SimObjectFactory &connector,
00150 ConnectionIterator &iterator,
00151 bool collectIDs = false,
00152 bool collectPairs = false,
00153 ConnectPairsVector connectPairs = ConnectPairsVector(new vector< pair<SimObject::ID, SimObject::ID> >) )
00154 {
00155 const SimObjectPopulation srcpopul(source);
00156 const SimObjectPopulation destpopul(destination);
00157 return connect(srcpopul, destpopul, connector, iterator, collectIDs, collectPairs, connectPairs);
00158 }
00159
00160
00162
00172 SimObject::ID::Vector connect(const vector< SimObject::ID::Packed > &source,
00173 const vector< SimObject::ID::Packed > &destination,
00174 ConnObjectFactory &connector,
00175 ConnectionIterator &iterator,
00176 bool collectIDs = false,
00177 bool collectPairs = false,
00178 ConnectPairsVector connectPairs = ConnectPairsVector(new vector< pair<SimObject::ID, SimObject::ID> >) )
00179 {
00180 const SimObjectPopulation srcpopul(source);
00181 const SimObjectPopulation destpopul(destination);
00182 return connect(srcpopul, destpopul, connector, iterator, collectIDs, collectPairs, connectPairs);
00183 }
00184
00185 protected:
00186 SimNetwork * net;
00187 };
00188
00189 #endif