User Manual, Developers Guide and API Documentation

MACgBS.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 <DLL/Layer2.hpp>
00029 
00030 #include <LTE/macg/MACgBS.hpp>
00031 
00032 using namespace lte::macg;
00033 using namespace wns::ldk::fun;
00034 using namespace wns::ldk;
00035 
00036 STATIC_FACTORY_REGISTER_WITH_CREATOR(MACgBS,
00037                      FunctionalUnit,
00038                      "lte.macg.BaseStation",
00039                      FUNConfigCreator);
00040 
00041 MACgSchedulerBS::MACgSchedulerBS()
00042 {}
00043 
00044 
00045 bool
00046 MACgSchedulerBS::hasAcceptor(const CompoundPtr& compound)
00047 {
00048     lte::helper::Route route = getRoute(compound);
00049 
00050     MESSAGE_BEGIN(VERBOSE, *logger, m, macg->getFUN()->getName());
00051     m << " hasAcceptor(compound) ->";
00052     if(!route.valid()) {
00053     m << " false";
00054     } else {
00055     m << " mode " << route.modeName
00056       << " target DLL Address" << route.target
00057       << " accepting " << (layers.at(route.mode)->isAccepting(compound) ? "true" : "false");
00058     }
00059     MESSAGE_END();
00060 
00061     return (route.valid() && layers.at(route.mode)->isAccepting(compound));
00062 } // hasAcceptor
00063 
00064 
00065 wns::ldk::IConnectorReceptacle*
00066 MACgSchedulerBS::getAcceptor(const CompoundPtr& compound)
00067 {
00068     lte::macg::MACgCommand* macgCommand = macg->getCommand(compound->getCommandPool()); 
00069     
00070     MESSAGE_BEGIN(NORMAL, *logger, m, macg->getFUN()->getName());
00071     m << " getAcceptor(compound) ->"
00072       << " mode " << macgCommand->local.modeName
00073       << " target DLL Address " << macgCommand->peer.dest
00074       << " accepting " << (layers.at(macgCommand->local.modeID)->isAccepting(compound) ? "true" : "false");
00075     MESSAGE_END();
00076     return layers.at(macgCommand->local.modeID);
00077 } // getAcceptor
00078 
00079 
00080 MACgBS::MACgBS(wns::ldk::fun::FUN * fun, const wns::pyconfig::View& config) :
00081     MACg(fun, config),
00082     HasReceptor<wns::ldk::RoundRobinReceptor>(),
00083     HasConnector<MACgSchedulerBS>(),
00084     HasDeliverer<>(),
00085     Forwarding<MACgBS>(),
00086     wns::Cloneable<MACgBS>()
00087 {
00088     getConnector()->setMACg(this);
00089     // set Logger in MACgScheduler, "lower" is inherited from the "HasConnector" Aspect
00090     getConnector()->setLogger(config.get("logger"));
00091 } // MACgBS
00092 
00093 
00094 void
00095 MACgBS::processOutgoing(const CompoundPtr& compound)
00096 {
00097     MACgCommand* macgCommand = activateCommand(compound->getCommandPool());
00098 
00099     // set source MACg Identification
00100     dll::ILayer2* layer2 = getFUN()->getLayer<dll::ILayer2*>();
00101     
00102     //source
00103     macgCommand->peer.source   = layer2->getDLLAddress();
00104     //mode: the macr with the best value
00105     lte::helper::Route  bestRoute = getConnector()->getRoute(compound);
00106     macgCommand->local.modeID          = bestRoute.mode;
00107     macgCommand->local.modeName        = bestRoute.modeName;
00108     //destination
00109     macgCommand->peer.dest   = bestRoute.target;
00110     fun->getProxy()->commitSizes(compound->getCommandPool(), this);
00111 } // processOutgoing
00112 
00113 
00114 
00115 

Generated on Fri May 25 03:32:05 2012 for openWNS by  doxygen 1.5.5