User Manual, Developers Guide and API Documentation

MapInfoEntry.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  * 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 <WNS/scheduler/MapInfoEntry.hpp>
00029 #include <WNS/node/Interface.hpp>
00030 #include <iostream>
00031 
00032 using namespace wns::scheduler;
00033 
00034 MapInfoEntry::MapInfoEntry() :
00035     start(0.0),
00036     end(0.0),
00037     user(NULL),
00038     sourceUser(NULL),
00039     frameNr(-1),
00040     subBand(-1),
00041     timeSlot(0),
00042     spatialLayer(0),
00043     txPower(),
00044     phyModePtr(),
00045     estimatedCQI(),
00046     compounds()
00047 {
00048 }
00049 
00050 MapInfoEntry::~MapInfoEntry()
00051 {
00052     compounds.clear();
00053 }
00054 
00055 std::string
00056 MapInfoEntry::toString() const
00057 {
00058     std::stringstream s;
00059     s.setf(std::ios::fixed,std::ios::floatfield);   // floatfield set to fixed
00060     s.precision(1);
00061     s << "\n\t frameNr:      " << frameNr
00062       << "\n\t subBand:      " << subBand
00063       << "\n\t timeSlot:     " << timeSlot
00064       << "\n\t spatialLayer: " << spatialLayer
00065       << "\n\t timespan:     [" << start*1e6 << "-" << end*1e6 << "]us";
00066     s << "\n\t duration:     " << (end-start)*1e6 << "us";
00067     if (phyModePtr!=wns::service::phy::phymode::PhyModeInterfacePtr()
00068         && (phyModePtr->dataRateIsValid())) {
00069         double dataRate = phyModePtr->getDataRate();
00070         int bits = dataRate*(end-start);
00071         s << " => space for "<<bits<<" bits";
00072     }
00073     if (phyModePtr!=wns::service::phy::phymode::PhyModeInterfacePtr()) {
00074         s << "\n\t phyMode:      " << *phyModePtr;
00075     } else {
00076         s << "\n\t phyMode:      undefined";
00077     }
00078     s << "\n\t userID:       " << user.getName();
00079     s << "\n\t userID:       " << sourceUser.getName();
00080     if (txPower!=wns::Power()) {
00081         s << "\n\t txPower:      " << txPower;
00082     } else {
00083         s << "\n\t txPower:      undefined";
00084     }
00085     s << "\n\t est. C:    " << estimatedCQI.carrier;
00086     s << "\n\t est. I:    " << estimatedCQI.interference;
00087     s << "\n\t est. PL:    " << estimatedCQI.pathloss;
00088 
00089     s << "\n\t #compounds:   " << compounds.size();
00090     if ( !compounds.empty() ) {
00091         int c=1;
00092         for ( std::list<wns::ldk::CompoundPtr>::const_iterator iterCompound = compounds.begin();
00093               iterCompound != compounds.end(); ++iterCompound){
00094             s << "\n\t #" << c++ << ": ";
00095             if ((*iterCompound) != wns::ldk::CompoundPtr()) {
00096                 s << (*iterCompound)->getLengthInBits() << " bits";
00097             } else {
00098                 s << "NULL-compound";
00099             }
00100         }
00101     }
00102     s << "\n";
00103     return s.str();
00104 } // toString()
00105 
00106 std::string
00107 MapInfoEntry::doToString() const
00108 {
00109     return toString();
00110 }
00111 
00112 void
00113 MapInfoCollection::join(const MapInfoCollection& otherList)
00114 {
00115     for(MapInfoCollectionList::const_iterator iter = otherList.begin();
00116         iter != otherList.end(); ++iter)
00117     {
00118         push_back(*iter);
00119     }
00120 }

Generated on Fri May 25 03:31:53 2012 for openWNS by  doxygen 1.5.5