ConnectionsProjection.cpp

Go to the documentation of this file.
00001 
00011 #include "ConnectionsProjection.h"
00012 
00013 ConnectionsProjection::ConnectionsProjection(shared_ptr<SimObjectPopulation> srcPopulation,
00014                                              shared_ptr<SimObjectPopulation> destPopulation,
00015                                              SimObjectFactory &connector,
00016                                              ConnectionIterator &decider,
00017                                              WiringMethod *wiringMethod,
00018                                              bool collectIDs,
00019                                              bool collectPairs)
00020     : net(&(*srcPopulation).getNet()), collectIDs(collectIDs), collectPairs(collectPairs)
00021 {
00022     if (collectPairs)
00023         connectPairs.reset(new vector< std::pair< SimObject::ID, SimObject::ID > > );
00024     if (wiringMethod == NULL) {
00025         connector_ids = SimpleAllToAllWiringMethod(srcPopulation->getNet()).connect(*srcPopulation, *destPopulation,
00026                                                                                     connector, decider, collectIDs,
00027                                                                                     collectPairs, connectPairs);
00028     }
00029     else
00030         connector_ids = wiringMethod->connect(*srcPopulation, *destPopulation, connector, decider, collectIDs,
00031                                               collectPairs, connectPairs);
00032 }
00033 
00034 ConnectionsProjection::ConnectionsProjection(shared_ptr<SimObjectPopulation> srcPopulation,
00035                                              shared_ptr<SimObjectPopulation> destPopulation,
00036                                              ConnObjectFactory &connector,
00037                                              ConnectionIterator &decider,
00038                                              WiringMethod *wiringMethod,
00039                                              bool collectIDs,
00040                                              bool collectPairs)
00041     : net(&(*srcPopulation).getNet()), collectIDs(collectIDs), collectPairs(collectPairs)
00042 {
00043     if (collectPairs)
00044         connectPairs.reset(new vector< std::pair< SimObject::ID, SimObject::ID > > );
00045     if (wiringMethod == NULL) {
00046         connector_ids = SimpleAllToAllWiringMethod(srcPopulation->getNet()).connect(*srcPopulation, *destPopulation,
00047                                                                                     connector, decider, collectIDs,
00048                                                                                     collectPairs, connectPairs);
00049     }
00050     else
00051         connector_ids = wiringMethod->connect(*srcPopulation, *destPopulation, connector, decider, collectIDs,
00052                                               collectPairs, connectPairs);
00053 }
00054 
00055 
00056 ConnectionsProjection::ConnectionsProjection(const SimObjectPopulation &srcPopulation,
00057                                              const SimObjectPopulation &destPopulation,
00058                                              ConnectionIterator &decider,
00059                                              WiringMethod *wiringMethod,
00060                                              bool collectPairs)
00061     : net(&srcPopulation.getNet()), collectIDs(false)
00062 {
00063     int num_connect;
00064     if (collectPairs) 
00065         connectPairs.reset(new vector< std::pair< SimObject::ID, SimObject::ID > > );
00066     if (wiringMethod == NULL) {
00067         num_connect = SimpleAllToAllWiringMethod(srcPopulation.getNet()).connect(srcPopulation, destPopulation,
00068                                                                                  decider,
00069                                                                                  collectPairs, connectPairs);
00070     }
00071     else
00072         num_connect = wiringMethod->connect(srcPopulation, destPopulation, decider, collectPairs, connectPairs);
00073 
00074     connector_ids->push_back(num_connect);
00075 }
00076 
00077 
00078 ConnectionsProjection::ConnectionsProjection(const SimObjectPopulation &srcPopulation,
00079                                              const SimObjectPopulation &destPopulation,
00080                                              Time &delay,
00081                                              bool collectPairs)
00082     : net(&srcPopulation.getNet()), collectIDs(false), collectPairs(collectPairs)
00083 {
00084     if (collectPairs) 
00085         connectPairs.reset(new vector< std::pair< SimObject::ID, SimObject::ID > > );
00086 
00087     OneToOneWiringMethod(srcPopulation.getNet()).connect(srcPopulation, destPopulation, delay, collectPairs, connectPairs);
00088 }

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5