![]() |
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 #ifndef __METASYSTEMMANAGER_HPP 00029 #define __METASYSTEMMANAGER_HPP 00030 00031 #include <vector> 00032 #include <string> 00033 #include <sstream> 00034 #include <algorithm> 00035 #include <RISE/manager/systemmanager.hpp> 00036 #include <RISE/misc/RISELogger.hpp> 00037 #include <WNS/container/Registry.hpp> 00038 00039 namespace rise { 00046 class MetaSystemManager { 00047 public: 00054 static MetaSystemManager* getInstance() { 00055 if(!myself) myself = new MetaSystemManager(); 00056 return myself; 00057 }; 00058 00064 static void deleteInstance() { 00065 if(myself) delete myself; 00066 myself = NULL; 00067 }; 00068 00075 void attach(SystemManager *sysmgr); 00076 00080 void detach(SystemManager *sysmgr); 00081 00085 SystemManager* getSystemManagerBySystemName(const std::string &aSystemName); 00086 00090 int getTotalNumStations() { 00091 int sum = 0; 00092 for (SystemManagerIterator i=systemManagers.begin(); 00093 i!=systemManagers.end(); ++i) { 00094 sum += i->second->getNumStations(); 00095 } 00096 return sum; 00097 }; 00098 00111 template<class F> inline F forEachSystemManager(F f) { 00112 for(SystemManagerContainer::const_iterator itr = systemManagers.begin(); 00113 itr != systemManagers.end(); 00114 ++itr) { 00115 f(itr->second); 00116 } 00117 return f; 00118 } 00119 00123 void shutDownSystemManagers(); 00124 00125 private: 00129 typedef wns::container::Registry<std::string, SystemManager*> SystemManagerContainer; 00130 00134 typedef SystemManagerContainer::const_iterator SystemManagerIterator; 00135 00139 MetaSystemManager(); 00140 00144 ~MetaSystemManager(); 00145 00149 static MetaSystemManager *myself; 00150 00157 SystemManagerContainer systemManagers; 00158 00162 RISELogger log; 00163 }; 00164 } 00165 #endif 00166 00167
1.5.5