![]() |
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. 16, 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 WNS_NODE_NODE_HPP 00029 #define WNS_NODE_NODE_HPP 00030 00031 #include <WNS/node/Interface.hpp> 00032 #include <WNS/node/component/FQSN.hpp> 00033 #include <WNS/logger/Logger.hpp> 00034 #include <WNS/pyconfig/View.hpp> 00035 #include <WNS/container/Registry.hpp> 00036 #include <WNS/node/Registry.hpp> 00037 00038 #include <map> 00039 #include <list> 00040 #include <algorithm> 00041 #include <functional> 00042 #include <stdint.h> 00043 00044 namespace wns { namespace service { 00045 class Service; 00046 }} 00047 00048 namespace wns { namespace node { 00049 00050 namespace component { 00051 class Interface; 00052 } 00053 00054 namespace tests{ 00055 class NodeTest; 00056 } 00057 00068 class Node : 00069 virtual public Interface 00070 { 00071 // The test needs to reset the list of registered 00072 // nodeIDs to properly test if duplicate ID detection 00073 // works. 00074 friend class wns::node::tests::NodeTest; 00075 00076 protected: 00080 typedef wns::container::Registry<std::string, service::Service*> ServiceContainer; 00081 00085 typedef std::list<component::Interface*> ComponentContainer; 00086 00087 public: 00098 explicit 00099 Node(Registry* registry, const pyconfig::View& pyco); 00100 00101 virtual 00102 ~Node(); 00103 00112 virtual void 00113 addService(const std::string& name, service::Service* si); 00114 00123 virtual void 00124 startup(); 00125 00129 virtual void 00130 onWorldCreated(); 00131 00141 virtual void 00142 onShutdown(); 00143 00147 virtual probe::bus::ContextProviderCollection& 00148 getContextProviderCollection(); 00149 00155 std::string 00156 getName() const; 00157 00163 unsigned int 00164 getNodeID() const; 00165 00166 protected: 00173 virtual wns::service::Service* 00174 getAnyService(const component::FQSN& name) const; 00175 00179 ServiceContainer localServices; 00180 00184 probe::bus::ContextProviderCollection contextProviderRegistry; 00185 00189 std::string name; 00190 00194 unsigned int nodeID; 00195 00199 wns::pyconfig::View config; 00200 00204 logger::Logger log; 00205 00209 Registry* globalNodes; 00210 00215 ComponentContainer localComponents; 00216 00224 static std::list<unsigned long int> ids; 00225 00226 }; 00227 00228 } // node 00229 } // wns 00230 00231 #endif 00232 00233 /* 00234 Local Variables: 00235 mode: c++ 00236 fill-column: 80 00237 c-basic-offset: 8 00238 c-tab-always-indent: t 00239 indent-tabs-mode: t 00240 tab-width: 8 00241 End: 00242 */
1.5.5