User Manual, Developers Guide and API Documentation

RelayDirection.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-2009
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * email: info@openwns.org
00009  * www: http://www.openwns.org
00010  * _____________________________________________________________________________
00011  *
00012  * openWNS is free software; you can redistribute it and/or modify it under the
00013  * terms of the GNU Lesser General Public License version 2 as published by the
00014  * Free Software Foundation;
00015  *
00016  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00017  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00018  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00019  * details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023  *
00024  ******************************************************************************/
00025 
00026 
00027 #include <WIMAC/compoundSwitch/filter/RelayDirection.hpp>
00028 #include <WIMAC/relay/RelayMapper.hpp>
00029 #include <DLL/compoundSwitch/CompoundSwitch.hpp>
00030 
00031 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00032     wimac::compoundSwitch::filter::RelayDirection,
00033     dll::compoundSwitch::Filter,
00034     "wimac.compoundSwitch.filter.RelayDirection",
00035     dll::compoundSwitch::CompoundSwitchConfigCreator);
00036 
00037 using namespace wimac::compoundSwitch::filter;
00038 
00039 RelayDirection::RelayDirection(dll::compoundSwitch::CompoundSwitch* compoundSwitch, wns::pyconfig::View& config) :
00040     dll::compoundSwitch::Filter(compoundSwitch, config)
00041 {
00042     direction_ = config.get<int>("direction");
00043 }
00044 
00045 void
00046 RelayDirection::onFUNCreated()
00047 {
00048     mapper_ = dynamic_cast<wimac::relay::RelayMapper*>
00049         (compoundSwitch_->findFUNFriend("relayMapper"));
00050     assureNotNull(mapper_);
00051 }
00052 
00053 bool
00054 RelayDirection::filter( const wns::ldk::CompoundPtr& compound) const
00055 {
00056     wimac::relay::RelayMapperCommand* command =
00057         mapper_->getCommand(compound->getCommandPool());
00058     return command->peer.direction_ == direction_;
00059 }
00060 
00061 

Generated on Fri May 25 03:32:14 2012 for openWNS by  doxygen 1.5.5