00001 // $Id: Module.cc 1762 2011-01-13 12:20:09Z tho $ 00002 // 00003 // Copyright (C) 2007 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00026 #include "Module.hh" 00027 #include "Module.ih" 00028 00029 // Custom includes 00030 00031 //#include "Module.mpp" 00032 #define prefix_ 00033 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00034 00035 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00036 // senf::ppi::module::Module 00037 00038 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00039 // private members 00040 00041 prefix_ void senf::ppi::module::Module::registerConnector(connector::Connector & connector) 00042 { 00043 if (std::find(connectorRegistry_.begin(), connectorRegistry_.end(), &connector) 00044 == connectorRegistry_.end()) { 00045 connectorRegistry_.push_back(&connector); 00046 connector.setModule(*this); 00047 } 00048 } 00049 00050 prefix_ void senf::ppi::module::Module::unregisterConnector(connector::Connector & connector) 00051 { 00052 ConnectorRegistry::iterator i (std::find(connectorRegistry_.begin(), connectorRegistry_.end(), 00053 &connector)); 00054 if (i != connectorRegistry_.end()) 00055 connectorRegistry_.erase(i); 00056 00057 routes_.erase_if(boost::bind(&RouteBase::hasConnector, _1, boost::cref(connector))); 00058 } 00059 00060 prefix_ senf::ppi::RouteBase & 00061 senf::ppi::module::Module::addRoute(std::auto_ptr<RouteBase> route) 00062 { 00063 routes_.push_back(route.release()); 00064 return routes_.back(); 00065 } 00066 00067 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00068 // protected members 00069 00070 prefix_ void senf::ppi::module::Module::noroute(connector::Connector & connector) 00071 { 00072 registerConnector(connector); 00073 connector.setModule(*this); 00074 } 00075 00076 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00077 #undef prefix_ 00078 //#include "Module.mpp" 00079 00080 00081 // Local Variables: 00082 // mode: c++ 00083 // fill-column: 100 00084 // comment-column: 40 00085 // c-file-style: "senf" 00086 // indent-tabs-mode: nil 00087 // ispell-local-dictionary: "american" 00088 // compile-command: "scons -u test" 00089 // End: