User Manual, Developers Guide and API Documentation

RRHandlerShortcut.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 <LTE/controlplane/RRHandlerShortcut.hpp>
00029 
00030 STATIC_FACTORY_REGISTER_WITH_CREATOR(lte::controlplane::RRHandlerShortcutUT,
00031                                      wns::ldk::FunctionalUnit,
00032                                      "lte.controlplane.RRHandler.ShortcutUT",
00033                                      wns::ldk::FUNConfigCreator);
00034 
00035 STATIC_FACTORY_REGISTER_WITH_CREATOR(lte::controlplane::RRHandlerShortcutBS,
00036                                      wns::ldk::FunctionalUnit,
00037                                      "lte.controlplane.RRHandler.ShortcutBS",
00038                                      wns::ldk::FUNConfigCreator);
00039 
00040 using namespace lte::controlplane;
00041 
00042 RRHandlerShortcut::RRHandlerShortcut(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& pyco):
00043     wns::ldk::ShortcutFU<wns::service::dll::UnicastAddress, RRHandlerShortcut*>(fun, pyco),
00044     wns::ldk::CommandTypeSpecifier<>(fun),
00045     helper::HasModeName(pyco),
00046     fun_(fun),
00047     layer2_(NULL)
00048 {
00049 }
00050 
00051 RRHandlerShortcut::~RRHandlerShortcut()
00052 {
00053 }
00054 
00055 void
00056 RRHandlerShortcut::onFUNCreated()
00057 {
00058     layer2_ = fun_->getLayer<dll::ILayer2*>();
00059 
00060     if (mode == modeBase) {
00061         friends.macg = fun_->findFriend<lte::macg::MACg*>("macg");
00062     } else {
00063         // taskID is inherited from HasModeName class
00064         friends.macg = fun_->findFriend<lte::macg::MACg*>("macg"+separator+taskID);
00065     }
00066     wns::ldk::ShortcutFU<wns::service::dll::UnicastAddress, RRHandlerShortcut*>::onFUNCreated();
00067 }
00068 
00069 RRHandlerShortcutUT::RRHandlerShortcutUT(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& pyco):
00070     RRHandlerShortcut(fun, pyco)
00071 {
00072 }
00073 
00074 RRHandlerShortcutUT::~RRHandlerShortcutUT()
00075 {
00076 }
00077 
00078 bool
00079 RRHandlerShortcutUT::isReceiver()
00080 {
00081     return false;
00082 }
00083 
00084 wns::service::dll::UnicastAddress
00085 RRHandlerShortcutUT::getSourceAddress()
00086 {
00087     assure(layer2_, "No layer2 instance was set");
00088     return layer2_->getDLLAddress();
00089 }
00090 
00091 wns::service::dll::UnicastAddress
00092 RRHandlerShortcutUT::getDestinationAddress(const wns::ldk::CompoundPtr& compound)
00093 {
00094     lte::macg::MACgCommand* macgCommand = friends.macg->getCommand(compound->getCommandPool());
00095 
00096     return macgCommand->peer.dest;
00097 }
00098 
00099 bool
00100 RRHandlerShortcutUT::isBroadcast(const wns::ldk::CompoundPtr&)
00101 {
00102     return false;
00103 }
00104 
00105 RRHandlerShortcutBS::RRHandlerShortcutBS(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& pyco):
00106     RRHandlerShortcut(fun, pyco)
00107 {
00108 }
00109 
00110 RRHandlerShortcutBS::~RRHandlerShortcutBS()
00111 {
00112 }
00113 
00114 bool
00115 RRHandlerShortcutBS::isReceiver()
00116 {
00117     return true;
00118 }
00119 
00120 wns::service::dll::UnicastAddress
00121 RRHandlerShortcutBS::getSourceAddress()
00122 {
00123     assure(layer2_, "No layer2 instance was set");
00124     return layer2_->getDLLAddress();
00125 }
00126 
00127 wns::service::dll::UnicastAddress
00128 RRHandlerShortcutBS::getDestinationAddress(const wns::ldk::CompoundPtr& compound)
00129 {
00130     lte::macg::MACgCommand* macgCommand = friends.macg->getCommand(compound->getCommandPool());
00131 
00132     return macgCommand->peer.dest;
00133 }
00134 
00135 bool
00136 RRHandlerShortcutBS::isBroadcast(const wns::ldk::CompoundPtr&)
00137 {
00138     return false;
00139 }

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