User Manual, Developers Guide and API Documentation

FlowSeparator.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #include <WNS/ldk/FlowSeparator.hpp>
00029 #include <WNS/ldk/Layer.hpp>
00030 
00031 #include <WNS/StaticFactory.hpp>
00032 #include <WNS/module/Base.hpp>
00033 
00034 using namespace wns::ldk;
00035 using namespace wns::ldk::flowseparator;
00036 
00037 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00038     FlowSeparator,
00039     FunctionalUnit,
00040     "wns.FlowSeparator",
00041     FUNConfigCreator
00042     );
00043 
00044 FlowSeparator::ConnectorReceptacleSeparator::ConnectorReceptacleSeparator(FlowSeparator* fs, std::string portname)
00045     : ReceptacleManagement<IConnectorReceptacle>(fs),
00046       portname_(portname)
00047 {}
00048 
00049 FlowSeparator::ConnectorReceptacleSeparator::~ConnectorReceptacleSeparator()
00050 {}
00051 
00052 void
00053 FlowSeparator::ConnectorReceptacleSeparator::sendData(const CompoundPtr& compound)
00054 {
00055     getFU()->getFUN()->getLinkHandler()->sendData(this, compound);
00056 }
00057 
00058 void
00059 FlowSeparator::ConnectorReceptacleSeparator::doSendData(const CompoundPtr& compound)
00060 {
00061     IConnectorReceptacle* receptacle = tryGetInstanceAndInsertPermanent(compound, Direction::OUTGOING());
00062     receptacle->sendData(compound);
00063 }
00064 
00065 bool
00066 FlowSeparator::ConnectorReceptacleSeparator::isAccepting(const CompoundPtr& compound)
00067 {
00068     return getFU()->getFUN()->getLinkHandler()->isAccepting(this, compound);
00069 }
00070 
00071 bool
00072 FlowSeparator::ConnectorReceptacleSeparator::doIsAccepting(const CompoundPtr& compound) const
00073 {
00074     try
00075     {
00076         IConnectorReceptacle* candidate = _getInstance(compound, Direction::OUTGOING());
00077         // either no one may be busy, or the instance in question
00078 
00079     ConstKeyPtr key = (*(fs_->keyBuilder))(compound, Direction::OUTGOING());
00080     FunctionalUnit* candidateFU = fs_->instances[key];
00081 
00082     if (fs_->instanceBusy == NULL || fs_->instanceBusy == candidateFU)
00083         {
00084             return candidate->isAccepting(compound);
00085         }
00086         else
00087         {
00088             return false;
00089         }
00090     }
00091     catch(const InstanceNotFound& ifn)
00092     {
00093         MESSAGE_SINGLE(
00094             VERBOSE,
00095             fs_->logger,
00096             fs_->getFUN()->getName()<<": " <<
00097             "creating new instance for key (" <<
00098             ifn.key->str() <<
00099             ") temporarily.");
00100         FunctionalUnit* candidate = fs_->notFound->ifNotFound(ifn.key);
00101         fs_->connectFU(candidate);
00102         bool accepting = candidate->getFromConnectorReceptacleRegistry(portname_)->isAccepting(compound);
00103         delete candidate;
00104         return accepting;
00105     }
00106     // throw on
00107     catch(...)
00108     {
00109         throw;
00110     }
00111 }
00112 
00113 FunctionalUnit*
00114 FlowSeparator::ConnectorReceptacleSeparator::getFU()
00115 {
00116     return fs_;
00117 }
00118 
00119 
00120 FlowSeparator::DelivererReceptacleSeparator::DelivererReceptacleSeparator(FlowSeparator* fs)
00121     : ReceptacleManagement<IDelivererReceptacle>(fs)
00122 {}
00123 
00124 FlowSeparator::DelivererReceptacleSeparator::~DelivererReceptacleSeparator()
00125 {}
00126 
00127 void
00128 FlowSeparator::DelivererReceptacleSeparator::onData(const CompoundPtr& compound)
00129 {
00130     fs_->getFUN()->getLinkHandler()->onData(this, compound);
00131 }
00132 
00133 void
00134 FlowSeparator::DelivererReceptacleSeparator::doOnData(const CompoundPtr& compound)
00135 {
00136     IDelivererReceptacle* receptacle = tryGetInstanceAndInsertPermanent(compound, Direction::INCOMING());
00137 
00138     // Mark this as the "Busy" instance. 
00139     ConstKeyPtr key = (*(fs_->keyBuilder))(compound, Direction::INCOMING());
00140     fs_->instanceBusy = fs_->instances[key];
00141     receptacle->onData(compound);
00142     fs_->instanceBusy = NULL;
00143 }
00144 
00145 FunctionalUnit*
00146 FlowSeparator::DelivererReceptacleSeparator::getFU()
00147 {
00148     return fs_;
00149 }
00150 
00151 
00152 FlowSeparator::ReceptorReceptacleSeparator::ReceptorReceptacleSeparator(FlowSeparator* fs)
00153   : ReceptacleManagement<IReceptorReceptacle>(fs)
00154 {}
00155 
00156 FlowSeparator::ReceptorReceptacleSeparator::~ReceptorReceptacleSeparator()
00157 {}
00158 
00159 void
00160 FlowSeparator::ReceptorReceptacleSeparator::wakeup()
00161 {
00162     fs_->getFUN()->getLinkHandler()->wakeup(this);
00163 }
00164 
00165 void
00166 FlowSeparator::ReceptorReceptacleSeparator::doWakeup()
00167 {
00168     ReceptacleContainer::iterator begin = receptacleContainer_.begin();
00169     ReceptacleContainer::iterator somewhere = receptacleContainer_.begin();
00170     ReceptacleContainer::iterator end = receptacleContainer_.end();
00171 
00172     // set jump-in point somewhere
00173     size_t offset = size_t(fs_->dis() * receptacleContainer_.size());
00174     for( size_t i = 0; i < offset; i++)
00175         somewhere++;
00176 
00177     // and walk from somewhere to the end
00178     for(ReceptacleContainer::iterator i = somewhere;
00179         i != end; ++i)
00180     {
00181         fs_->instanceBusy = fs_->instances[(*i).first];
00182         (*i).second->wakeup();
00183         fs_->instanceBusy = NULL;
00184     }
00185 
00186     // walk from the beginning to the jump-in point somewhere
00187     for(ReceptacleContainer::iterator i = begin;
00188         i != somewhere; ++i)
00189     {
00190         fs_->instanceBusy = fs_->instances[(*i).first];
00191         (*i).second->wakeup();
00192         fs_->instanceBusy = NULL;
00193     }
00194 }
00195 
00196 FunctionalUnit*
00197 FlowSeparator::ReceptorReceptacleSeparator::getFU()
00198 {
00199     return fs_;
00200 }
00201 
00202 
00203 FlowSeparator::FlowSeparator(
00204     fun::FUN* fuNet,
00205     const pyconfig::View& _config,
00206     std::auto_ptr<KeyBuilder> _keyBuilder,
00207     std::auto_ptr<flowseparator::NotFoundStrategy> _notFound) :
00208 
00209     CommandTypeSpecifier<>(fuNet),
00210     HasReceptor<>(),
00211     HasConnector<>(),
00212     HasDeliverer<>(),
00213     NotCloneable(),
00214     instances(),
00215     crsList_(),
00216     drsList_(),
00217     rrsList_(),
00218     prototypeFU_(NULL),
00219     connectorReceptacleSinglePort_(NULL),
00220     delivererReceptacleSinglePort_(NULL),
00221     receptorReceptacleSinglePort_(NULL),
00222     instanceBusy(NULL),
00223     config(_config),
00224     keyBuilder(_keyBuilder),
00225     notFound(_notFound),
00226     dis(),
00227     logger(_config.getView("logger"))
00228 {
00229     init();
00230 } // FlowSeparator
00231 
00232 
00233 FlowSeparator::FlowSeparator(
00234     fun::FUN* fuNet,
00235     const pyconfig::View& _config) :
00236 
00237     CommandTypeSpecifier<>(fuNet),
00238     HasReceptor<>(),
00239     HasConnector<>(),
00240     HasDeliverer<>(),
00241     NotCloneable(),
00242     instances(),
00243     crsList_(),
00244     drsList_(),
00245     rrsList_(),
00246     prototypeFU_(NULL),
00247     connectorReceptacleSinglePort_(NULL),
00248     delivererReceptacleSinglePort_(NULL),
00249     receptorReceptacleSinglePort_(NULL),
00250     instanceBusy(NULL),
00251     config(_config),
00252     keyBuilder(),
00253     notFound(),
00254     dis(),
00255     logger(_config.get("logger"))
00256 {
00257     pyconfig::View notFoundConfig(config, "notFound");
00258     std::string notFoundName = notFoundConfig.get<std::string>("__plugin__");
00259     this->notFound = std::auto_ptr<flowseparator::NotFoundStrategy>(
00260         flowseparator::NotFoundStrategyFactory::creator(notFoundName)->create(fuNet, notFoundConfig));
00261 
00262     pyconfig::View keyBuilderConfig(config, "keyBuilder");
00263     std::string keyBuilderName = keyBuilderConfig.get<std::string>("__plugin__");
00264     this->keyBuilder = std::auto_ptr<KeyBuilder>(
00265         KeyBuilderFactory::creator(keyBuilderName)->create(fuNet, keyBuilderConfig));
00266 
00267     init();
00268 } // FlowSeparator
00269 
00270 
00271 
00272 FlowSeparator::FlowSeparator(const FlowSeparator& other)
00273     : wns::ldk::CommandTypeSpecifier<EmptyCommand>(other.getFUN()),
00274       config(other.config)
00275 {
00276     std::cout << "Copy constructor called!" << std::endl;
00277 }
00278 
00279 void
00280 FlowSeparator::init()
00281 {
00282     // create prototype FU
00283     prototypeFU_ = this->notFound->createPrototype();
00284 
00285     StringList connectors = prototypeFU_->getKeysFromConnectorRegistry();
00286     StringList::iterator connectorsIter;
00287     for (connectorsIter = connectors.begin();
00288          connectorsIter != connectors.end();
00289          connectorsIter++)
00290     {
00291         if (*connectorsIter == "SinglePort")
00292         {
00293             getFromConnectorRegistry("SinglePort")->set(
00294                 prototypeFU_->getFromConnectorRegistry("SinglePort")->get());
00295         }
00296         else
00297         {
00298             addToConnectorRegistry(*connectorsIter,
00299                                    prototypeFU_->getFromConnectorRegistry(*connectorsIter));
00300         }
00301     }
00302 
00303     StringList receptors = prototypeFU_->getKeysFromReceptorRegistry();
00304     StringList::iterator receptorsIter;
00305     for (receptorsIter = receptors.begin();
00306          receptorsIter != receptors.end();
00307          receptorsIter++)
00308     {
00309         if (*receptorsIter == "SinglePort")
00310         {
00311             getFromReceptorRegistry("SinglePort")->set(
00312                 prototypeFU_->getFromReceptorRegistry("SinglePort")->get());
00313         }
00314         else
00315         {
00316             addToReceptorRegistry(*receptorsIter,
00317                                   prototypeFU_->getFromReceptorRegistry(*receptorsIter));
00318         }
00319     }
00320 
00321     StringList deliverers = prototypeFU_->getKeysFromDelivererRegistry();
00322     StringList::iterator deliverersIter;
00323     for (deliverersIter = deliverers.begin();
00324          deliverersIter != deliverers.end();
00325          deliverersIter++)
00326     {
00327         if (*deliverersIter == "SinglePort")
00328         {
00329             getFromDelivererRegistry("SinglePort")->set(
00330                 prototypeFU_->getFromDelivererRegistry("SinglePort")->get());
00331         }
00332         else
00333         {
00334             addToDelivererRegistry(*deliverersIter,
00335                                    prototypeFU_->getFromDelivererRegistry(*deliverersIter));
00336         }
00337     }
00338 
00339     ConnectorReceptacleSeparator* crs;
00340     StringList connectorReceptacles = prototypeFU_->getKeysFromConnectorReceptacleRegistry();
00341     StringList::iterator connectorReceptaclesIter;
00342     for (connectorReceptaclesIter = connectorReceptacles.begin();
00343          connectorReceptaclesIter != connectorReceptacles.end();
00344          connectorReceptaclesIter++)
00345     {
00346         if (*connectorReceptaclesIter == "SinglePort")
00347         {
00348             crs = new ConnectorReceptacleSeparator(this, "SinglePort");
00349             updateConnectorReceptacleRegistry("SinglePort",
00350                                               crs);
00351             crsList_.push_back(crs);
00352         }
00353         else
00354         {
00355             crs = new ConnectorReceptacleSeparator(this, *connectorReceptaclesIter);
00356             addToConnectorReceptacleRegistry(*connectorReceptaclesIter,
00357                                              crs);
00358             crsList_.push_back(crs);
00359         }
00360     }
00361 
00362     if (crsList_.size() == 1)
00363     {
00364         connectorReceptacleSinglePort_ = crs;
00365     }
00366 
00367     DelivererReceptacleSeparator* drs;
00368     StringList delivererReceptacles = prototypeFU_->getKeysFromDelivererReceptacleRegistry();
00369     StringList::iterator delivererReceptaclesIter;
00370     for (delivererReceptaclesIter = delivererReceptacles.begin();
00371          delivererReceptaclesIter != delivererReceptacles.end();
00372          delivererReceptaclesIter++)
00373     {
00374         drs = new DelivererReceptacleSeparator(this);
00375         if (*delivererReceptaclesIter == "SinglePort")
00376         {
00377             updateDelivererReceptacleRegistry("SinglePort",
00378                                               drs);
00379         }
00380         else
00381         {
00382             addToDelivererReceptacleRegistry(*delivererReceptaclesIter,
00383                                              drs);
00384         }
00385         drsList_.push_back(drs);
00386     }
00387 
00388     if (drsList_.size() == 1)
00389     {
00390         delivererReceptacleSinglePort_ = drs;
00391     }
00392 
00393     ReceptorReceptacleSeparator *rrs;
00394     StringList receptorReceptacles = prototypeFU_->getKeysFromReceptorReceptacleRegistry();
00395     StringList::iterator receptorReceptaclesIter;
00396     for (receptorReceptaclesIter = receptorReceptacles.begin();
00397          receptorReceptaclesIter != receptorReceptacles.end();
00398          receptorReceptaclesIter++)
00399     {
00400         rrs = new ReceptorReceptacleSeparator(this);
00401         if (*receptorReceptaclesIter == "SinglePort")
00402         {
00403             updateReceptorReceptacleRegistry("SinglePort",
00404                                              rrs);
00405         }
00406         else
00407         {
00408             addToReceptorReceptacleRegistry(*receptorReceptaclesIter,
00409                                             rrs);
00410         }
00411         rrsList_.push_back(rrs);
00412     }
00413 
00414     if (rrsList_.size() == 1)
00415     {
00416         receptorReceptacleSinglePort_ = rrs;
00417     }
00418 }
00419 
00420 
00421 FlowSeparator::~FlowSeparator()
00422 {
00423     assure(instanceBusy == NULL, "One FU in FlowSeparator is still busy. Can't delete FlowSeparator!");
00424 
00425     while(instances.empty() == false)
00426     {
00427         delete instances.begin()->second;
00428         instances.erase(instances.begin());
00429     }
00430 
00431     notFound.reset();
00432     keyBuilder.reset();
00433 
00434     while (crsList_.empty() == false)
00435     {
00436         delete *(crsList_.begin());
00437         crsList_.erase(crsList_.begin());
00438     }
00439     while (drsList_.empty() == false)
00440     {
00441         delete *(drsList_.begin());
00442         drsList_.erase(drsList_.begin());
00443     }
00444     while (rrsList_.empty() == false)
00445     {
00446         delete *(rrsList_.begin());
00447         rrsList_.erase(rrsList_.begin());
00448     }
00449 
00450     delete prototypeFU_;
00451 } // ~FlowSeparator
00452 
00453 
00454 void
00455 FlowSeparator::onFUNCreated()
00456 {
00457     /*
00458      * The prototype is registered at the FUN itself, so its onFUNCreated method
00459      * gets called by the FUN directly.
00460      * <br>
00461      * The keyBuilder itself may need to make friends, since the keys will usually
00462      * need the content of some Commands at instantiation time.
00463      * Resolving these dependencies at keyBuilder startup time instead during Key
00464      * instantiation pushes run-time complexity to configuration time.
00465      */
00466     keyBuilder->onFUNCreated();
00467     notFound->onFUNCreated();
00468 } // onFUNCreated
00469 
00470 
00471 void
00472 FlowSeparator::doSendData(const CompoundPtr& compound)
00473 {
00474     assureNotNull(connectorReceptacleSinglePort_);
00475     connectorReceptacleSinglePort_->sendData(compound);
00476 } // doSendData
00477 
00478 
00479 void
00480 FlowSeparator::doOnData(const CompoundPtr& compound)
00481 {
00482     assureNotNull(delivererReceptacleSinglePort_);
00483     delivererReceptacleSinglePort_->onData(compound);
00484 } // doOnData
00485 
00486 
00487 std::size_t
00488 FlowSeparator::size() const
00489 {
00490     return instances.size();
00491 } // size
00492 
00493 
00494 FunctionalUnit*
00495 FlowSeparator::getInstance(const ConstKeyPtr& key) const
00496 {
00497     InstanceMap::const_iterator it = instances.find(key);
00498     if(it == instances.end())
00499     {
00500         return NULL;
00501     }
00502 
00503     return it->second;
00504 } // getInstance
00505 
00506 FunctionalUnit*
00507 FlowSeparator::getInstance(const CompoundPtr& compound, int direction) const
00508 {
00509     return(this->getInstance(this->getKey(compound, direction)));
00510 } // getInstance
00511 
00512 ConstKeyPtr
00513 FlowSeparator::getKey(const CompoundPtr& compound, int direction) const
00514 {
00515     ConstKeyPtr key = (*keyBuilder)(compound, direction);
00516     return key;
00517 }
00518 
00519 
00520 void
00521 FlowSeparator::addInstance(const ConstKeyPtr& key)
00522 {
00523     FunctionalUnit* functionalUnit = notFound->ifNotFound(key);
00524     addInstance(key, functionalUnit);
00525 }
00526 
00527 void
00528 FlowSeparator::addInstance(const ConstKeyPtr& key, FunctionalUnit* functionalUnit)
00529 {
00530     assure(NULL == getInstance(key),
00531            "trying to add an instance for an already known key.");
00532 
00533     MESSAGE_BEGIN(NORMAL, logger, m, this->getFUN()->getName());
00534     m <<": add Instance/Flow      Key: "<< key->str()
00535       << ";       FU: " << functionalUnit->getName();
00536     MESSAGE_END();
00537 
00538     this->integrate(key, functionalUnit);
00539 } // addInstance
00540 
00541 
00542 void
00543 FlowSeparator::removeInstance(const ConstKeyPtr& key)
00544 {
00545     assure(NULL != getInstance(key),
00546            "trying to remove an instance using an unknown key.");
00547 
00548     MESSAGE_BEGIN(NORMAL, logger, m, this->getFUN()->getName());
00549     m <<": remove Instance/Flow      Key: " << key->str()
00550       << ";       FU: " << getInstance(key)->getName();
00551     MESSAGE_END();
00552 
00553     this->disintegrate(key);
00554 } // removeInstance
00555 
00556 
00557 bool
00558 FlowSeparator::doIsAccepting(const CompoundPtr& compound) const
00559 {
00560     assureNotNull(connectorReceptacleSinglePort_);
00561     connectorReceptacleSinglePort_->isAccepting(compound);
00562 } // doIsAccepting
00563 
00564 
00565 void
00566 FlowSeparator::doWakeup()
00567 {
00568     assureNotNull(receptorReceptacleSinglePort_);
00569     receptorReceptacleSinglePort_->wakeup();
00570 } // doWakeup
00571 
00572 
00573 void
00574 FlowSeparator::connectFU(FunctionalUnit* functionalUnit) const
00575 {
00580     StringList connectors = getKeysFromConnectorRegistry();
00581     StringList::iterator connectorsIter;
00582     for (connectorsIter = connectors.begin();
00583          connectorsIter != connectors.end();
00584          connectorsIter++)
00585     {
00586         functionalUnit->getFromConnectorRegistry(*connectorsIter)->set(
00587             getFromConnectorRegistry(*connectorsIter)->get());
00588     }
00589     StringList receptors = getKeysFromReceptorRegistry();
00590     StringList::iterator receptorsIter;
00591     for (receptorsIter = receptors.begin();
00592          receptorsIter != receptors.end();
00593          receptorsIter++)
00594     {
00595         functionalUnit->getFromReceptorRegistry(*receptorsIter)->set(
00596             getFromReceptorRegistry(*receptorsIter)->get());
00597     }
00598     StringList deliverers = getKeysFromDelivererRegistry();
00599     StringList::iterator deliverersIter;
00600     for (deliverersIter = deliverers.begin();
00601          deliverersIter != deliverers.end();
00602          deliverersIter++)
00603     {
00604         functionalUnit->getFromDelivererRegistry(*deliverersIter)->set(
00605             getFromDelivererRegistry(*deliverersIter)->get());
00606     }
00607 }
00608 
00609 
00610 void
00611 FlowSeparator::integrate(const ConstKeyPtr& key, FunctionalUnit* functionalUnit)
00612 {
00613     connectFU(functionalUnit);
00614 
00615     StringList connectorReceptacles = prototypeFU_->getKeysFromConnectorReceptacleRegistry();
00616     StringList::iterator connectorReceptaclesIter;
00617     for (connectorReceptaclesIter = connectorReceptacles.begin();
00618          connectorReceptaclesIter != connectorReceptacles.end();
00619          connectorReceptaclesIter++)
00620     {
00621         (static_cast<ConnectorReceptacleSeparator*>(getFromConnectorReceptacleRegistry(*connectorReceptaclesIter)))
00622             ->addInstance(key, functionalUnit->getFromConnectorReceptacleRegistry(*connectorReceptaclesIter));
00623     }
00624 
00625     StringList delivererReceptacles = prototypeFU_->getKeysFromDelivererReceptacleRegistry();
00626     StringList::iterator delivererReceptaclesIter;
00627     for (delivererReceptaclesIter = delivererReceptacles.begin();
00628          delivererReceptaclesIter != delivererReceptacles.end();
00629          delivererReceptaclesIter++)
00630     {
00631         (static_cast<DelivererReceptacleSeparator*>(getFromDelivererReceptacleRegistry(*delivererReceptaclesIter)))
00632             ->addInstance(key, functionalUnit->getFromDelivererReceptacleRegistry(*delivererReceptaclesIter));
00633     }
00634 
00635     StringList receptorReceptacles = prototypeFU_->getKeysFromReceptorReceptacleRegistry();
00636     StringList::iterator receptorReceptaclesIter;
00637     for (receptorReceptaclesIter = receptorReceptacles.begin();
00638          receptorReceptaclesIter != receptorReceptacles.end();
00639          receptorReceptaclesIter++)
00640     {
00641         (static_cast<ReceptorReceptacleSeparator*>(getFromReceptorReceptacleRegistry(*receptorReceptaclesIter)))
00642             ->addInstance(key, functionalUnit->getFromReceptorReceptacleRegistry(*receptorReceptaclesIter));
00643     }
00644 
00645     instances[key] = functionalUnit;
00646 } // instance.integrate
00647 
00648 
00649 void
00650 FlowSeparator::disintegrate(const ConstKeyPtr& key)
00651 {
00652     InstanceMap::iterator it = instances.find(key);
00653     assure(it != instances.end(),
00654            "trying to disintegrate FU for an unknown key.");
00655 
00656     assure( instanceBusy != it->second,
00657             "FlowSeparator::disintegrate: Can't disintegrate busy Instance/Flow!");
00658 
00659     StringList connectorReceptacles = prototypeFU_->getKeysFromConnectorReceptacleRegistry();
00660     StringList::iterator connectorReceptaclesIter;
00661     for (connectorReceptaclesIter = connectorReceptacles.begin();
00662          connectorReceptaclesIter != connectorReceptacles.end();
00663          connectorReceptaclesIter++)
00664     {
00665         (static_cast<ConnectorReceptacleSeparator*>(getFromConnectorReceptacleRegistry(*connectorReceptaclesIter)))
00666             ->removeInstance(key);
00667     }
00668 
00669     StringList delivererReceptacles = prototypeFU_->getKeysFromDelivererReceptacleRegistry();
00670     StringList::iterator delivererReceptaclesIter;
00671     for (delivererReceptaclesIter = delivererReceptacles.begin();
00672          delivererReceptaclesIter != delivererReceptacles.end();
00673          delivererReceptaclesIter++)
00674     {
00675         (static_cast<DelivererReceptacleSeparator*>(getFromDelivererReceptacleRegistry(*delivererReceptaclesIter)))
00676             ->removeInstance(key);
00677     }
00678 
00679     StringList receptorReceptacles = prototypeFU_->getKeysFromReceptorReceptacleRegistry();
00680     StringList::iterator receptorReceptaclesIter;
00681     for (receptorReceptaclesIter = receptorReceptacles.begin();
00682          receptorReceptaclesIter != receptorReceptacles.end();
00683          receptorReceptaclesIter++)
00684     {
00685         (static_cast<ReceptorReceptacleSeparator*>(getFromReceptorReceptacleRegistry(*receptorReceptaclesIter)))
00686             ->removeInstance(key);
00687     }
00688 
00689     delete it->second;
00690     instances.erase(it);
00691 } // instance.disintegrate
00692 
00693 

Generated on Thu May 24 03:31:39 2012 for openWNS by  doxygen 1.5.5