![]() |
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 WNS_LDK_ROUNDROBINLINK_HPP 00029 #define WNS_LDK_ROUNDROBINLINK_HPP 00030 00031 #include <WNS/ldk/Link.hpp> 00032 #include <WNS/RoundRobin.hpp> 00033 00034 namespace wns { namespace ldk { 00035 00036 template <typename RECEPTACLETYPE> 00037 class RoundRobinLink 00038 : virtual public Link<RECEPTACLETYPE> 00039 { 00040 typedef wns::RoundRobin<RECEPTACLETYPE*> ContainerType; 00041 00042 public: 00043 RoundRobinLink() 00044 : recs() 00045 {} 00046 00047 virtual 00048 ~RoundRobinLink() 00049 {} 00050 00051 00052 // Link interface realization 00053 virtual void 00054 add(RECEPTACLETYPE* it) 00055 { 00056 recs.add(it); 00057 } 00058 00059 virtual unsigned long int 00060 size() const 00061 { 00062 return recs.size(); 00063 } 00064 00065 virtual void 00066 clear() 00067 { 00068 recs.clear(); 00069 } 00070 00071 virtual const typename Link<RECEPTACLETYPE>::ExchangeContainer 00072 get() const 00073 { 00074 return recs.getAllElements(); 00075 } 00076 00077 virtual void 00078 set(const typename Link<RECEPTACLETYPE>::ExchangeContainer& src) 00079 { 00080 recs.clear(); 00081 for(typename Link<RECEPTACLETYPE>::ExchangeContainer::const_iterator it = src.begin(); 00082 it != src.end(); 00083 ++it) 00084 { 00085 recs.add(*it); 00086 } 00087 } 00088 00089 protected: 00090 ContainerType recs; 00091 }; 00092 } // ldk 00093 } // wns 00094 00095 #endif // WNS_LDK_SINGLELINK_HPP 00096
1.5.5