![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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/timing/partitioning/PartitioningInfo.hpp> 00029 #include <WNS/StaticFactory.hpp> 00030 00031 using namespace lte::timing::partitioning; 00032 00033 STATIC_FACTORY_REGISTER_WITH_CREATOR(PartitioningInfo, 00034 wns::ldk::ControlServiceInterface, 00035 "lte.timing.partitioning.PartitioningInfo", 00036 wns::ldk::CSRConfigCreator); 00037 00038 PartitioningInfo::PartitioningInfo(wns::ldk::ControlServiceRegistry* csr, const wns::pyconfig::View& config) : 00039 wns::ldk::ControlService(csr), 00040 scheme(config.get("scheme")), 00041 logger(config.get("logger")) 00042 { 00043 MESSAGE_SINGLE(NORMAL, logger, "Started Resource Partitioning Info Service"); 00044 MESSAGE_BEGIN(VERBOSE, logger, m, "Loaded Resource Partitioning Scheme:\n"); 00045 m << scheme; 00046 MESSAGE_END(); 00047 } 00048 00049 PartitioningInfo::~PartitioningInfo() 00050 {} 00051 00052 lte::timing::partitioning::SubChannelRangeSet 00053 PartitioningInfo::getFreeResources(uint32_t phaseNumber, uint32_t groupNumber) const 00054 { 00055 assure(scheme.hasPartition(phaseNumber),"Requested partitioning info for unknown phase number"); 00056 00057 if (scheme.getPartition(phaseNumber).hasResources(groupNumber)) 00058 { 00059 MESSAGE_BEGIN(VERBOSE, logger, m, "Read Resources from Partitioning Scheme for phase="); 00060 m << phaseNumber << ", group=" << groupNumber << "\n" << scheme.getPartition(phaseNumber); 00061 MESSAGE_END(); 00062 00063 return scheme.getPartition(phaseNumber).getFreeResources(groupNumber); 00064 } 00065 00066 lte::timing::partitioning::SubChannelRangeSet empty; 00067 return empty; 00068 } 00069 00070 wns::scheduler::UsableSubChannelVector 00071 PartitioningInfo::getUsableSubChannels(uint32_t phaseNumber, uint32_t groupNumber) const 00072 { 00073 assure(scheme.hasPartition(phaseNumber),"Requested partitioning info for unknown phase number"); 00074 00075 MESSAGE_BEGIN(NORMAL, logger, m, "getUsableSubChannels(phaseNr="<<phaseNumber<< ", groupNr="<<groupNumber<<"): "); 00076 if (scheme.getPartition(phaseNumber).hasResources(groupNumber)) 00077 { 00078 m << "\n" << scheme.getPartition(phaseNumber); 00079 } else { 00080 m << "empty"; 00081 } 00082 MESSAGE_END(); 00083 return scheme.getPartition(phaseNumber).getUsableSubChannels(groupNumber); 00084 } 00085 00086 std::string 00087 PartitioningInfo::getDedication(uint32_t phaseNumber, uint32_t groupNumber) const 00088 { 00089 assure(scheme.hasPartition(phaseNumber),"Requested dedication info for unknown phase number"); 00090 00091 if (scheme.getPartition(phaseNumber).hasResources(groupNumber)) 00092 { 00093 MESSAGE_BEGIN(VERBOSE, logger, m, "Read Resource Dedication from Partitioning Scheme for phase="); 00094 m << phaseNumber << ", group=" << groupNumber << "\n" << scheme.getPartition(phaseNumber); 00095 MESSAGE_END(); 00096 00097 return scheme.getPartition(phaseNumber).getDedication(groupNumber); 00098 } 00099 00100 return "None"; 00101 } 00102 00103
1.5.5