User Manual, Developers Guide and API Documentation

ContextProvider.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. 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 #include <WNS/probe/bus/ContextProvider.hpp>
00029 
00030 using namespace wns::probe::bus;
00031 using namespace wns::probe::bus::contextprovider;
00032 
00033 STATIC_FACTORY_REGISTER_WITH_CREATOR(
00034     Constant,
00035     IContextProvider,
00036     "wns.ProbeBus.ConstantContextProvider",
00037     wns::PyConfigViewCreator);
00038 
00039 Constant::Constant(const std::string& key, int value) :
00040     key_(key),
00041     value_(value)
00042 {}
00043 
00044 
00045 Constant::Constant(const pyconfig::View& config) :
00046     key_(config.get<std::string>("key")),
00047     value_(config.get<int>("value"))
00048 {}
00049 
00050 
00051 void
00052 Constant::doVisit(IContext& c) const
00053 {
00054     c.insertInt(key_, value_);
00055 }
00056 
00057 Variable::Variable(const std::string& key, int value) :
00058     key_(key),
00059     value_(value)
00060 {}
00061 
00062 void
00063 Variable::doVisit(IContext& c) const
00064 {
00065     c.insertInt(key_, value_);
00066 }
00067 
00068 void
00069 Variable::set(int value)
00070 {
00071     value_ = value;
00072 }
00073 
00074 int
00075 Variable::get() const
00076 {
00077     return value_;
00078 }
00079 
00080 /*
00081   Local Variables:
00082   mode: c++
00083   fill-column: 80
00084   c-basic-offset: 8
00085   c-tab-always-indent: t
00086   indent-tabs-mode: t
00087   tab-width: 8
00088   End:
00089 */

Generated on Sun May 27 03:31:50 2012 for openWNS by  doxygen 1.5.5