![]() |
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 <RISE/medium/Medium.hpp> 00029 #include <RISE/RISE.hpp> 00030 #include <RISE/manager/metasystemmanager.hpp> 00031 00032 #include <WNS/logger/Master.hpp> 00033 #include <WNS/pyconfig/View.hpp> 00034 00035 #include <WNS/rng/RNGen.hpp> 00036 #include <WNS/simulator/Simulator.hpp> 00037 00038 #include <WNS/pyconfig/Parser.hpp> 00039 using namespace std; 00040 using namespace rise; 00041 00042 STATIC_FACTORY_REGISTER_WITH_CREATOR(RISE, wns::module::Base, "rise", wns::PyConfigViewCreator); 00043 00044 RISE::RISE(const wns::pyconfig::View& _pyConfigView) : 00045 wns::module::Module<RISE>(_pyConfigView), 00046 mobilityRNG(NULL) 00047 { 00048 } 00049 00050 RISE::~RISE() 00051 { 00052 MetaSystemManager::deleteInstance(); 00053 rise::medium::Medium::deleteInstance(); 00054 } 00055 00056 void RISE::configure() 00057 { 00058 wns::pyconfig::View config(getPyConfigView()); 00059 if(!config.isNone("ownMobilityRNG")) 00060 { 00061 wns::simulator::getMasterLogger()->write("RISE", 00062 "configure()", 00063 "WARNING: You're about to Instantiate an additional RNG for the RISE Mobility!"); 00064 mobilityRNG = new wns::rng::RNGen(); 00065 wns::pyconfig::View rngConfig = config.get("ownMobilityRNG"); 00066 mobilityRNG->seed(rngConfig.get<unsigned long int>("seed")); 00067 } else { 00068 mobilityRNG = wns::simulator::getRNG(); 00069 } 00070 wns::simulator::getRegistry()->insert("MOBILITY-RNG", mobilityRNG); 00071 } 00072 00073 void RISE::startUp() 00074 { 00075 } 00076 00077 void RISE::shutDown() 00078 { 00079 try 00080 { 00081 MetaSystemManager::getInstance()->shutDownSystemManagers(); 00082 } 00083 catch(wns::Exception& anException) 00084 { 00085 anException << "\nThis exception occured during RISE::shutDown ...\n"; 00086 throw; 00087 } 00088 } 00089 00090 wns::rng::RNGen* 00091 RISE::getMobilityRNG() 00092 { 00093 return mobilityRNG; 00094 } 00095 00096 00097
1.5.5