User Manual, Developers Guide and API Documentation

Partition.hpp

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 #ifndef LTE_TIMING_PARTITIONING_PARTITION
00029 #define LTE_TIMING_PARTITIONING_PARTITION
00030 
00031 #include <WNS/scheduler/SchedulerTypes.hpp>
00032 #include <WNS/IOutputStreamable.hpp>
00033 #include <WNS/pyconfig/View.hpp>
00034 #include <WNS/Interval.hpp>
00035 #include <vector>
00036 #include <map>
00037 
00038 namespace lte { namespace timing { namespace partitioning {
00039 
00040             typedef uint32_t SubChannelNumber;
00041 
00042             typedef wns::Interval<SubChannelNumber> SubChannelRange;
00043             typedef std::vector<SubChannelRange> SubChannelRangeSet;
00044 
00046             inline std::string
00047             printSubChannelRangeSet(const SubChannelRangeSet& subChannelRangeSet)
00048             {
00049                 std::stringstream s;
00050                 for ( SubChannelRangeSet::const_iterator iter = subChannelRangeSet.begin(); iter != subChannelRangeSet.end(); /*nothing*/)
00051                 {
00052                     s << (*iter).min() << "-" << (*iter).max();
00053                     if (++iter != subChannelRangeSet.end()) s << ",";
00054                 }
00055                 return s.str();
00056             } // printSubChannelRangeSet
00057 
00058             class Scheme;
00059 
00060             class Partition :
00061             public wns::IOutputStreamable
00062             {
00064                 typedef std::map<uint32_t, SubChannelRangeSet> GroupContainer;
00065                 typedef std::map<uint32_t, std::string> GroupDedication;
00066                 typedef std::map<uint32_t, wns::scheduler::UsableSubChannelVector> UsableSubChannelsGroupContainer;
00068                 int numberOfSubChannels;
00069                 GroupContainer grouping;
00070                 UsableSubChannelsGroupContainer usableSubChannelsPerGroup;
00071                 GroupDedication dedication;
00072                 wns::logger::Logger logger;
00073             public:
00074                 Partition(const wns::pyconfig::View& config);
00075                 virtual ~Partition();
00076 
00078                 bool
00079                 hasResources(uint32_t groupNumber) const;
00080 
00082                 SubChannelRangeSet
00083                 getFreeResources(uint32_t groupNumber) const;
00084 
00086                 wns::scheduler::UsableSubChannelVector
00087                 getUsableSubChannels(uint32_t groupNumber);
00088 
00090                 std::string
00091                 getDedication(uint32_t groupNumber) const;
00092 
00093             private:
00094                 virtual std::string
00095                 doToString() const;
00096 
00097             };
00098 
00099         }}}
00100 #endif // LTE_TIMING_PARTITIONING_PARTITION
00101 
00102 

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