![]() |
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_INTERFACE_HPP 00029 #define WNS_NODE_INTERFACE_HPP 00030 00031 #include <WNS/node/component/FQSN.hpp> 00032 #include <WNS/pyconfig/View.hpp> 00033 #include <WNS/Assure.hpp> 00034 #include <WNS/probe/bus/ContextProviderCollection.hpp> 00035 00036 namespace wns{ namespace service { 00037 class Service; 00038 }} 00039 00040 00041 namespace wns { namespace node { 00042 00043 00048 class Interface 00049 { 00050 public: 00051 Interface() 00052 {} 00053 00054 virtual 00055 ~Interface() 00056 {} 00057 00064 virtual void 00065 addService(const std::string& name, service::Service* si) = 0; 00066 00075 virtual void 00076 startup() = 0; 00077 00081 virtual void 00082 onWorldCreated() = 0; 00083 00093 virtual void 00094 onShutdown() = 0; 00095 00102 template <typename SERVICETYPE> 00103 SERVICETYPE 00104 getService(const std::string& serviceName) const 00105 { 00106 return getRemoteService<SERVICETYPE>(wns::node::component::FQSN(getName(), serviceName)); 00107 } 00108 00115 template <typename SERVICETYPE> 00116 SERVICETYPE 00117 getRemoteService(const component::FQSN& fqsn) const 00118 { 00119 wns::service::Service* si = getAnyService(fqsn); 00120 assureType(si, SERVICETYPE); 00121 // we can't use C-Style downcasts here! 00122 return dynamic_cast<SERVICETYPE>(si); 00123 } 00124 00128 virtual probe::bus::ContextProviderCollection& 00129 getContextProviderCollection() = 0; 00130 00136 virtual std::string 00137 getName() const = 0; 00138 00144 virtual unsigned int 00145 getNodeID() const = 0; 00146 00152 virtual bool 00153 isEqual(Interface* second) const 00154 { assure(second!=NULL,"operand==NULL"); 00155 return getNodeID()==second->getNodeID(); }; 00156 00157 private: 00164 virtual wns::service::Service* 00165 getAnyService(const component::FQSN& fqsn) const = 0; 00166 00167 // Disallow Copy Constructor 00168 Interface(const Interface&); 00169 }; 00170 00171 } // node 00172 } // wns 00173 00494 #endif 00495 00496 /* 00497 Local Variables: 00498 mode: c++ 00499 fill-column: 80 00500 c-basic-offset: 8 00501 c-tab-always-indent: t 00502 indent-tabs-mode: t 00503 tab-width: 8 00504 End: 00505 */
1.5.5