User Manual, Developers Guide and API Documentation

Callback.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-2009
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * email: info@openwns.org
00009  * www: http://www.openwns.org
00010  * _____________________________________________________________________________
00011  *
00012  * openWNS is free software; you can redistribute it and/or modify it under the
00013  * terms of the GNU Lesser General Public License version 2 as published by the
00014  * Free Software Foundation;
00015  *
00016  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00017  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00018  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00019  * details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023  *
00024  ******************************************************************************/
00025 
00026 #include <WIMAC/scheduler/Callback.hpp>
00027 #include <WIMAC/PhyUser.hpp>
00028 #include <WIMAC/PhyUserCommand.hpp>
00029 #include <WNS/probe/bus/ContextProviderCollection.hpp> 
00030 #include <WNS/ldk/Layer.hpp> 
00031 #include <boost/tuple/tuple.hpp>
00032 
00033 
00034 using namespace wimac::scheduler;
00035 
00036 Callback::Callback(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config)
00037 {
00038     colleagues.registry = 0;
00039     friends_.phyUser = fun->findFriend<wimac::PhyUser*>("phyUser");
00040     assureNotNull(friends_.phyUser);
00041 
00042     wns::probe::bus::ContextProviderCollection* cpcParent = 
00043         &fun->getLayer()->getContextProviderCollection();
00044 
00045     wns::probe::bus::ContextProviderCollection cpc(cpcParent);
00046 
00047     frameOffsetDelayProbe_ = wns::probe::bus::ContextCollectorPtr(
00048         new wns::probe::bus::ContextCollector(cpc, config.get<std::string>(
00049             "frameOffsetDelayProbeName")));
00050 
00051     transmissionDelayProbe_ = wns::probe::bus::ContextCollectorPtr(
00052         new wns::probe::bus::ContextCollector(cpc, config.get<std::string>(
00053             "transmissionDelayProbeName")));
00054 
00055     scheduleStartProbe_ = wns::probe::bus::ContextCollectorPtr(
00056         new wns::probe::bus::ContextCollector(cpc, config.get<std::string>(
00057             "scheduleStartProbeName")));
00058 
00059     scheduleStopProbe_ = wns::probe::bus::ContextCollectorPtr(
00060         new wns::probe::bus::ContextCollector(cpc, config.get<std::string>(
00061             "scheduleStopProbeName")));
00062 }
00063 
00064 
00065 void Callback::setColleagues(wns::scheduler::RegistryProxyInterface* registry,
00066     wns::scheduler::harq::HARQInterface* harq)
00067 {
00068     colleagues.registry = registry;
00069     colleagues.harq = harq;
00070 }
00071 
00072 void Callback::probeScheduleStart(int timeSlot, int subChannel, int beam, int userID)
00073 {
00074     scheduleStartProbe_->put(
00075         userID, 
00076         boost::make_tuple("TimeSlot", timeSlot, "SubChannel", subChannel, "Beam", beam));
00077 }
00078 
00079 void Callback::probeScheduleStop(int timeSlot, int subChannel, int beam, int userID)
00080 {
00081     scheduleStopProbe_->put(
00082         userID, 
00083         boost::make_tuple("TimeSlot", timeSlot, "SubChannel", subChannel, "Beam", beam));
00084 }
00085 

Generated on Tue May 22 03:32:10 2012 for openWNS by  doxygen 1.5.5