User Manual, Developers Guide and API Documentation

Component.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 <OFDMAPHY/Component.hpp>
00029 #include <OFDMAPHY/Station.hpp>
00030 #include <OFDMAPHY/Manager.hpp>
00031 
00032 using namespace ofdmaphy;
00033 
00034 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00035     Component,
00036     wns::node::component::Interface,
00037     "ofdmaphy.Component",
00038     wns::node::component::ConfigCreator
00039     );
00040 
00041 Component::Component(
00042     wns::node::Interface* node,
00043     const wns::pyconfig::View& pyConfigView) :
00044 
00045     wns::node::component::Component(node, pyConfigView),
00046     logger(pyConfigView.get("logger")),
00047     station(new Station(this, pyConfigView.get("ofdmaStation")))
00048 {
00049     dynamic_cast<SystemManager*>(station->getSystemManager())->addStation(node, station);
00050 }
00051 
00052 void
00053 Component::doStartup()
00054 {
00055     // register station as a PHY DataTransmissionService
00056     this->addService(
00057         this->getConfig().get<std::string>("dataTransmission"),
00058         station);
00059 
00060     this->addService(
00061         this->getConfig().get<std::string>("notification"),
00062         station);
00063 
00064     // new [rs] to support CQI measurements:
00065     this->addService(
00066         this->getConfig().get<std::string>("measurements"),
00067         station);
00068 
00069     MESSAGE_SINGLE(NORMAL, logger, "OFDMA PHY Component created");
00070     MESSAGE_SINGLE(VERBOSE, logger, "registered services: "
00071                    << this->getConfig().get<std::string>("dataTransmission") << ", "
00072                    << this->getConfig().get<std::string>("notification") << ", "
00073                    << this->getConfig().get<std::string>("measurements")
00074         );
00075 }
00076 
00077 
00078 Component::~Component()
00079 {
00080     delete station;
00081 }
00082 
00083 
00084 void
00085 Component::onNodeCreated()
00086 {
00087     // some things we can only do after the mobility Service is present
00088     station->setMobility( getService<rise::scenario::mobility::MobilityInterface*>("mobility"));
00089     station->onNodeCreated();
00090 }
00091 
00092 void
00093 Component::onWorldCreated()
00094 {
00095     dynamic_cast<ofdmaphy::SystemManager*>(station->getSystemManager())->initAntennas(station);
00096 }
00097 
00098 void
00099 Component::onShutdown()
00100 {
00101 }
00102 
00103 wns::node::Interface*
00104 Component::getNode() const
00105 {
00106     return wns::node::component::Component::getNode();
00107 }
00108 
00109 

Generated on Sun May 27 03:31:48 2012 for openWNS by  doxygen 1.5.5