User Manual, Developers Guide and API Documentation

Keys.cpp

Go to the documentation of this file.
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 #include <LTE/helper/Keys.hpp>
00029 
00030 #include <LTE/rlc/RLCCommand.hpp>
00031 
00032 #include <WNS/ldk/fun/FUN.hpp>
00033 #include <WNS/ldk/CommandReaderInterface.hpp>
00034 
00035 using namespace lte::helper::key;
00036 
00037 STATIC_FACTORY_REGISTER_WITH_CREATOR(FlowIDBuilder,
00038                      wns::ldk::KeyBuilder,
00039                      "lte.FlowID",
00040                      wns::ldk::FUNConfigCreator);
00041 
00042 
00043 FlowID::FlowID(const FlowIDBuilder* factory,
00044            const wns::ldk::CompoundPtr& compound)
00045 {
00046   wns::ldk::CommandPool* commandPool = compound->getCommandPool();
00047 
00048   lte::rlc::RLCCommand* rlcCommand = factory->friends.rlcReader->readCommand<lte::rlc::RLCCommand>(commandPool);
00049 
00050   flowID = rlcCommand->peer.flowID;
00051 }
00052 
00053 FlowID::FlowID(wns::service::dll::FlowID _flowID)
00054 {
00055   flowID = _flowID;
00056 }
00057 
00058 bool
00059 FlowID::operator<(const wns::ldk::Key& _other) const
00060 {
00061   assureType(&_other, const FlowID*);
00062   const FlowID* other = static_cast<const FlowID*>(&_other);
00063   return flowID < other->flowID;
00064 }
00065 
00066 std::string
00067 FlowID::str() const
00068 {
00069   std::stringstream ss;
00070   ss << "FlowID: " << flowID;
00071   return ss.str();
00072 }
00073 
00074 FlowIDBuilder::FlowIDBuilder(const wns::ldk::fun::FUN* _fun,
00075                  const wns::pyconfig::View& /* config */) :
00076   fun(_fun)
00077 {
00078 }
00079 
00080 void
00081 FlowIDBuilder::onFUNCreated()
00082 {
00083   friends.rlcReader = fun->getProxy()->getCommandReader("rlc");
00084 }
00085 
00086 wns::ldk::ConstKeyPtr
00087 FlowIDBuilder::operator () (const wns::ldk::CompoundPtr& compound, int /*direction*/) const
00088 {
00089   return wns::ldk::ConstKeyPtr(new FlowID(this, compound));
00090 } // operator()

Generated on Sun May 27 03:32:04 2012 for openWNS by  doxygen 1.5.5