![]() |
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_COMMANDPOOL_HPP 00029 #define WNS_LDK_COMMANDPOOL_HPP 00030 00031 #include <WNS/ldk/CommandProxy.hpp> 00032 00033 #include <WNS/osi/PDU.hpp> 00034 #include <WNS/osi/PCI.hpp> 00035 #include <WNS/container/Registry.hpp> 00036 00037 #include <vector> 00038 00039 namespace wns { namespace ldk { 00040 00041 class FunctionalUnit; 00042 class Command; 00043 class CommandTypeSpecifierInterface; 00044 00075 class CommandPool : 00076 public wns::osi::PCI 00077 { 00078 // Only CommandProxy instances are allowed to create new CommandPool 00079 // instances and access their data directly. 00080 friend class CommandProxy; 00081 00082 typedef std::vector<CommandProxy::CommandIDType> PathContainer; 00083 typedef std::vector<Command*> CommandContainer; 00084 // typedef wns::container::Registry<CommandProxy::CommandIDType, Command*> CommandContainer; 00085 00086 public: 00106 CommandPool(const CommandPool& that); 00107 00112 ~CommandPool(); 00113 00121 void 00122 calculateSizes( 00123 Bit& commandPoolSize, 00124 Bit& dataSize, 00125 const FunctionalUnit* questioner = NULL) const; 00126 00131 virtual void 00132 setSDUPtr(wns::osi::PDUPtr& sdu); 00133 00138 virtual std::string 00139 dumpCommandTypes() const; 00140 00141 bool 00142 knowsSameCommandsAs(const CommandPool& other) const; 00143 00147 const fun::FUN* 00148 getOrigin() const { return origin; } 00149 00150 void 00151 setReceiver(const fun::FUN* rec) { receiver = rec; } 00152 00153 const fun::FUN* 00154 getReceiver() const { return receiver; } 00155 00156 #ifndef NDEBUG 00157 virtual size_t 00158 calcObjSize() const; 00159 #endif 00160 protected: 00168 CommandPool(const CommandProxy* proxy, 00169 const fun::FUN* orig); 00170 00180 PathContainer path; 00181 00182 private: 00186 void 00187 insert( 00188 const CommandProxy::CommandIDType& id, 00189 Command* command); 00190 00194 Command* 00195 find(const CommandProxy::CommandIDType& id) const; 00196 00200 bool 00201 knows(const CommandProxy::CommandIDType& id) const; 00202 00207 const CommandProxy* proxy; 00208 00212 CommandContainer commands; 00213 00217 const wns::ldk::fun::FUN* origin; 00218 00223 const wns::ldk::fun::FUN* receiver; 00224 }; 00225 00226 } // ldk 00227 } // wns 00228 00229 #endif // NOT defined WNS_LDK_COMMANDPOOL_HPP 00230 00231
1.5.5